Re: segmentation question
Can you share the code? On 02/10/2010 12:10, Daniel Baluta daniel.bal...@gmail.com wrote: Hi, On Sat, Oct 2, 2010 at 12:38 AM, Sri Ram Vemulpali sri.ram.gm...@gmail.com wrote: Hi All, I am developing segmentation for my kernel. In that process I choose to divide ... You don't have to tell your processor to choose only 16-bit offset. If the offset is greater than segment limit an exception will occur. Any insight in to this will help me. please clarify my doubt. Waiting for you reply. To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linu... @Bond: GTD should be GDT.Also please have a look inside x86 reference manual. thanks, Daniel. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linu...
Re: Integer Division on 32 Bit Machines
use do_div On Tue, Sep 7, 2010 at 1:02 PM, Andreas Leppert wu...@web.de wrote: Hello, I have encountered a problem on my 32 bit machine. Here some code snippets: typedef signed long s64; asmlinkage long sys_optStopMeasure(int __user workamount) { s64 currentPerformance, currentTimePerWork; ... currentTimePerWork = currentPerformance / workamount; ... } When I run a make, I get this error at the end: LD vmlinux.o MODPOST vmlinux.o GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o LD init/built-in.o LD .tmp_vmlinux1 optimizer/built-in.o: In function `sys_optStopMeasure': /source/trunk/linux-2.6.34/optimizer/sys_optStopMeasure.c:144: undefined reference to `__divdi3' Another person which has tried the code had no problems - he compiled the code for a 64 bit machine. Can you explain to me the problem? Why does the code work on 64 but not on 32 bit? I've looked for some workarounds and found do_div(). Is this the way to go? Or are there better ways? Thanks for your help! Andreas -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
porting to linux - survey
Hello. I wish to write a paper that describes what it means to port from vxworks/CE/other to linux in all apects but from your experience. The bellow is a list of questions. why did you port ? when did the porting started ? what type of system you have , server, realtime, ...? Can you estimate how many lines of code were ported ? Was there an effort to teach the engineers linux ? did it succeed / partialy succeed ? If new engineers were recruited, was it difficult to find linux programmers ? how long did it take to recruit ? Was the same team structure preserved or a new hirarchy created ? how long did it take to the first linux product ? Did you release new versions of the old OS while migrating ? after the migration is done ? if so , do you have the same engineers supporting the old code ? What are the information resources you used for that ? Did you consult with professionals ? how did you reach a decision what sort of linux flavor to use ? Were new positions/skills required ? Did you recruit platform engineers ? Kernel engineers ? Did you use porting libraries or a nother solution ? did you change the system design ? Did you use other programming languages other than c and c++ to migrate ? Once the porting was complete can you estimate whether it takes the same effort to release a product ? What was the clients response when they were told you changed OS ? Did they know or care ? Is the linux product required to do more than the old OS product? Were all engineers using the same operating system or did some programmers use linux while others running windows ? Did it matter ? Were there any logistics changes due to the porting ? Did the IT department took part , like switching exchange server to something else ? Did you use the same source control system ? bug tracking system ? Did you keep your code closed or is it open/partialy open ? thank you raz -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Get UTC from RDTSC
On Sun, Jul 18, 2010 at 5:32 AM, Mulyadi Santosa mulyadi.sant...@gmail.comwrote: Here I see you begun to understand... now since I forgot what's that CMOS clock real name isI can no longer help.. how about checking what gettimeofday() syscall really does? you can boot kernel with gettimeofday over tsc. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: How to check whether executing in atomic context?
take a look at might_sleep On Wed, Oct 14, 2009 at 10:09 AM, Leonidas . leonidas...@gmail.com wrote: Hi List, I am aware of in_interrupt() call which can be used to check current context and take action accordingly. Is there any api which can help figure out whether we are executing while hold a spinlock? I.e an api which can help figure out sleepable/nonsleepable context? If it is not there, what can be done for writing the same? Any pointers will be helpful. -Leo. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: the sendfile function call of file_operations
http://linuxgazette.net/issue91/tranter.html On Tue, Oct 13, 2009 at 5:48 PM, loody milo...@gmail.com wrote: Dear all: I saw there is a callback function in file_operations, sendfile, and it seems user mode can pass file handle to kernel by this function. is there any document or example can tell me how to use this function? thanks for your kind help, miloody -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Copying kernel module error messages to userspace
i would i have used netconsole. On Tue, 2009-09-15 at 11:45 +0530, Leonidas . wrote: On Mon, Sep 14, 2009 at 7:00 PM, Pei Lin telent...@gmail.com wrote: 2009/9/14 Leonidas . leonidas...@gmail.com: On Mon, Sep 14, 2009 at 4:01 PM, Leonidas . leonidas...@gmail.com wrote: On Mon, Sep 14, 2009 at 3:32 PM, Leonidas . leonidas...@gmail.com wrote: On Mon, Sep 14, 2009 at 3:28 PM, Leonidas . leonidas...@gmail.com wrote: On Mon, Sep 14, 2009 at 2:46 PM, karunakar rao karunakar.san...@gmail.com wrote: hi leo maintain circular buffer in module, so that if user doesn't access for days its going to be automatically discarded.I think printk also use same kind of mechanism which dumps data into cirbuffer. thanks, karuna. On Mon, Sep 14, 2009 at 2:41 PM, Leonidas . leonidas...@gmail.com wrote: On Mon, Sep 14, 2009 at 2:30 PM, karunakar rao karunakar.san...@gmail.com wrote: hi leo you can maintain buffer in your module to log errors.When user tries to access /proc you can print all those from your buffer. Thanks, karuna. On Mon, Sep 14, 2009 at 1:22 PM, Leonidas . leonidas...@gmail.com wrote: Hi List I have written a kernel module which implements a char device. An userspace app is supposed to get data from my module and then dump it into a file for further processing. The kind of data which kernel module is going to pass to userspace is going to be a 4K buffer, and the data traffic is not going to be really heavy, meaning may be a 4K buffer every 1 min or so. I am not very sure though, but certainly not heavy traffic the way they describe for network traffic etc. And this data needs to be logged to a file either from kernel or userspace and an userspace all will work on that data. This data needs to be logged as soon as it arrives meaning, I might not be able to write it to /proc since from module I can update /proc only when user actually accesses it. This data needs to be static in nature, meaning I get one error and I write it to a file somehow and user can see it anytime. I hope I have described the situation clearly. I have explored some mechanism like ioctls, mmaping the kernel buffer etc but all these would require the user module to poll or notified somehow by kernel that the data is available. I dont want the user module to poll. -Leo. Pei Lin, I am not limiting my solution by using a law or what someone says. But I think it is very important to follow the spirit of environment/OS/arch you are working on and come up with the best possible solution. hi , i didn't receive these messages. (^-^) yeah,u can choose the way u wanna go,no matter a wide road or some private alleys. which one is convenient for different guys. As you correctly mention we can hack around and achieve the same functionality but I would rather do these kind of experiments for fun or to show my friends that the kernel can be hacked these ways, but certainly not in a system which is supposed to be a production system. I appreciate your thoughts and I am sure many times one stumbles upon real cool things which change course of nature and are reasons for radical changes in various subsystems. But I think this is not one of them, this has been discussed over and over again and there are standard interfaces defined. My questions is more about the design part not about how I can hack and get the stuff done. yeah,i agree. If it is a commercial software, it need a pretty and clean interface to support future updating and maintenance. Karuna, I had thought about this solution i.e. maintain a buffer in module and dump it whenever user wants, only
Re: zero copy on socket recv
I have implemented receive zero copy. but i did in UDP and not TCP. what protocol do u use ? On Mon, Aug 17, 2009 at 11:55 AM, Rahul K Patel rahulk.pa...@einfochips.com wrote: Hi, I know about sendfile api which can be used to implement zero copy for sending data over socket. But I want to implement zero copy on socket receiving side. I looked at the kernel code and found that mmap is also not available on socket. Is it possible to implement zerocopy on socket receive without modifying kernel code? or is there any api/syscall available for it? thanks for any help, -- Rahul Patel Embedded Software Engineer eInfochips Ltd. Tel. No. 91-79-26400801-2 Ext. 156 www.einfochips.com -- _ Disclaimer: This e-mail message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally privileged and confidential information. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to this message and please delete it from your computer. Any views expressed in this message are those of the individual sender unless otherwise stated.Company has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email. _ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Cache Size
better if you simply read what programmer should know about memory by Urlich drepper. On Mon, Aug 17, 2009 at 11:39 AM, manish rangankar rangankarman...@gmail.com wrote: Hi All, How can we determine the size of cache? For example, In UFS filesystem some cache is reserved for CG. I read somewhere on the net that 10% of the total RAM is sufficient for handling the heavy incoming data IO request! I want to know like what all parameters are should be considered while deciding a cache size, considering the worst case scenario i.e. heavy IO ? - Manish R
Re: want to write a file system
I have written a file system in linux several years ago. I used a book called UNIX FILE SYSTEM by Steve Pate On Mon, Aug 3, 2009 at 12:54 PM, Anuz Pratap Singh Tomar chambilketha...@gmail.com wrote: On Mon, Aug 3, 2009 at 2:34 PM, Srdjan Todorovic todorovi...@googlemail.com wrote: Hi, On 03/08/2009, nidhi mittal hada nidhimitta...@gmail.com wrote: hello all i want to write a filesystem for kernel for learning purpose only . i have read background theory from bach utlk i was studying ext2 code for knowing how its written Understanding the Linux Kernel revision 3 has a very good chapter on Ext2/3. Is this not good enough? but its huge code i am reading it from days but i feel i catch one corner and forgetting other ...not much success Maybe you just need to take your time and read it a few times until the information sinks in. can someone guide how shd i proceed in understanding ext2 .. shd? Please avoid such langauge. You can understand ext2 by looking at the code and reading the documentation (UTLKr3 and that other paper on ext2 which I forget the name of - Design of the Ext2 Filesystem?). actually i want some place where i can get ext2 documented ...or some paper on it o any kind of help will be appreciated .. You could document it yourself. I'm documenting some userland software at work that I haven't written and it's amazing how good documenting something is at teaching you about the code/program. Rightly said. You need a little backgroud in block driver so read block drivers in ldd. ext2 is full fledged filesystem, understanding it may take huge time. Wirting a full filesystem may take _months__. If you look in archives of this mailing list, there are couple of people who have writtten smaller filesystems meant for specail purpose, look at them and the related document. Look at earlier versions of filesystems, say files system from Linux 1.0. Google around for sample file systems. Look for NNGFS and shfs. they may be of some help in understanding the basics. Thanks.
Re: can u tell me how to write socket in a kernel and connect through it?
i suggest you take a look at khttpd or tux On Sun, Jul 12, 2009 at 12:25 PM, krushnaal paikrisonea...@gmail.com wrote: can u tell me how to write socket programs in a kernel and connect through it? -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: kernel debugging in 30 minutes or less
I was able to show how to analyze an oops as follows: prepare an oops in mydriver.ko boot a kernel with debug info. ( prepare it before course ) objdump -Sl mymod.ko | less you will be able to show the exact line of crash. I presented to a few of my colleagues. fast and simple. analyzing an oops is more than essential. it is a must. Raz On Fri, Jul 10, 2009 at 3:37 AM, Leandro Dorileoldori...@gmail.com wrote: Hi Robert On Thu, Jul 9, 2009 at 11:19 AM, Robert P. J. Dayrpj...@crashcourse.ca wrote: On Thu, 9 Jul 2009, Mulyadi Santosa wrote: I think one of the core skills one should have is how to decode oops message. Other options that quickly cross my mind: 1. systemtap. 2. ftrace i might be able to throw in a few minutes on how to decode an oops, but i doubt i'd have time to get to systemtap or ftrace. i'm guessing that would be part of an entire advanced kernel course which would cover debugging in detail. 30 minutes is really not enough time but it would be really good to you at least tell systemtap and ftrace does exist, maybe show some output and scripts. regards -- (°= Leandro Dorileo //\ ldori...@gmail.com - http://www.dorilex.net V_/ Software is a matter of freedom. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Permission to use list.h and atomic.h in user space
On Tue, Jun 23, 2009 at 3:04 AM, Robert Hancockhancock...@gmail.com wrote: On 06/22/2009 07:44 AM, Raz wrote: Hello May I have permission to use atomic64.h ,atomic32.h and list.h in a proprietary software ? I do not know who the authors are. Thank you Raz You would likely have to basically track down everyone who has ever contributed to those files and get their permission, which seems unlikely. So the short answer is almost certainly no. thank you. With newer gcc there are atomic built-in functions which will likely do what you want for the atomic ops at least.. thank you again. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Permission to use list.h and atomic.h in user space
Hello May I have permission to use atomic64.h ,atomic32.h and list.h in a proprietary software ? I do not know who the authors are. Thank you Raz -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Question regarding spinlock
On Tue, 2009-05-19 at 00:49 +0700, Mulyadi Santosa wrote: On Tue, May 19, 2009 at 12:33 AM, Ole Loots o...@monochrom.net wrote: Hello to the list, I got a question about spinlocks. Here is some pseudo-code: my_external_int_handler(...) { spin_lock(my_lock); // do things... spin_unlock(my_lock); } my_ioctl_handler(ioctl_value) { switch(ioctl_value) { case xy: spin_lock_irqsave(my_lock, flags); // do stuff spin_unlock_irqsave(my_lock, flags); break; } } I just wan't to ensure that the interrupt is finished before I handle the IOCTL request, so that I'm not running into a race condition that would a affect an ring buffer. But what happens when an interrupt signal is triggered at the external interrupt pin, does spin_lock_irqsave que the interrupt? Or does it dismiss the interrupt? Does spinlock_irqsave mean I would miss an interrupt? If so, spinlock won't be the right thing to do... What I need is something like: while(interrupt_working){ sleep(); } How to do right? i think spinlock_irqsave means it disables the interrupt pins temporarily but not nullifying the queued interrupts. Once it is enabled again, it would fire the handler again. However, IIRC too, spin_lock_irqsave is disabling per CPU interrupt line. So if you run your code in SMP or multicore, there is a chance please fix me if i am wrong. what spinlock_irqsave does is: 1. saves current of local interrupts. 2. disables local interrupts 3. acquires a lock any other context tries to to access the protected data will spin. else, how would you protect the data in SMP ? of both interrupt and ioctl handlers try to access the data. Although it is expected, perhaps you could consider using per CPU data ? regards, Mulyadi. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: TCP kernel server
you have to aware to the difficulties in implementing a descent server in kernel space before diving into such depth. why do you want to do it kernel ? On Wed, Mar 18, 2009 at 1:18 PM, Razvan Deaconescu raz...@anaconda.cs.pub.ro wrote: On Wed, 2009-03-18 at 11:20 +0200, Mark Ryden wrote: Hello, Is it possible to write a Linux Kernel module implementing TCP kernel server ? I saw a Simple UDP Server in: http://kernelnewbies.org/Simple_UDP_Server But I cannot find links to TCP kernel server. Any help will be appreciated. Check out TUX[1] or kHTTPd[2]. Razvan [1] http://www.stllinux.org/meeting_notes/2001/0719/tux/index.html [2] http://www.fenrus.demon.nl/ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: timeout of 10 usecs
you can try and use hpet directly. 10MHZ is the minimum by spec. On Mon, Mar 16, 2009 at 2:07 PM, Denis Borisevich dennis...@gmail.com wrote: 2009/3/16 Matthias Kaehlcke matth...@kaehlcke.net: El Mon, Mar 16, 2009 at 01:03:35PM +0300 Denis Borisevich ha dit: 2009/3/16 Razvan Deaconescu raz...@anaconda.cs.pub.ro: On Mon, 2009-03-16 at 00:41 +0300, Denis Borisevich wrote: Hi! Is there any way to achieve a timeout of say 10 usecs in kernel module? See udelay[1]. Please note that it does busy-waiting (you can't block/put to sleep the current process for periods less than 1000/HZ milliseconds). Razvan [1] http://lxr.linux.no/linux+v2.6.28.7/arch/x86/include/asm/delay.h#20 Hmm..busy-wait is not good for my situation. Is there any way to achieve these little timeouts with RT_PREEMPT patch? user space processes can use nanosleep() for sleeping for short times, though the kernel only guarantees that the process will sleep *at least* the specified time. the implementation of nanosleep() uses hrtimer_nanosleep() to achieve this, maybe you could try something similar: http://lxr.linux.no/linux+v2.6.28/kernel/hrtimer.c#L1632 10 usecs is a very short time for sleeping, i'm not sure if the kernel can provide this granularity. probably your task needs to have rt priority to be re-scheduled after such a short period. ftrace (Documentation/ftrace.txt) can be useful to determine whether the real sleep time is near to the period you pretend. -- Matthias Kaehlcke Embedded Linux Engineer Barcelona Someone has said that it requires less mental effort to condemn than to think (Emma Goldman) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- In our project we use rt-enabled kernel. And the application's main working loop is about 2ms that's why I need such little timeouts in my driver. Thank you for your help. I will look at hr-timers usage. -- Denis -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Wait for two clock ticks
Make sure your processor will not hang to long, a processor must walk through a quiesce state after some time else you will get RCU starvation. On Sun, Mar 8, 2009 at 9:50 PM, Asim linka...@gmail.com wrote: Thanks guys. The msleep solution looks good, but if my device does its work in 1 micro or nano second then it seems a tad too long to sleep. Here is what I ended up using - { . unsigned long long delta = (cpu/khz/HZ)*2; unsigned long long _start = 0; unsigned long long _cur = 0; . timeout = rdstcll(start) + delta ; while (1) { if (_cur timeout) { rdstcll(_cur); } else { flag_error() } } -Asim On 3/7/09, Greg KH g...@kroah.com wrote: On Fri, Mar 06, 2009 at 12:17:37PM -0600, Asim wrote: I need it for a device. The device performs some operation in a loop but I cannot wait in that loop forever, so I need to wait for the maximum time I can (2 clock ticks) before giving up on the device. Interrupts may be disabled so I cannot use jiffies. Any simple solution would be appreciated. Do what is done in lots of places in the kernel, something like the following from drivers/usb/host/pci-quirks.c: /* if boot firmware now owns EHCI, spin till * it hands it over. */ msec = 1000; while ((cap EHCI_USBLEGSUP_BIOS) (msec 0)) { tried_handoff = 1; msleep(10); msec -= 10; pci_read_config_dword(pdev, offset, cap); } Don't think in clock ticks but rather in real units of time, like portions of seconds. That way your code will work properly when a clock tick changes over time, becoming faster or slower, as they always do. Hope this helps, greg k-h -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Wait for two clock ticks
I implemented a timer that can operate without interrupts. but it relies on smp or smt. what do you need it for ? On Fri, Mar 6, 2009 at 5:08 PM, Greg Freemyer greg.freem...@gmail.com wrote: On Fri, Mar 6, 2009 at 9:59 AM, Asim linka...@gmail.com wrote: Yes - Actually I need to wait for a device to finish something after which I(device) error out. Ideally, I would like a simple function using the standard apis that works on most kernels. I cannot use jiffies as I mentioned earlier. Still working on it. -Asim In general the idea of waiting 2 whole ticks with interrupts disabled is such a bad idea that I don't think you will find a pre-existing API to do that. You definitely will not be able to simply check a variable because with interrupts disabled, their is no one to update the variable. If you really need this, you will likely need a call into a routine the gets the current time from a hardware clock. IMHO, such misbehaving code will never get into mainline and is not even a good learning experience. Greg -- Greg Freemyer Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence Technology http://www.norcrossgroup.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Wait for two clock ticks
On Fri, Mar 6, 2009 at 8:17 PM, Asim linka...@gmail.com wrote: I need it for a device. The device performs some operation in a loop but I cannot wait in that loop forever, so I need to wait for the maximum time I can (2 clock ticks) before giving up on the device. Interrupts may be disabled so I cannot use jiffies. Any simple solution would be appreciated. so why not use getnstimeofday ? Regards, Asim On 3/6/09, Raz razi...@gmail.com wrote: I implemented a timer that can operate without interrupts. but it relies on smp or smt. what do you need it for ? On Fri, Mar 6, 2009 at 5:08 PM, Greg Freemyer greg.freem...@gmail.com wrote: On Fri, Mar 6, 2009 at 9:59 AM, Asim linka...@gmail.com wrote: Yes - Actually I need to wait for a device to finish something after which I(device) error out. Ideally, I would like a simple function using the standard apis that works on most kernels. I cannot use jiffies as I mentioned earlier. Still working on it. -Asim In general the idea of waiting 2 whole ticks with interrupts disabled is such a bad idea that I don't think you will find a pre-existing API to do that. You definitely will not be able to simply check a variable because with interrupts disabled, their is no one to update the variable. If you really need this, you will likely need a call into a routine the gets the current time from a hardware clock. IMHO, such misbehaving code will never get into mainline and is not even a good learning experience. Greg -- Greg Freemyer Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence Technology http://www.norcrossgroup.com -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Who originated the SI ?
I am having a storm of softirqs every few seconds. How can I tell which tasklet/softirq is responsible for a burst of SI in top ? raz -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to ecar...@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Linux and the L1/L2 caches
These is an excellent atricle What every programmer should about memory of Erlich dreeper. you will see what happens when you exceed L2,L1... On Wed, Oct 22, 2008 at 1:54 PM, Rene Herman [EMAIL PROTECTED] wrote: On 22-10-08 11:25, Ray Kinsella wrote: I have a process that fork's itself into 10 sub-processes, all of which are very active, CPU usage is about 85%. The system I am using has a very small L1/L2 cache that is being trashed by the processes's working set moving in and out of cache. I am worried about cache line conflicts. Is there anyway to instruct the Linux virtual memory manager to spread these processes out over physical memory so as to reduce cache line conflicts ? Well, do please allow for a possibly more directly informed reply but the definition of process here would seem to make the answer a simple no regardless. What you are referring to in general is cache colouring; something which the older Linux SLAB allocator supports and the newer SLUB and SLOB allocators do not. An inquiry as to why a while ago got answered as: http://kerneltrap.org/mailarchive/linux-kernel/2008/8/4/2815224 which makes sense. So what's your cache organization? On something very associative in the first place cache colouring ofcourse doesn't bring you much. But, regardless, with the definition here of process as working set colouring seems rather unmanageable anyway. From a narrow kernel viewpoint a process could be sort of defined as its task_struct and colouring that one was in fact one of the original uses of the colouring feature (the task_struct used to be 8K aligned at stack bottom which makes for certainly non-optimized cache behaviour; 2.5 moving them of the stack then allowed for colouring) but as a kernel, you don't allocate a working set as an identifiable unit; it just sits around at whatever offset the compiler decided to put it at. Same thing holds for dynamic allocations sort of; malloc(n) is a library interface that doesn't (for small n) translate directly into a syscall. So, well, just no it seems. And, perhaps other than in the context of micro-optimizing a long-running calculations on a clumsy direct mapped cache, I do believe you shouldn't really worry about it. Rene. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
Re: any one knows how to truncate a file from its begining ?
no. I mean i want to remove a portion of the file : if a file is composed of : a,b,c,d blocks. I want to be able to remove from the **disk** block c or block a. ftruncate remove the end. On Wed, Oct 22, 2008 at 7:24 PM, Manish Katiyar [EMAIL PROTECTED] wrote: On Wed, Oct 22, 2008 at 10:42 PM, Raz [EMAIL PROTECTED] wrote: or a file system that can do it ? What does that mean ??? just doing $ filename on command line will truncate itor probably man ftruncate can help you. Thanks - Manish thank you raz -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
Re: any one knows how to truncate a file from its begining ?
I think XFS can do it . it has some un/reserve space ioctl. 3521/* 3522 * XFS_IOC_RESVSP and XFS_IOC_UNRESVSP will reserve or unreserve 3523 * file space. 3524 * These calls do NOT zero the data space allocated to the file, 3525 * nor do they change the file size. 3526 * 3527 * XFS_IOC_ALLOCSP and XFS_IOC_FREESP will allocate and free file 3528 * space. 3529 * These calls cause the new file data to be zeroed and the file 3530 * size to be changed. 3531 */ On Wed, Oct 22, 2008 at 8:07 PM, Karl Tatgenhorst [EMAIL PROTECTED] wrote: if it is a binary file, use dd and figure out the offset to start from (man dd will help). If it is a text file just use some perl like this: #open your file here $count=0; $start_removing= 100; ###starting at 100 $stop_removing= 300; ###end of block to remove whileFILE { $count++; if(100 $count 300) { next; } print $_ } both methods create a copy of the file and you can just copy your file over it. good luck On Wed, Oct 22, 2008 at 12:31 PM, Raz [EMAIL PROTECTED] wrote: no. I mean i want to remove a portion of the file : if a file is composed of : a,b,c,d blocks. I want to be able to remove from the **disk** block c or block a. ftruncate remove the end. On Wed, Oct 22, 2008 at 7:24 PM, Manish Katiyar [EMAIL PROTECTED] wrote: On Wed, Oct 22, 2008 at 10:42 PM, Raz [EMAIL PROTECTED] wrote: or a file system that can do it ? What does that mean ??? just doing $ filename on command line will truncate itor probably man ftruncate can help you. Thanks - Manish thank you raz -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
Re: What are the different timer that exists in the kernel?
The bellow is a list of Linux timers listed in Bovet's[1] Book. 2.1 PIT - programmable interval timer PIT is Linux default scheduler timer. Its frequency is 1KHZ at best. 2.2 TSC - Time Stamp counter All x86 processors include a CLK processor input pin. The processor has a timer which increases at each clock signal. This clock timer is read by rdtscl assembly command. With 2GHZ the time stamp counter will increment every 500 picoseconds. 2.3 RTC - Real time clock Real time clock (RTC) frequency is up to 8 KHz and accuracy is quite good. RTC is running on battery and is independent from the PC power. 2.4 HPET - High Precision Event timer High Precision Event timer is a new timer developed by Intel and Microsoft. It is a chip containing several 64bit or 32bit timer. Each timer frequency is at least 10Mhz. It raises a hardware interrupt every 100ns. 2.5 CPU Local Timer The Local APIC is in present x86 microprocessors. It is based on the bus clock signal. 2.6 PM - ACPI power management ACPI (Advanced configuration power interface) is resident in almost all ACPI-based motherboards. This is a simple counter with frequency 3.58 MHz. It does not generate any interrupts but accesses able through an I/O port. On Sat, Sep 20, 2008 at 1:28 PM, Sitsofe Wheeler [EMAIL PROTECTED] wrote: Peter Teoh wrote: Q1: the assembly instruction: rdtsc will always get its clocking from PIT right? I doubt it. I believe on x86 RDTSC just reads a bunch of registers updated by the CPU when it ticks. It's not really a separate programmable piece of hardware. Q2: the remark for select_clocksource() said it will select the best, but the function is a loopless, deterministic function that just return value from a linked list. Hm.cannot understand it usage... You might want to trace execution from clocksource_register (and the functions that end up being called from it) in that case to see HOW the list is built. -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
Re: Why each c text file I take from the kernel source tree is not indented ?
On Tue, Sep 9, 2008 at 6:43 PM, Michael Blizek [EMAIL PROTECTED] wrote: Hi! On 09:50 Tue 09 Sep , Raz wrote: How a newbie like me is supposed not to break any coding style rule ? I use vim, not emacs . Do you have a vim configuration file for guys like me ? I truly hope I am not pissing off a kernel subsystem maintainer Does scripts/checkpatch.pl help? yes thank you -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com -- Raz -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
Re: About sending signals from kernel space to user space
tasklets/softirqs and evolution from bottom half. i suggest you read Robert Love excellent book, chapter 6. On Wed, Sep 3, 2008 at 1:01 AM, Om [EMAIL PROTECTED] wrote: Raz wrote: i would suggest you schedule a tasklet. doing staff like from ISR , from my opinion is too risky and bug prone. Did you mean work queue? Tasklets run in interrupt context too.. About sending signals from kernel space to user space mayank rana Mon, 01 Sep 2008 07:28:33 -0700 Hi All, I am trying to send some information to User Space process from Kernel Module/Driver. How can I do that in context of interrupt Service Routine? I found that using kill_async, it is possible to send SIGIO signal and handling that in User . Is there anyother way to achieve this ? -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ -- Raz -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
RE: About sending signals from kernel space to user space
i would suggest you schedule a tasklet. doing staff like from ISR , from my opinion is too risky and bug prone. About sending signals from kernel space to user space mayank rana Mon, 01 Sep 2008 07:28:33 -0700 Hi All, I am trying to send some information to User Space process from Kernel Module/Driver. How can I do that in context of interrupt Service Routine? I found that using kill_async, it is possible to send SIGIO signal and handling that in User . Is there anyother way to achieve this ? -- Raz -- To unsubscribe from this list: send an email with unsubscribe kernelnewbies to [EMAIL PROTECTED] Please read the FAQ at http://kernelnewbies.org/FAQ
service oriented scheduler
hello I will be greatful for any criticism. In short, i offload a processor and assign it a service. raz x Service Oriented Scheduler MSC Concluding Assignment Table of Content 1. Document Content ..3 2. Background 3 3. Purpose4 4. Importance.4 5. Description5 5.1 Processor Offload Architecture..5 6. Acknowledgements...6 7. Appendix. 7.1 hotplug patch 7.2 SOS frame work 7.2 timer code 7. Bibliography ...6 1. Document Content This document is a proposal of my concluding assignment to the MSC. 2. Background In today's computer world, we find that most processors have several embedded cores, virtualization and hyper-threading. Most programmers do not really use these powerful features and let the operating system do the work. At most, a programmer will bound an application to a certain processor or assign an interrupt to a different processor. At the end, we get system busy in maintaining tasks across processors, balancing interrupts, replacing TLBs and DTLBs, and worst of all, spin locks across processors in vein. I argue that in some cases, part of this behavior is due to fact the multipled core operating system is not service oriented but system oriented. There is no easy way to assign a processor to do a distinct service, undisturbed, accurate, and fast as long as the processor is an active part of an operating system. 3. Purpose The purpose of this assignment is to create a platform for services. For example, assume a firewall is being attacked; the Linux operating system will generate endless number of interrupts and softirqs to analyze the traffic and throw out bad packets. This is on the expense of good packets. Have you ever tried to ssh to an attacked machine? What if we can simply do the packet analysis outside the operating system, without interrupts and still fast enough? Why not assign a core to do only firewalling? Or just routing? Maybe assign it as an ultra accurate timer? Since a well defined set of schedulers will available for receiving packets, or serving timers, the OS will not be bothered. Technologically speaking, I am referring to the Linux kernel ability to virtually hot plug a (SMT) processor but instead of letting it wonder in endless halts, assign it a service. 4. Importance PROS Money First, it saves money. Why buy expensive offloading cards when you can do with commodity hardware? Resources SOS can be assigned to use somewhat esoteric system resources (SMT and VT) available in the processor to do some non esoteric tasks. Accuracy A programmer may rely on the fact that only his code will be run, without disturbance (offloaded core runs in NMI mode). Security SOS is designed to assign service to a single resource. This makes the load be contained inside SOS. Example for that is a firewall contained inside a single core. RAS Remote Access Services: SOS can be used as remote access server (such as a simple telnet server) inside the machine but outside the kernel. This can be useful incases for getting operating statistics and monitoring an offended system. Speed-Up [4] Amdhal Law for liner processors speedup is truly achievable. CONS SOS cannot run user space processes. SOS cannot release memory nor allocate one. SOS does not perform context switch. SOS has a single context. SOS does support [1] IPMI, so SOS cannot use vmalloc'd memory. This is quite a problem since drivers are vmalloc'd. 5. Description This assignment is practical, not theoretical. I will supply a set of patches, a driver and configuration tool. I will write it for the Linux kernel and then I will provide some benchmarks comparing the current technology versus the service oriented technology. My hypothesis is that in some cases, it is best to use SOS scheduler. SOS scheduler uses SMP, SMT and if possible over VT. 5.1 Processor Offload Architecture image here 6. Acknowledgements Jeff Roberson, who came with this idea of offloading a whole core, and showed me that it is possible. 7. Appendix. 7.1 hotplug patch diff -X dontdiff -urN kernel-centos/arch/i386/kernel/process.c linux-2.6.18.x86_64-bitband/arch/i386/kernel/process.c --- kernel-centos/arch/i386/kernel/process.c2007-10-25 17:28:52.0 +0200 +++ linux-2.6.18.x86_64-bitband/arch/i386/kernel/process.c 2007-10-11 10:00:49.0 +0200 @@ -138,6 +138,9 @@ } #ifdef CONFIG_HOTPLUG_CPU +void (*hotplug_cpu_dead)(void); +EXPORT_SYMBOL(hotplug_cpu_dead); + #include asm/nmi.h /* We don't actually take CPU down, just spin without interrupts. */ static inline void play_dead(void) @@ -153,6 +156,8 @@ * With physical CPU hotplug, we should halt the cpu */ local_irq_disable