Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
soc:2010:peper:journal:week11 [2010/08/08 06:56] peper |
soc:2010:peper:journal:week11 [2010/08/08 07:04] (current) peper |
||
---|---|---|---|
Line 32: | Line 32: | ||
I was a bit overoptimistic about linker stripping unused functions. | I was a bit overoptimistic about linker stripping unused functions. | ||
- | It turns out that functions are linked with object granularity so adding ''strtoull()'' to ''core/misc.c'' which is used only on linux was in fact included in other builds as well. | + | It turns out that functions are linked with object granularity so adding ''strtoull()'' to ''core/misc.c'' which is used only on linux was in fact growing other builds as well. |
- | Moved it to a separate object ''core/strtoull.c''. | + | Moved it to a separate object ''core/strtoull.c'' to eliminate that problem. |
- | That makes me wonder whether we have any dead functions that can be nuked to reduce size. On a similar note [[http://gcc.gnu.org/gcc-4.5/changes.html|gcc 4.5.0]] introduced whole program optimizations, which might be worth looking into. | + | That makes me wonder whether we have any dead functions that can be nuked to reduce size. Also on a similar note [[http://gcc.gnu.org/gcc-4.5/changes.html|gcc 4.5.0]] introduced whole program optimizations, which might be worth looking into. |
Although I'm waiting for ''4.5.1'' as it also introduced some nasty regressions that are quite noticable on a source-based distro like [[http://www.exherbo.org|exherbo]] that I'm using. | Although I'm waiting for ''4.5.1'' as it also introduced some nasty regressions that are quite noticable on a source-based distro like [[http://www.exherbo.org|exherbo]] that I'm using. | ||
Line 47: | Line 47: | ||
This worked just fine, but this kind of hacks just don't let me sleep comfortably at night ;) | This worked just fine, but this kind of hacks just don't let me sleep comfortably at night ;) | ||
- | Since that time I have had the chance to inspect some of the code behind the ''/sys/'' PCI interface (see [[http://www.mjmwired.net/kernel/Documentation/filesystems/sysfs-pci.txt|sysfs-pci.txt]] | + | Since that time I have had the chance to inspect some of the code behind the ''/sys/'' PCI interface (see [[http://www.mjmwired.net/kernel/Documentation/filesystems/sysfs-pci.txt|sysfs-pci.txt]]) |
and it looked quite simple as far as creating new sysfs attributes goes and the obvious solution occurred to me. Just add a sysfs device attribute with the ''UIO-DMA'' ''device_id''. And so I did: | and it looked quite simple as far as creating new sysfs attributes goes and the obvious solution occurred to me. Just add a sysfs device attribute with the ''UIO-DMA'' ''device_id''. And so I did: | ||
<code c> | <code c> | ||
Line 69: | Line 69: | ||
And done. It also has the the nice side-effect of ensuring the device we are using is handled by our simple driver and not anything else. | And done. It also has the the nice side-effect of ensuring the device we are using is handled by our simple driver and not anything else. | ||
+ | |||
+ | <code> | ||
+ | $ ls -al /sys/bus/pci/devices/0000:09:00.0/ | ||
+ | total 0 | ||
+ | drwxr-xr-x 3 root root 0 2010-08-08 15:13 . | ||
+ | drwxr-xr-x 5 root root 0 2010-08-08 15:13 .. | ||
+ | -rw-r--r-- 1 root root 4096 2010-08-08 16:00 broken_parity_status | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 15:47 class | ||
+ | -rw-r--r-- 1 root root 256 2010-08-08 15:47 config | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 16:00 consistent_dma_mask_bits | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 15:47 device | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 16:00 dma_mask_bits | ||
+ | lrwxrwxrwx 1 root root 0 2010-08-08 15:47 driver -> ../../../../../bus/pci/drivers/uio-dma-pci | ||
+ | -rw------- 1 root root 4096 2010-08-08 16:00 enable | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 15:47 irq | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 16:00 local_cpulist | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 16:00 local_cpus | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 16:00 modalias | ||
+ | -rw-r--r-- 1 root root 4096 2010-08-08 16:00 msi_bus | ||
+ | drwxr-xr-x 2 root root 0 2010-08-08 16:00 power | ||
+ | --w--w---- 1 root root 4096 2010-08-08 16:00 remove | ||
+ | --w--w---- 1 root root 4096 2010-08-08 16:00 rescan | ||
+ | --w------- 1 root root 4096 2010-08-08 16:00 reset | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 15:47 resource | ||
+ | -rw------- 1 root root 33554432 2010-08-08 16:00 resource0 | ||
+ | -r-------- 1 root root 65536 2010-08-08 16:00 rom | ||
+ | lrwxrwxrwx 1 root root 0 2010-08-08 16:00 subsystem -> ../../../../../bus/pci | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 16:00 subsystem_device | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 16:00 subsystem_vendor | ||
+ | -rw-r--r-- 1 root root 4096 2010-08-08 16:00 uevent | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 15:13 uio_dma_id | ||
+ | -r--r--r-- 1 root root 4096 2010-08-08 15:47 vendor | ||
+ | -rw------- 1 root root 128 2010-08-08 15:47 vpd | ||
+ | $ cat /sys/bus/pci/devices/0000:09:00.0/uio_dma_id | ||
+ | 0x00000002 | ||
+ | </code> | ||
=== Extra checks and cleanup === | === Extra checks and cleanup === |