<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 22, 2016 at 8:06 PM, <span dir="ltr"><<a href="mailto:kernelnewbies-request@kernelnewbies.org" target="_blank">kernelnewbies-request@kernelnewbies.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Kernelnewbies mailing list submissions to<br>
<a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:kernelnewbies-request@kernelnewbies.org" target="_blank">kernelnewbies-request@kernelnewbies.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:kernelnewbies-owner@kernelnewbies.org" target="_blank">kernelnewbies-owner@kernelnewbies.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Kernelnewbies digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: Is it possible to turn off the gcc optimization when<br>
compiling kernel? (Hao Lee)<br>
2. Re: kernel_thread() causes segfault (Shashank Khasare)<br>
3. Re: Is it possible to turn off the gcc optimization when<br>
compiling kernel? (Nicholas Mc Guire)<br>
4. Re: How to get object virtual address from a kernel core dump<br>
(Arun Sudhilal)<br>
5. Re: Is it possible to turn off the gcc optimization when<br>
compiling kernel? (Hao Lee)<br>
6. Re: kernel_thread() causes segfault (Manoj Nayak)<br>
7. Re :Querry Regarding Memory Alignment (Manoj Nayak)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 22 Mar 2016 19:24:38 +0800<br>
From: Hao Lee <<a href="mailto:haolee.swjtu@gmail.com" target="_blank">haolee.swjtu@gmail.com</a>><br>
Subject: Re: Is it possible to turn off the gcc optimization when<br>
compiling kernel?<br>
To: <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Cc: Nicholas Mc Guire <<a href="mailto:der.herr@hofr.at" target="_blank">der.herr@hofr.at</a>><br>
Message-ID:<br>
<CA+PpKPm=<a href="mailto:eHxK5oj39r8nrT6XGA4qo6XKMNRcgcNCNdGQW_SPvw@mail.gmail.com" target="_blank">eHxK5oj39r8nrT6XGA4qo6XKMNRcgcNCNdGQW_SPvw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=UTF-8<br>
<br>
On Mon, Mar 21, 2016 at 5:51 PM, Nicholas Mc Guire <<a href="mailto:der.herr@hofr.at" target="_blank">der.herr@hofr.at</a>> wrote:<br>
> You can not turn it off in all functions as some need particluar<br>
> optimization flags to comile at all, but you can pass<br>
> individual CFLAGS per file via the Makefile<br>
><br>
> CFLAGS_target.o = -O0 or -flags-to-use<br>
><br>
> aswell as remove specific CFLAGS with<br>
><br>
> CFLAGS_REMOVE_target.o = -flags-to-remove<br>
><br>
> but if you want to debug the kernel it is most likely not<br>
> a good idea to try and disable optimization as the code you then<br>
> are debugging might not have that much to do with the final code<br>
> once optimization is on again. So simply generate the .lst file<br>
> of the target you are trying to debug e.g. for kernel/sched/core.c:<br>
><br>
> make kernel/sched/core.lst<br>
><br>
> and then use that .lst file to understand the output of gdb you<br>
> are inspecting.<br>
<br>
Thanks for your reply!<br>
Besides,I also find that use "gcc -c -Q -O1 --help=optimizers" can<br>
print the exact set of optimizations.<br>
<br>
regards,<br>
Hao Lee<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 22 Mar 2016 16:51:44 +0530<br>
From: Shashank Khasare <<a href="mailto:sskkernelnewbie@gmail.com" target="_blank">sskkernelnewbie@gmail.com</a>><br>
Subject: Re: kernel_thread() causes segfault<br>
To: <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Message-ID:<br>
<<a href="mailto:CAGwMyOAxpQJjR9LRDLCp-ZLgHqKPcaLuJwDWyowBMsHHs5sjug@mail.gmail.com" target="_blank">CAGwMyOAxpQJjR9LRDLCp-ZLgHqKPcaLuJwDWyowBMsHHs5sjug@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
I am trying to implement ideas mentioned in the following OSDI paper:<br>
L. Soares and M. Stumm. FlexSC: flexible system call scheduling with<br>
exception-less system calls. In Proc. OSDI, 2010.<br>
<a href="http://www.cs.cmu.edu/~chensm/Big_Data_reading_group/papers/flexsc-osdi10.pdf" rel="noreferrer" target="_blank">http://www.cs.cmu.edu/~chensm/Big_Data_reading_group/papers/flexsc-osdi10.pdf</a><br>
<br>
The paper propose a new mechanism for applications to make syscall.<br>
The brief idea is to have two types of threads 1) User thread 2) Kernel<br>
Thread.<br>
These two threads share same address space, file descriptor tables, parent<br>
pid etc.<br>
Whenever user thread wants to make syscall, it would post the information<br>
about syscall number & arguments<br>
to syscall in common shared page. User thread would then wait till the<br>
results are posted on shared page.<br>
The kernel thread reads the syscall arguments from shared page and writes<br>
the results to shared page.<br>
User thread consumes the results and continues execution.<br>
Since the kernel thread and user thread can be scheduled on different cpu<br>
cores, and user thread is ideally never executing<br>
kernel code and vice versa, one can expect gain in instruction per cycle<br>
for application, since the cache pollution is reduced to<br>
some extent*.*<br>
<br>
So to implement this mechanism, it is important for the user and kernel<br>
thread to share address space, fd tables etc.<br>
kernel_thread() works fine with older kernels to achieve this task, but is<br>
no longer an option.<br>
<br>
Is there of any mechanism for sharing fd tables as well?<br>
Please let me know.<br>
<br>
Thanks a lot,<br>
Shashank<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/1bdf0577/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/1bdf0577/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Tue, 22 Mar 2016 11:35:16 +0000<br>
From: Nicholas Mc Guire <<a href="mailto:der.herr@hofr.at" target="_blank">der.herr@hofr.at</a>><br>
Subject: Re: Is it possible to turn off the gcc optimization when<br>
compiling kernel?<br>
To: Hao Lee <<a href="mailto:haolee.swjtu@gmail.com" target="_blank">haolee.swjtu@gmail.com</a>><br>
Cc: <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Message-ID: <<a href="mailto:20160322113516.GA11898@osadl.at" target="_blank">20160322113516.GA11898@osadl.at</a>><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
On Tue, Mar 22, 2016 at 07:24:38PM +0800, Hao Lee wrote:<br>
> On Mon, Mar 21, 2016 at 5:51 PM, Nicholas Mc Guire <<a href="mailto:der.herr@hofr.at" target="_blank">der.herr@hofr.at</a>> wrote:<br>
> > You can not turn it off in all functions as some need particluar<br>
> > optimization flags to comile at all, but you can pass<br>
> > individual CFLAGS per file via the Makefile<br>
> ><br>
> > CFLAGS_target.o = -O0 or -flags-to-use<br>
> ><br>
> > aswell as remove specific CFLAGS with<br>
> ><br>
> > CFLAGS_REMOVE_target.o = -flags-to-remove<br>
> ><br>
> > but if you want to debug the kernel it is most likely not<br>
> > a good idea to try and disable optimization as the code you then<br>
> > are debugging might not have that much to do with the final code<br>
> > once optimization is on again. So simply generate the .lst file<br>
> > of the target you are trying to debug e.g. for kernel/sched/core.c:<br>
> ><br>
> > make kernel/sched/core.lst<br>
> ><br>
> > and then use that .lst file to understand the output of gdb you<br>
> > are inspecting.<br>
><br>
> Thanks for your reply!<br>
> Besides,I also find that use "gcc -c -Q -O1 --help=optimizers" can<br>
> print the exact set of optimizations.<br>
><br>
yes - but for any given code you will find that many of those<br>
options actually have no effect for the particular code blob.<br>
The set of flags effectively impacting the generated object<br>
file is generally much smaller than the ones reported by<br>
gcc -c -Q -O1 --help=optimizers.<br>
<br>
thx!<br>
hofrat<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Tue, 22 Mar 2016 17:09:08 +0530<br>
From: Arun Sudhilal <<a href="mailto:getarunks@gmail.com" target="_blank">getarunks@gmail.com</a>><br>
Subject: Re: How to get object virtual address from a kernel core dump<br>
To: "Mohammad Y. Zachariah" <<a href="mailto:eng.myz@gmail.com" target="_blank">eng.myz@gmail.com</a>><br>
Cc: Kernel Newbies <<a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a>><br>
Message-ID:<br>
<<a href="mailto:CABOM9ZrcecujZBfyLXSK8SXPFmkZGWRNH6Y-ZnuxQEZJVHJ15Q@mail.gmail.com" target="_blank">CABOM9ZrcecujZBfyLXSK8SXPFmkZGWRNH6Y-ZnuxQEZJVHJ15Q@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello Zach,<br>
<br>
On Fri, Mar 18, 2016 at 3:28 PM, Mohammad Y. Zachariah <<a href="mailto:eng.myz@gmail.com" target="_blank">eng.myz@gmail.com</a>><br>
wrote:<br>
<br>
> Hello everyone,<br>
><br>
> I'm taking the way of analysing kernel core dumps as a learning approach<br>
> using 'crash tool'. One of the interesting crash commands is 'struct' which<br>
> can print kernel struct definition and/or the actual contents of the<br>
> structure.<br>
><br>
> According to struct help page, I need the virtual address of the struct in<br>
> order to view/print its contents, for example:<br>
><br>
> crash> mm_struct.pgd ffff810022e7d080 -px<br>
> pgd_t *pgd = 0xffff81000e3ac000<br>
> -> {<br>
> pgd = 0x2c0a6067<br>
> }<br>
><br>
> My question is how to find the mm_struct address "ffff810022e7d080" in the<br>
> above example in the first place??<br>
><br>
<br>
crash tool has a 'ps' command, which outputs all the task and their task<br>
struct address.<br>
<br>
Thanks,<br>
Arun<br>
<br>
><br>
> Thank you for your help in advance.<br>
> Zach<br>
><br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/676f2c2d/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/676f2c2d/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Tue, 22 Mar 2016 19:46:23 +0800<br>
From: Hao Lee <<a href="mailto:haolee.swjtu@gmail.com" target="_blank">haolee.swjtu@gmail.com</a>><br>
Subject: Re: Is it possible to turn off the gcc optimization when<br>
compiling kernel?<br>
To: Nicholas Mc Guire <<a href="mailto:der.herr@hofr.at" target="_blank">der.herr@hofr.at</a>><br>
Cc: <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Message-ID:<br>
<<a href="mailto:CA%2BPpKPk4fEZqH7J9khjVoiduT3Sz%2BrBWpqpHBSk%2BBNVXLwF0eQ@mail.gmail.com" target="_blank">CA+PpKPk4fEZqH7J9khjVoiduT3Sz+rBWpqpHBSk+BNVXLwF0eQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=UTF-8<br>
<br>
On Tue, Mar 22, 2016 at 7:35 PM, Nicholas Mc Guire <<a href="mailto:der.herr@hofr.at" target="_blank">der.herr@hofr.at</a>> wrote:<br>
> yes - but for any given code you will find that many of those<br>
> options actually have no effect for the particular code blob.<br>
> The set of flags effectively impacting the generated object<br>
> file is generally much smaller than the ones reported by<br>
> gcc -c -Q -O1 --help=optimizers.<br>
><br>
> thx!<br>
> hofrat<br>
<br>
yeah,only several options take effect.<br>
Because "-O0" will break the link progress,I just want use "-O1" and<br>
some other options to approximate the effects of "-O0".<br>
<br>
regards,<br>
Hao Lee<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 6<br>
Date: Tue, 22 Mar 2016 19:15:48 +0530<br>
From: Manoj Nayak <<a href="mailto:manojnayak2005@gmail.com" target="_blank">manojnayak2005@gmail.com</a>><br>
Subject: Re: kernel_thread() causes segfault<br>
To: <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Message-ID:<br>
<CAOsfsFLeO5v5X5obrUeokq=WLdQO3O=<a href="mailto:PjmbfYAU4WB334CBddw@mail.gmail.com" target="_blank">PjmbfYAU4WB334CBddw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Process has files_struct and fs_struct in task_struct.<br>
<br>
Two thread's task_struct can point to same files_struct and fs_struct if<br>
we do the changes through a new system call.<br>
<br>
Please check the following URL.<br>
<br>
<a href="http://lxr.free-electrons.com/source/kernel/fork.c#L993" rel="noreferrer" target="_blank">http://lxr.free-electrons.com/source/kernel/fork.c#L993</a><br>
<br>
Regards<br>
Manoj Nayak<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/687ef0ce/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/687ef0ce/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
Message: 7<br>
Date: Tue, 22 Mar 2016 20:00:05 +0530<br>
From: Manoj Nayak <<a href="mailto:manojnayak2005@gmail.com" target="_blank">manojnayak2005@gmail.com</a>><br>
Subject: Re :Querry Regarding Memory Alignment<br>
To: <a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Message-ID:<br>
<<a href="mailto:CAOsfsFKdyWR6t6k7WKPwHEe_zRz9KwiUZvpJQCOCqRgOmvx39w@mail.gmail.com" target="_blank">CAOsfsFKdyWR6t6k7WKPwHEe_zRz9KwiUZvpJQCOCqRgOmvx39w@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
The CPU always reads at its word size (4 bytes on a 32-bit processor), so<br>
when you do an unaligned address access ? on a processor that supports it ?<br>
the processor is going to read multiple words. The CPU will read each word<br>
of memory that your requested address straddles. This causes multiple<br>
processor read to access the requested data.<br>
<br>
Hardware deals with word size alignment. Other alignment like page size<br>
alignment is a software feature.<br>
<br>
On X86: Any virtual address provided to cpu is split into page aligned<br>
virtual address and an offset.CPU uses page aligned virtual address to<br>
check TLB to get page aligned physical address.<br>
<br>
Now physical address = Page aligned physical address + offset<br>
<br>
If page size is bigger then less no of TLB entries are required for the<br>
processor. Each page needs one TLB entry.<br>
<br>
Regards<br>
Manoj Nayak<br></blockquote><div><br></div><div> Thanks Manoj for the reply <br></div><div> So that means aligned / unaligned virtual address -------- > aligned/unaligned phy address<br></div><div> and there is one to one analogy in this regard.<br> </div><div> <br></div><div> SW can actually generate addresses which could be unaligned and then CPU could fault with<br></div><div> memory alignment fault.<br></div><div> For example, if SW cast a "short" pointer to a "int" pointer and attempts to access the data<br></div><div> it leads to unaligned access. <br></div><div> Perhaps the Instruction decode unit of the CPU will see that it is word read at address which is not divisible by 4<br></div><div> and would instruct the control unit to trigger the alignment fault. <br></div><div><br></div><div><br><br> </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/56d79c72/attachment.html" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/56d79c72/attachment.html</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
<br>
End of Kernelnewbies Digest, Vol 64, Issue 37<br>
*********************************************<br>
</blockquote></div><br></div></div>