Re: Regarding GDT
Hi, Il 29/09/2010 19.28, Sri Ram Vemulpali wrote: Hi All, I have a doubt regarding implementation of segmentation in OS. Since GDT is used to implement the segmentation, in that table you add all segments descriptors dividing the linear address space. In a flat model you assign for every descriptor the base as 0x0 and limit as 4GB. This way every DS,CS sees the complete 4GB memory. But how is the segment protection implemented. I mean if segments are not divided with different base address and limit preventing overlapping, there is a possibility of stepping in to other segment. So, why is the flat model is implemented. Linux (in x86) uses 4 main segments in GDT: user code, user data, kernel code and kernel data. Actually there are more segments (TSS, LDT, some to manage APM, some to manage PnP, and others) but for your question suffice to say that the main difference between user segments and kernel segments is the DPL (privilege) field. This is 3 for both user segments and 0 for both kernel segments. That is: - when the CPU is running at the CPL==3 (Current Privileged Mode, 3 is the lowest, this is when running in user space) it can access only segments with DPL==3 - when the CPU is running at the CPL==0 (0 is the highest, this is when running in kernel space) it can access all segments. Also, If I strictly implement segmentation without paging, then I can have only 8192 segments of size 64kb for whole 4GB address space. Then I have all the segment descriptors in the GDT. Now if some task uses all its complete segment size, and needs some more space, then is it possible to assign another DS segment. If so, how is that accomplished, since we need to load in DS new index of segment descriptor and keep track of all indexes in to GDT. Can anyone explain how above mentioned things can be achieved. CMIIW but that is not completely true. If you implement segmentation without paging (in protected mode), you can access 8192 segments of 4GB. So you have to rethink all further assumptions. regards Luca -- 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: Regarding GDT
2010/9/30 Sri Ram Vemulpali sri.ram.gm...@gmail.com: Hi All, I have a doubt regarding implementation of segmentation in OS. Since GDT is used to implement the segmentation, in that table you add all segments descriptors dividing the linear address space. In a flat model you assign for every descriptor the base as 0x0 and limit as 4GB. This way every DS,CS sees the complete 4GB memory. But how is the segment protection implemented. I mean if segments are not divided with different base address and limit preventing overlapping, there is a possibility of stepping in to other segment. So, why is the flat model is implemented. Also, If I strictly implement If base on x86 architecture, suggest to read intel or AMD 's cpu manual. Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3A: System Programming Guide, Part 1 3.1 MEMORY MANAGEMENT OVERVIEW If paging is not used, the linear address space of the processor is mapped directly into the physical address space of processor. The physical address space is defined as the range of addresses that the processor can generate on its address bus. Because multitasking computing systems commonly define a linear address space much larger than it is economically feasible to contain all at once in physical memory, some method of “virtualizing” the linear address space is needed. This virtualization of the linear address space is handled through the processor’s paging mechanism. Paging supports a “virtual memory” environment where a large linear address space is simulated with a small amount of physical memory (RAM and ROM) and some diskstorage. When using paging, each segment is divided into pages (typically 4 KBytes each in size), which are stored either in physical memory or on the disk. The operating system or executive maintains a page directory and a set of page tables to keep track of the pages. When a program (or task) attempts to access an address location in the linear address space, the processor uses the page directory and page tables to translate the linear address into a physical address and then performs the requested operation (read or write) on the memory location. Some embedded system is not using paging mechanism, because they need real-time response time and reduce task jitter. So need programmers implement the task smaller than the limitation. Got some information for variable-length segments in internet as below. Some systems, such as Burroughs B5500,do not use paging to implement virtual memory. Instead, they use segmentation, that divide virtual address spaces into variable-length segments. A virtual address consists of a segment number and an offset within the segment. segmentation without paging, then I can have only 8192 segments of size 64kb for whole 4GB address space. Then I have all the segment descriptors in the GDT. Now if some task uses all its complete segment size, and needs some more space, then is it possible to assign another DS segment. If so, how is that accomplished, since we need to load in DS new index of segment descriptor and keep track of all indexes in to GDT. Can anyone explain how above mentioned things can be achieved. -- Regards, Sri. -- 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 -- Best Regards Lin -- 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
open file related system calls
hi all, if my system is shared among several root users . and one of my (say root user S5) process opens a file . is there any system call or any kernel function that can be used by root user S2 to trace my opened file? please reply, guys
alloc_bootmem_low
Hi all, I'm trying to understand the use of alloc_bootmem_low. As my understanding, it tries to allocate memory at boot time in the DMA zone (under 16 MB on x86). My question is, how can I be sure it _really_ allocates under 16MB? I've read the file mm/bootmem.c and I didn't find any reference to 16MB DMA. The only difference between alloc_bootmem and alloc_bootmem_low is the starting point from which they try to find memory: 0 for alloc_bootmem and 16MB for alloc_bootmem_low. But what I would aspect is that alloc_bootmem_low has a limit of 16MB which it seems not to have (you can check this in alloc_bootmem_core, which both eventually call). I've found a reference to this problem in an old patch here: http://lwn.net/Articles/146990/ but in recent kernels I can't see this kind of code anywhere. Any hints? NOTE: I know that from kernel 2.6.34 there is a lot of work in progress to eliminate bootmem code and substitute it with early_res but suppose for the moment that we didn't specify the config option NO_BOOTMEM. Regards Luca Ellero -- 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: open file related system calls
On Thu, Sep 30, 2010 at 19:50, mohit verma mohit89m...@gmail.com wrote: hi all, if my system is shared among several root users What are root users? -- 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: open file related system calls
On Thu, Sep 30, 2010 at 19:50, mohit verma mohit89m...@gmail.com wrote: hi all, if my system is shared among several root users . and one of my (say root user S5) process opens a file . is there any system call or any kernel function that can be used by root user S2 to trace my opened file? uhm, strace? please reply, guys I don't know if it hurts you or not...but no need to beg like baby Grow up -- 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: open file related system calls
On Thu, Sep 30, 2010 at 5:50 AM, mohit verma mohit89m...@gmail.com wrote: hi all, if my system is shared among several root users . and one of my (say root user S5) process opens a file . is there any system call or any kernel function that can be used by root user S2 to trace my opened file? Question is not clear (atleast to me)... what are root users ? (uid == 0 ?). When you say shared do you mean root logged in from different sessions ? What does tracing an opened file mean ? please reply, guys -- Thanks - Manish == [$\*.^ -- I miss being one of them == -- 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: open file related system calls
On Thu, Sep 30, 2010 at 8:50 AM, mohit verma mohit89m...@gmail.com wrote: hi all, if my system is shared among several root users . and one of my (say root user S5) process opens a file . is there any system call or any kernel function that can be used by root user S2 to trace my opened file? Do not give user root access use something like sudo for privilege escalation and it will log which user did what. Or maybe you are looking for something like inotify. I would google those two terms and who should do what you appear to be doing. -- John -- 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: checkpatch.pl/get_maintainer.pl -- Interesting thread / discussion for newbies
On Mon, Sep 27, 2010 at 4:06 PM, Greg Freemyer greg.freem...@gmail.comwrote All, The last couple of days on the ext4 list there has been some discussion of ./scripts/checkpatch.pl and ./scripts/get_maintainer.pl. It looks like a simple whitespace patch is going to be rejected. (surpise!) If you haven't seen it, I think it is worth a read. Especially if you're a newbie. (As I assume the originator of the thread was.) Thanks for this, Greg - much appreciated. This really was interesting to follow. I thought the following comment from Ted Ts'o summed the discussion up nicely: If it's used by newbies who want to get warned about obvious things, that's fine. If it's used by maintainers as an automated way to catch nits, that's also fine. Maintainers are experts who know when it's OK to disregard flase positives. What really annoys me is newbies who use checkpatch.pl in its --file mode,and then assume that every single warning is a deadly bug that much be patched.Scripts by definitions are stupid, and don't substitute for thinking. checkpatch.pl at least as the excuse that it has some valid non-stupid uses. But I'm not convinced get_maintainers.pl has the same excuse. I at least never use it. I'll look through the MAINTAINERS file by hand, or I'll use git log by hand, and let my human intelligence figure out whether or not the patches that are turned up constitute those that do real work, or are bullshit checkpatch.pl cleanup patches. Training people to use a script that by defintion can't be smart enough to make these distinction ultimately is a huge disservice to newbies (and experts won't use get_maintinaer.pl anyway, because they will want to know the context). I'm following the drivers mailing list trying to get a feel for protocol at the moment and one of the things that really surprised me was that there were patches being sent for pure code tidy-up re-formats (i.e. not as part of actually fixing bugs, optimizing code etc.). I had previously read Jon Corbet's 'How to Participate in the Linux Community - a Guide to the Development Process' where he made the following point: Developers may start to generate reformatting patches as a way of gaining familiarity with the process, or as a way of getting their name into the kernel changelogs – or both. But pure coding style fixes are seen as noise by the development community; they tend to get a chilly reception. So this type of patch is best avoided. It is natural to fix the style of a piece of code while working on it for other reasons, but coding style changes should not be made for their own sake. The ext4 list discussion seems to indicate that this is still good advice for would-be contributors to follow... :-) (I'm also impressed by the patience and diplomatic attitudes of maintainers like Greg KH and Ted Ts'o who presumably must keep getting sent stuff like this. :-) ) Thanks, Julie
Reducing the physical memory for the allocator
Dear All, I am trying to experiment the following. * I have a 1 GB of RAM and running Linux 2.6.34 on a Intel Machine. * I want memory allocator to get only 768 MB of RAM. * The rest 256 MB of RAM, Kernel should see it has IO memory Is there any option that I can pass to the kernel so that it only takes 768 MB of RAM. Request you to help me in this regard. Thanks, Prabhu
Re: Reducing the physical memory for the allocator
Hi Prabhu, On Thu, Sep 30, 2010 at 11:29 PM, Prabhu nath gprabhun...@gmail.com wrote: Dear All, I am trying to experiment the following. * I have a 1 GB of RAM and running Linux 2.6.34 on a Intel Machine. * I want memory allocator to get only 768 MB of RAM. * The rest 256 MB of RAM, Kernel should see it has IO memory Is there any option that I can pass to the kernel so that it only takes 768 MB of RAM. I believe that you can pass mem=768M on the command line -- Dave Hylands Shuswap, BC, Canada http://www.DaveHylands.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
kmap and page
Hi I am new to this forum. I have specific quesion on kmap and page. I would like to know how these two are related to eachother. Thanks in advance.