RetroBSD

2.11BSD operating system for microcontrollers
It is currently Thu Dec 13, 2018 5:50 am

All times are UTC




Post new topic Reply to topic  [ 94 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
PostPosted: Sat Sep 29, 2012 1:32 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
I am at the moment experimenting with adding partitioning to the system. If it works, it will replace the whole of the current disk system, and the swap system as well.

I am undecided how best to handle swap detection. I might have it statically compiled from the Makefile as a major/minor pair, specifying a block device & partition, or I might have it auto-detect looking for any partitions of type B8 (BSDi Swap) and automatically use those.

Of course, the latter would only be possible for non-volatile media like flash or MRAM, so some kind of static compilation is going to be needed.

The new system will have /dev/rdX, and /dev/rdX[a-d] for each storage device on the system, regardless of what it is used for - swap or filesystem.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 1:36 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Majenko's P1 is to create a generic device driver for swap and filesystem for various types of exernal ramdisk-like devices (see the other recent topic on swap and fs). Basically, you may take the "swap.c", currently written for my type of swapdisk (cpld based), and connect yours in that manner. I think we need much more generic approach than messing with swap.c, with partitioning, etc., however.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 1:41 am 
Committer

Joined: Thu Nov 08, 2012 3:55 am
Posts: 177
Majenko, in that case I'll just leave things the way the are relative to the handling of /dev/swap and look forward to your changes.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 1:53 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
So far I have the kernel identifying that there is partitions there. I am now trying to get it to read data from them ;)

It's going to be a long long night....

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 1:53 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Or is that an unsigned long long night?

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 1:59 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
@madscifi: your issues with ps mean you already running the sdram with a modified swap.c.. Did you provide some performance testings (ie mounted as fs and dd to it, etc)??

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 3:06 am 
Committer

Joined: Thu Nov 08, 2012 3:55 am
Posts: 177
I just repeated the test you did in post http://retrobsd.org/topic/swapdisk-v1-1-is-4mbx8-and-alive/#post-991 (creating a filesystem on swap and reading/writing a large file). Results:

Writing SSS:
1.1 real 0.0 user 0.9 sys

Reading SSS:
1.0 real 0.0 user 0.8 sys

The code is definitely not optimized yet - everything goes through a temp buffer in order to eliminate potential alignment issues. On the other hand I don't know if optimizing the code will show any real change in performance at this level or not. Drat. Now I have to try speeding up the code a bit. ;)


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 3:45 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Promising results, indeed.. After the finetuning we may do a comparision.. I am going to replace my 55ns sram for a 10ns part till then ;)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 3:46 am 
Committer

Joined: Thu Nov 08, 2012 3:55 am
Posts: 177
I just tried bypassing the temp buffer and such in the code. It makes little difference (0.1 seconds faster when writing SSS, sometimes) in the performance at the user level. The only thing I can think of at this point that might significantly increase the performance is to add support for 16 bit transfers to/from the sdram. I don't know if anyone is interested in losing the additional pins required to do that or not.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 3:50 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Do you use the burst modes? No problems with disabled interrupts during sdcard's r/w?

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 5:04 am 
Committer

Joined: Thu Nov 08, 2012 3:55 am
Posts: 177
Simply ignoring alignment issues when the sdram is actually supporting swap does not work, so the temp buffer stays in for the moment. Given the tiny increase in performance it is probably not worth the extra code to worry about optimizing the temp buffer away when it is not needed.

There are no problems with sdcard disabling interrupts. If the sdram is not actively being read/written then the sdram is left in a detached, self-refreshing, state. However, the code is probably incompatible with USB at the moment as both interrupts and DMA need to be disabled while the sdram is being read/written.

The sdram is read/written to in 8 byte bursts.

For fun I just hacked a version of majenko's suggestion in post http://retrobsd.org/topic/swap-and-fs-all-in-1/#post-3600 , modifying the swstrategy function for the sdram swap device as follows:

unsigned adj = 0;
if (minor(bp->b_dev)==1) {
adj = 2050; // 2048 should be correct, but just in case...
}
if (bp->b_flags & B_READ) {
dev_read (bp->b_blkno+adj, bp->b_addr, bp->b_bcount);
} else {
dev_write (bp->b_blkno+adj, bp->b_addr, bp->b_bcount);
}

Created a sw1 device:
mknod /dev/sw1 b 1 1

I was then able to create, mount, read/write to the sdram as a file system on /dev/sw1 while the lower portion of the sdram was being used for swap. This needs some work to specify the sizes correctly and such, but it all seems to work well.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 5:57 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
You want to see cool?


2.11 BSD Unix for PIC32, revision 577M build 15:
Compiled 2012-09-28 by matt@laptop01:
/home/matt/retrobsd/retrobsd-partition/sys/pic32/baremetal
cpu: 795F512L 80 MHz, bus 80 MHz
oscillator: internal Fast RC, PLL div 1:2 mult x20
console: port UART1
sd0: port SPI2, select pin D1
sd0: type SDHC, size 3872256 kbytes, speed 10 Mbit/sec
phys mem = 128 kbytes
user mem = 96 kbytes
root dev = (0,1)
root size = 16384 kbytes
swap dev = (0,2)
swap size = 523264 kbytes
/dev/rd0a: 314 files, 7823 used, 8496 free
Starting daemons: update


2.11 BSD UNIX (pic32) (console)

login:


That's two partitions on /dev/rd0

It doesn't (yet) care about the partition types, but it is actually working. It reads and writes. I could, I suppose, add another partition and try using it from inside retro - that's the next big test. Wish me luck ;)

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 6:05 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Am I lucky or what?


# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
root 16319 7925 8394 48% /
/dev/rd0b 522239 2 522237 0% /u


I have /dev/rd0c formatted as well, however I can't mount it as the mount table is full ;)

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 6:21 am 
Committer

Joined: Thu Nov 08, 2012 3:55 am
Posts: 177
Majenko, very nice.


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 6:27 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
However, now something strange has happened.

I change NMOUNT to 4 in param.h and it stopped booting - LED just kept flashing, and nothing on the console. Now, I have changed it back to 2 (which it was before) and it just sits there doing nothing.

Nothing else has changed.

I am, it is fair to say, somewhat puzzled.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 7:01 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Ok, it was just MPLAB-X being retarded. It had suddenly decided that the unix.elf file I had been programming into the chip for ages was suddenly somewhere else, and it was loading god knows what onto the chip.


# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/rd0a 16319 7823 8496 47% /
/dev/rd0b 522239 2 522237 0% /u
/dev/rd0c 522239 2 522237 0% /u2


Howzzat!?

I am having some problems with fsck though - mainly because there is no character device interface to this at the moment. Still, that will come soon.

I think that's enough for one night. More tomorrow (today?)

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 7:16 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
Amazing! Just as all these big mainframes twenty years ago. :)

_________________
--Serge


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 7:21 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1079
Location: Sunnyvale, CA
I mean thirty years ago. :)

_________________
--Serge


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 7:31 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
How time flies... ;)

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Sep 29, 2012 3:02 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Slowly creating an HAL9000.. With this dev speed we could talk to him next week :)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 94 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission