Linux-Development-Sys Digest #669, Volume #8 Wed, 25 Apr 01 08:13:14 EDT
Contents:
Re: How to associate memory with a PCI device ([EMAIL PROTECTED])
Re: How to associate memory with a PCI device (Grant Edwards)
Re: ide vs. scsi why so much slower ("J. E. Garrott, Sr")
[Help:] msgfmt ("J. Liu")
Re: File access within a kernel mod ("Lee Ho")
Make error ("cui bin")
What is gdt's base address in setup when setup gdtr ?? (hushui)
Help - Edit route table in software? ("Sebastien Jean")
Re: How to get a number of processors (Roberto Nibali)
Utilising IPv6 routing header (Ville Typpo)
Re: How to get a number of processors (Chris)
Re: Make error (Kasper Dupont)
Re: Make error (James Cownie)
----------------------------------------------------------------------------
From: [EMAIL PROTECTED]
Subject: Re: How to associate memory with a PCI device
Date: Tue, 24 Apr 2001 22:19:54 GMT
I am trying to make PC's memory visible to the PCI card. The steps are:
- associate some PC's memory ( RAM ) with the PCI card
- get a pointer to this PC's RAM address space
- what kind of address is this pointer pointing to...is it virtual or bus or
logical...if it is virtual just
assign it
else
convert this address into a virtual address
- then, because of PCI 9054 chip's DMPBAM register ( PCI Base Address (Remap)
Register for Direct Master-to-PCI Memory) only takes 16 bits for address bits,
covert this address to lie on a 64k ( I am not sure if it is a 64k boundary or 1
M..whatever the terminology is ) to assign it.
the exact definition of the 16 bits from the chip manual is
31:16 Remap Local-to-PCI Space into PCI Address Space. Bits in this register
remap (replace) Local Address bits used in decode as the PCI address bits..
note: Here local is refers to the PCI board and 'PCI' refers to the PC side
In article <exmF6.14058$[EMAIL PROTECTED]>, Grant Edwards says...
>
>In article <BbmF6.3960$[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote:
>
>>Maybe if I explain my setup in more detail, it will help the cause. I have a
>>demo board with a 9054 PCI chip ( which acts as a bridge ) on it. This board is
>>plugged into one of the PCI slots on my P.C running linux. I am trying to remap
>>memory range 0x40000000 - 0x4fffffff on the demo-board to the PC's memory (ram).
>
>The PCI board contains memory that occupies 0x40000000-0x4fffffff on the PCI bus?
>
>>The top 16 Bits of the remap register in 9054 needs to be programmed, so that
>>the local CPU on the PCI board can access the PCI region ( PC's RAM, after it is
>>remapped).
>>
>>My thinking is that, I have to have some of the PC's memory (RAM) assigned to my
>>PCI card by my driver. The address of this memory, after being assigned by my
>>driver can be used to initialize this re-map register in the PCI 9054 chip. I am
>>listing a few lines of the sample code that I tried to do this with...but I ran
>>into problems with it...
>
>I still don't understand what you're trying to do.
>
>Does the PCI board have memory on it that you're trying to make
>visible to Linux, or are you trying to reserve some of the PC's
>RAM for use by the PCI board.
>
>--
>Grant Edwards grante Yow! I have many CHARTS
> at and DIAGRAMS...
> visi.com
------------------------------
From: [EMAIL PROTECTED] (Grant Edwards)
Subject: Re: How to associate memory with a PCI device
Date: Wed, 25 Apr 2001 02:20:54 GMT
On Tue, 24 Apr 2001 22:19:54 GMT, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>I am trying to make PC's memory visible to the PCI card.
OK. What you are trying to do is identical to what anybody
with a PCI bus-master DMA controller has to do:
1) Allocate a DMA buffer using __get_free_page or one of it's
relatives.
2) Exclude that DMA buffer from the normal memory management
scheme so that it never gets moved or swapped. In 2.2
kernels that's done by setting the GP_reserved bit in the
memory map data structure for that page. 2.4 may have
changed, I don't know.
3) Configure the PCI bus master to point to that buffer.
[depends on the PCI hardware in question]
4) Impliment mmap() so that Linux user processes can access
the DMA buffer.
The demomm driver at
ftp://ftp.visi.com/users/grante/stuff
Does all of those things except #3 (obviously). The DMA buffer
allocated in that example is only 4K, so you'll have to
allocate a larger one.
If you've a requirement for 64K starting on a 64K boundary,
then you might have to allocate 128K of contiguous pages --
that way you're guaranteed to have 64K on a 64K boundary. You
can then free the other pages.
The comments in the demomm driver refer to the DMA buffer as
a "scratch" memory page.
You might also want to take a look at other drivers for PCI
bus-master DMA boards.
--
Grant Edwards grante Yow! I once decorated my
at apartment entirely in ten
visi.com foot salad forks!!
------------------------------
From: "J. E. Garrott, Sr" <[EMAIL PROTECTED]>
Subject: Re: ide vs. scsi why so much slower
Date: Mon, 23 Apr 2001 22:32:18 -0700
Chronos Tachyon wrote:
>
> On Mon 23 Apr 2001 01:57, J. E. Garrott, Sr wrote:
>
> [Snip]
> >
> > Hmmm. Be careful with this. I tried messing with -u, -m, and
> > -c and destroyed my / partition. fsck couldn't repair it.
> > (Actually, it put all the files under lost+found with names
> > like #32454. Haven't figured out what to do with them. Since
> > I have a recent backup of the / partition, it was easier to
> > just copy it back.)
> >
> > Oh, ASUS A7V133 motherboard, 800 MHz Athlon, 30 G Maxtor.
> >
> >
> > John
> >
>
> Whenever you tinker with hdparm settings, you should go to single user
> mode, remount all of your filesystems as read-only, and do a sync before
> continuing. Usually unnecessary, but well worth it for that rare occasion
> that your drive doesn't like the hdparm settings you throw at it.
>
> --
> Chronos Tachyon
> Guardian of Eristic Paraphernalia
> Gatekeeper of the Region of Thud
> [Reply instructions: My real domain is "echo <address> | cut -d. -f6,7"]
I did this and played with it a bit more. The line that works is:
hdparm -X66 -d1 -u1 -m16 -c3 /dev/hdb
Without the -X66 it corrupts the / partition, unless I drop
both the -d1 and -u1, then it only gives a 2X improvement.
As given, it picks up to 20.5 MHz/sec from 3.9. The cache
transfer rate remains fairly steady around 145 Mhz/sec.
John
------------------------------
From: "J. Liu" <[EMAIL PROTECTED]>
Subject: [Help:] msgfmt
Date: Wed, 25 Apr 2001 00:24:24 -0400
Hello,
what is msgfmt ? where can I get it and how to install it ?
Thanks.
------------------------------
From: "Lee Ho" <[EMAIL PROTECTED]>
Subject: Re: File access within a kernel mod
Date: Wed, 25 Apr 2001 05:08:15 GMT
I wrote some function can read/write file in kernel mode.
The functions are similiar C library function.
You can check it, http://linuxkernel.to/klib/download/klib.tar.gz
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne
Mail : [EMAIL PROTECTED] (work), [EMAIL PROTECTED] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to
Wayne Wrote:
>I'm still getting use to this kernel mod stuff and am curious if there is an
>easy way
>to access a file on the harddrive.
------------------------------
Date: Wed, 25 Apr 2001 14:51:33 +0800
From: "cui bin" <[EMAIL PROTECTED]>
Subject: Make error
Hi all,
When I complie C++ program, the system reported an error "collect2: ld
terminated with signal 11 [Segmentation fault] core dumped". Can someone
tell what's the error?
thanks a lot
cuibin
------------------------------
From: hushui <[EMAIL PROTECTED]>
Subject: What is gdt's base address in setup when setup gdtr ??
Date: 25 Apr 2001 06:54:05 GMT
In setup ,lgdt will load gdt discripters.
Its base address is saved in GDTR (48 bit ,limitation of gdt (16bit) + base address of
gdt 932 bits)) which is in i386 .
In setup.S ,
........
gdt_48:
.word 512+gdt,0x9 !!!!!!what is this means???
------------------------------
From: "Sebastien Jean" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.networking
Subject: Help - Edit route table in software?
Date: Tue, 24 Apr 2001 16:35:03 -0700
Changing the routing table from the command line is easy. Does anyone know
how to change the routing table from within a program written in C/C++?
What about changing Ethernet device parameters.
Any information on these topics would be greatly appreciated.
Thanks.
------------------------------
From: Roberto Nibali <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How to get a number of processors
Date: Wed, 25 Apr 2001 10:17:49 +0200
Dave Blake wrote:
>
> Chris <[EMAIL PROTECTED]> wrote:
> > Dave Blake wrote:
>
> > > Parsing /proc is the only way on a linux system. The kernel API
> > > does not support the POSIX sysconf standard, although the glibc
> > > maintainers do support it (I think by parsing /proc).
> >
> > I was incorrect in stating that it was a system call; it
> > is not, either on Linux or Solaris.
>
> I think that it is a system call on Solaris. And the glibc
> maintainers spent some time trying to make it a system call on
> linux.
Indeed, looks like:
zar:~ # cat how_much_processors.c
#include <stdio.h>
#include <unistd.h>
int main(void){
printf("Processors: %ld\n", sysconf(_SC_NPROCESSORS_CONF));
return(0);
}
zar:~ # gcc -Wall -o how_many_processors how_many_processors.c
zar:~ # strace -i -f -v -T -tt ./how_many_processors
10:13:15.204080 [40001990] execve("./how_many_processors",
["./how_many_processors"], [/* 55 vars */]) = 0
10:13:15.205579 [4000f1f4] brk(0) = 0x80495f0 <0.000030>
10:13:15.206969 [4000e894] open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No
such file or directory) <0.000055>
10:13:15.208393 [4000e894] open("/etc/ld.so.cache", O_RDONLY) = 3 <0.000057>
10:13:15.209675 [4000e77d] fstat(3, {st_dev=makedev(3, 1), st_ino=8302,
st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=96, st_size=47497, st_atime=101/04/25-10:13:15,
st_mtime=101/04/24-09:55:56, st_ctime=101/04/24-09:55:56}) = 0 <0.000032>
10:13:15.211321 [4000f2bd] mmap(NULL, 47497, PROT_READ, MAP_PRIVATE, 3, 0) =
0x40014000 <0.000048>
10:13:15.212597 [4000e8cd] close(3) = 0 <0.000031>
10:13:15.213803 [4000e894] open("/lib/libc.so.6", O_RDONLY) = 3 <0.000058>
10:13:15.217442 [4000e77d] fstat(3, {st_dev=makedev(3, 1), st_ino=61453,
st_mode=S_IFREG|0755, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=7968, st_size=4061504, st_atime=101/04/25-10:13:15,
st_mtime=100/03/11-09:34:41, st_ctime=100/07/26-15:46:26}) = 0 <0.000033>
10:13:15.219136 [4000e914] read(3,
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340\213"..., 4096) = 4096
<0.000072>
10:13:15.220637 [4000f2bd] mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40020000 <0.000044>
10:13:15.222018 [4000f2bd] mmap(NULL, 924892, PROT_READ|PROT_EXEC, MAP_PRIVATE,
3, 0) = 0x40021000 <0.000047>
10:13:15.223362 [4000f344] mprotect(0x400fb000, 31964, PROT_NONE) = 0 <0.000039>
10:13:15.224597 [4000f2bd] mmap(0x400fb000, 20480, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, 3, 0xd9000) = 0x400fb000 <0.000054>
10:13:15.226035 [4000f2bd] mmap(0x40100000, 11484, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40100000 <0.000051>
10:13:15.227406 [4000e8cd] close(3) = 0 <0.000031>
10:13:15.229645 [4000f301] munmap(0x40014000, 47497) = 0 <0.000048>
10:13:15.231041 [400c0ccd] personality(PER_LINUX) = 0 <0.000029>
10:13:15.232333 [400a1db7] getpid() = 3416 <0.000029>
10:13:15.233700 [400bb114] brk(0) = 0x80495f0 <0.000031>
10:13:15.235028 [400bb114] brk(0x80496b8) = 0x80496b8 <0.000546>
10:13:15.236225 [400bb114] brk(0x804a000) = 0x804a000 <0.000527>
10:13:15.237490 [400b5094] open("/etc/fstab", O_RDONLY) = 3 <0.000590>
10:13:15.238847 [400b4328] fstat(3, {st_dev=makedev(3, 1), st_ino=8194,
st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=2, st_size=611, st_atime=101/04/25-10:13:08,
st_mtime=101/04/23-20:01:04, st_ctime=101/04/23-20:01:04}) = 0 <0.000524>
10:13:15.240426 [400be1dd] mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000 <0.000620>
10:13:15.241786 [400b5154] read(3, "/dev/hda1 / "..., 4096)
= 611 <0.000580>
10:13:15.243338 [400b510d] close(3) = 0 <0.000529>
10:13:15.244522 [400be221] munmap(0x40014000, 4096) = 0 <0.000586>
10:13:15.245834 [400b5094] open("/proc/cpuinfo", O_RDONLY) = 3 <0.000632>
10:13:15.247149 [400b4328] fstat(3, {st_dev=makedev(0, 4), st_ino=4100,
st_mode=S_IFREG|0444, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096,
st_blocks=0, st_size=0, st_atime=101/04/25-10:13:15,
st_mtime=101/04/25-10:13:15, st_ctime=101/04/25-10:13:15}) = 0 <0.000528>
10:13:15.248707 [400be1dd] mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000 <0.000622>
10:13:15.250029 [400b5154] read(3, "processor\t: 0\nvendor_id\t: Genuin"...,
4096) = 367 <0.000612>
10:13:15.251416 [400b5154] read(3, "", 4096) = 0 <0.000572>
10:13:15.252663 [400b510d] close(3) = 0 <0.000537>
10:13:15.253849 [400be221] munmap(0x40014000, 4096) = 0 <0.000550>
10:13:15.255201 [400b4328] fstat(1, {st_dev=makedev(0, 5), st_ino=4,
st_mode=S_IFCHR|0620, st_nlink=1, st_uid=120, st_gid=100, st_blksize=1024,
st_blocks=0, st_rdev=makedev(136, 2), st_atime=101/04/25-10:13:15,
st_mtime=101/04/25-10:13:15, st_ctime=101/04/25-10:12:48}) = 0 <0.000196>
10:13:15.255670 [400be1dd] mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000 <0.000023>
10:13:15.255809 [400bb204] ioctl(1, TCGETS, {c_iflags=0x2d02, c_oflags=0x5,
c_cflags=0x4bf, c_lflags=0x8a3b, c_line=0,
c_cc="\x03\x1c\x7f\x15\x04\x00\x01\xff\x11\x13\x1a\xff\x12\x0f\x17\x16\xff\x00\x00\x74\xed\xff\xbf\xd3\x6a\x0b\x40\x01\x00\x00\x00\x38"})
= 0 <0.000018>
10:13:15.256071 [400b5194] write(1, "Processors: 1\n", 14Processors: 1
) = 14 <0.000019>
10:13:15.256228 [400be221] munmap(0x40014000, 4096) = 0 <0.000023>
10:13:15.256340 [400a180d] _exit(0) = ?
zar:~ #
Best regards,
Roberto Nibali, ratz
--
mailto: `echo [EMAIL PROTECTED] | sed 's/[NOSPAM]//g'`
------------------------------
From: Ville Typpo <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.networking
Subject: Utilising IPv6 routing header
Date: Wed, 25 Apr 2001 11:41:53 +0300
Hi!
Does someone know, if there is any way to "force" Linux kernel to
utilise IPv6 routing header and define some intermediate hop, when
sending packets to some specified destination? Of course, routing header
can be constructed by user level application, but my intention would be
that once I've defined such an IPv6 source route by hand or by some user
level process, every data packet from all of my apps would use this
route by default.
I'd be thankful for any hints!
-Ville
[EMAIL PROTECTED]
------------------------------
From: Chris <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How to get a number of processors
Date: Wed, 25 Apr 2001 10:53:14 +0100
Dave Blake wrote:
>
> Chris <[EMAIL PROTECTED]> wrote:
> > Dave Blake wrote:
>
> > > Parsing /proc is the only way on a linux system. The kernel API
> > > does not support the POSIX sysconf standard, although the glibc
> > > maintainers do support it (I think by parsing /proc).
> >
> > I was incorrect in stating that it was a system call; it
> > is not, either on Linux or Solaris.
>
> I think that it is a system call on Solaris. And the glibc
> maintainers spent some time trying to make it a system call on
> linux.
It's in (3C) on Solaris.
> > How glibc does the business is not really important, so
> > long as it works.
> >
> > > And I think that /proc/stat is going to prove more resistant to
> > > change than /proc/cpuinfo, but neither are above change. I do
> > > know that the procps package does need to know the number of
> > > CPUs for a few things, and it parses /proc/stat to get this
> > > info.
> >
> > This is a terrible idea, because it is gratuitously
> > non-portable.
>
> Look - if the kernel maintainers change /proc/stat in some
> subtle way, it will break the sysconf call. If your program
> looks at /proc/stat, you can fix it rather easily. If glibc is
> broken, it will take a LOT longer to fix. And the changes will
> take a LOT longer to propagate since most people rarely if ever
> upgrade glibc.
That is not what portability means.
Portability means that your program stands a fighting
chance of running on *another* system, rather than that
it will run on Linux in the future.
Your argument about glibc is spurious, for two reasons.
Firstly, you shouldn't duplicate code; if there needs to
be code to read /proc/stat to count the number of CPUS
in the system, there should be only one instance of it,
so that there is only one thing to correct. The second
is that there is no reason that developers of random
applications should track kernel changes of this sort;
far better to let the glibc maintainers-- who really
need to track the kernel-- do it for you. They are also,
probably, less likely to screw it up.
You cannot be seriously suggesting that your program
should, on Linux, parse /proc/stat, whereas on another
system it does it The Right Way(TM)?
--
Chris Lightfoot -- chris at ex dash parrot dot com -- www.ex-parrot.com/~chris/
If you see a long line of rats streaming off of a ship, the correct
assumption is not `Gosh, I bet that's a real nice boat now that those
rats are gone.' (Mike Sphar)
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Make error
Date: Wed, 25 Apr 2001 10:24:59 +0000
cui bin wrote:
>
> Hi all,
> When I complie C++ program, the system reported an error "collect2: ld
> terminated with signal 11 [Segmentation fault] core dumped". Can someone
> tell what's the error?
>
> thanks a lot
>
> cuibin
Sounds like an internal error in the linker.
Which verssion of the linker are you using,
try typing "ld --version"
Does this happen with all C++ programs you
try to compile or just one single program?
If you have a small example that fails try
posting the source.
--
Kasper Dupont
------------------------------
From: James Cownie <[EMAIL PROTECTED]>
Subject: Re: Make error
Date: Wed, 25 Apr 2001 11:50:22 GMT
Kasper Dupont wrote:
> Sounds like an internal error in the linker.
>
> Which verssion of the linker are you using,
> try typing "ld --version"
>
> Does this happen with all C++ programs you
> try to compile or just one single program?
> If you have a small example that fails try
> posting the source.
Also worth checking that you have enough disk space,
particularly in /tmp (or wherever your TMPDIR is pointing).
I have certainly seen occasions where compilers and linkers
fail rather too drastically if there is insufficient disk space
available.
-- Jim
James Cownie <[EMAIL PROTECTED]>
Etnus, LLC. +44 117 9071438
http://www.etnus.com
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list by posting to the
comp.os.linux.development.system newsgroup.
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************