Re: Asking advice for graduate study

2011-01-28 Thread larry
Understanding Linux Network Internals

在 2011年1月26日 上午1:17,Alvin 写道:

> 2011/1/25 cheng chen 
>
> > Hi, all!
> > I am going to further my education in graduate school of Master of
> Science
> > degree. I am interested in network, but I am not sure what direction I
> > should choose and which professional books I should read. Therefore I ask
> > for help and suggestion from you.
> > In summary, I have both the fundamental knowledge about network
> programming
> > as well as communication theory. Therefore I prefer an area which has the
> > relationship with both the software and hardware (but with more attention
> > one
> >
> HW and SW-->Embedded system, and keep going, don't stop
>
> > software.) By the way, I am especially interested in how the whole
> network
> > system works, rather than how two single points communicate.
> > If you have any suggestion about what I could do next (areas, books,
> > whaever~),
> > please be kind to tell me. Thank you very much.
> >
> > --
> > Cheng(�\)
> >
> > Fedora Project Contributor -- Ambassador
> > https://fedoraproject.org/wiki/User:Freakrobot
> > ___
> >
> > My Page: http://freakrobot.blogbus.com/
> > ___
> > Linux 内核开发中文邮件列表
> > linux-ker...@zh-kernel.org
> > http://zh-kernel.org/mailman/listinfo/linux-kernel
> > Linux 内核开发中文社区: http://zh-kernel.org
>
>
>
>
> --
>
> ~Alvin
>  ___
> Linux 内核开发中文邮件列表
> linux-ker...@zh-kernel.org
> http://zh-kernel.org/mailman/listinfo/linux-kernel
> Linux 内核开发中文社区: http://zh-kernel.org
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


A question on the function clean_bdev_bh_alias

2018-08-10 Thread Larry
Hello list,
I'm confused with the function, could someone help??


Does it intend to remove existent pages in block device's page cache
if some new page cache of a vfs file was created whose block number
range has overlaps with its block device page cache?



Thanks in advance.


Best regards,
Larry___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: A question on the function clean_bdev_bh_alias

2018-08-11 Thread Larry
Really appreciate your help.


Thanks
Larry




-- Original --
From:  "valdis.kletnieks";
Date:  Sat, Aug 11, 2018 00:00 AM
To:  "Larry";
Cc:  "kernelnewbies"; 
Subject:  Re: A question on the function clean_bdev_bh_alias



On Fri, 10 Aug 2018 22:48:43 +0800, "Larry" said:

> Does it intend to remove existent pages in block device's page cache
> if some new page cache of a vfs file was created whose block number
> range has overlaps with its block device page cache?

That's a situation you *really* hope doesn't arise.

Consider if you have (for example) an ext4 filesystem on /dev/sda4 mounted on
/foobar.

For there to be page cache for the ext4 filesystem and also page cache for
the block device, that means that something is writing to a file on /foobar
while something else is writing directly to /dev/sda4.

That's a really good way to corrupt the filesystem (and is why it's a Really
Bad Idea to fsck a mounted filesystem).  And no, merely trimming cache
pages that overlap doesn't even come *close* to fixing the problem...___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Is there any way to show local var when using crash to analyse coredump?

2018-08-16 Thread Larry
Hi list,


When using gdb, we can use "frame" command to select which layer in the back 
trace to debug,
and then we can use "print" command to print local var within this layer.


But I found that these two commands does not work in crash tool, is there any 
way to solve it?




Thanks
Larry___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


a question on mapping from PTE to swap entry

2018-11-15 Thread Larry
Hi all,

It's quoted that "When a page is swapped out, Linux uses the correspondingPTE 
to store enough 
information to locate the page on disk again".

I'm curious when multiple process has the same PTE which points to the 
samepage, 
how can kernel differenciate which page from swap space should be swappedin?

For example, there are 3 processes, each of them has a virtual page that is 
mapped to a 
phyisical page PAGE_A, that means the same PTE is mapped to same PAGE

Process 1 runs out of its  timeslice
Process 2 get scheduled, PAGE_A was from Process 1, so it should be swapped out
Process 3 get scheduled, PAGE_A was from Process 2, so it should be swapped out
Process 1 now comes back, 

when he use PTE to look for its PAGE_A, it will get two PAGE_A,
one is from itself, and the other from Process 2

How does kernel handle this situation?

Thanks
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Where should I ask about USB Target code?

2014-04-25 Thread Larry Martin
I am developing a USB print capture device based on Gumstix Overo (TI 
OMAP) and the Gadget printer driver in Linaro 3.5.0 distribution.  It 
looks like the distributed gadget driver may not be responding to USB 
Setup messages.  I have used printk to verify that my data is correct 
when function composite_setup returns, but it does not appear on my 
Beagle 12 USB analyzer.  I have not changed anything lower down than 
composite.c.  Reading the code in usb/core is not helping much.  I 
really want to trace the call stack from composite_setup back to the 
silicon, but cannot find where the .setup method of the composite driver 
is called.

So my newbie question is, where do I go to find people who are into this 
part of the kernel and talk it over with them?

Thanks,
Larry

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: question about pr_info (newbie)

2014-12-29 Thread Larry Martin
Hi, Kevin -

This gets me all the time.  I think your system is working correctly.

This is the log entry showing your system call:
> Dec 29 11:24:40 kv kernel: [67479.245642] Hello world!

And this is your actual output:
> Dec 29 11:24:40 kv kernel: Hello world!

If you reduce your log level you will lose the first message but not the 
second.

BR,
Larry

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: question about pr_info (newbie)

2014-12-30 Thread Larry Martin
>

> I would appreciate if somebody can be more specific, how this can be
> done. I am using the defaults for syslog, which came with Fedora 21
> x86_64.
>

Kevin, I understand your frustration.  I think I used the wrong term.
It's not a "log level" thing, but a "dynamic debug" thing.  Dynamic 
Debug lets you turn on your specific message without seeing all other 
messages of the same "level."  But that means you may have to explicitly 
turn it off.

See:

google://pr_info
http://lwn.net/Articles/487437/
https://lwn.net/Articles/434833/

 From the last link:
> Turning on dynamic debug causes a new virtual file to appear at
> /sys/kernel/debug/dynamic_debug/control (modulo any individual
> preferences for the location of debugfs, naturally). Writing to that
> file will enable or disable specific debugging functions, as
> specified by a simple but flexible language.

> echo file tpm_nsc.c function init_nsc +p > .../dynamic_debug/control

So your incantation would be something like:

echo file myfile.c function init_me -p > mypath/dynamic_debug/control

LWN has a dynamic debug howto.  I assume it's in kernel docs too.

-- 
Larry Martin
www.GlueLogix.com
Design, Test and Support of Computerized Systems
desk USA 919.342.0201
cell USA 919.641.1733

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: ReviewRequest of a booklet on System Concepts

2017-12-25 Thread Larry Chen

Hi Rishi,

Really great docs on glibc !!!
I'm willing to read them all.

Thanks,
Larry Chen

On 12/26/2017 12:50 PM, Rishi Agrawal wrote:

Hi All,

I have written this booklet 
http://sys.readthedocs.io/en/latest/ explaining some concepts related 
to "glibc and system calls ". This will be useful for the newbies who 
are learning Linux System Programming.


I request the members of the group to kindly review it once and let me 
know if anything is incorrect or can be written and explained in a 
better way. If someone wants to add more contents he/she can surely do 
by raising a "pull request" in the github repo.


My apologies if this is not the right group for it as I do not know of 
any other group with this level of expertise.


--
Regards,
Rishi Agrawal

A simple act of caring creates an endless ripple.
Be the change that you wish to see in the world.
Be thoroughly used up when you die, for the harder you work, the more 
you live.



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: wiki & email upgrades

2018-01-04 Thread Larry Chen



On 01/02/2018 02:44 AM, Rik van Riel wrote:

Hello,

As you may have noticed (if you weren't too busy celebrating the
holidays), I have upgraded kernelnewbies.org to a new version of
the wiki, and am also upgrading the email system.

This email is both an announcement, and a test of the new email
configuration. If you notice lingering problems, please contact
me via email (if it works) or Facebook Messenger.

kind regards,

Rik


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


It looks great, and more fashion than old version.

Regards,
Larry

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Linux Kernel contains only C code?

2018-01-25 Thread Larry Chen

Hi Sekar,

Hi all, ...
1. May i know, other than C language, is there any other programming 
language is/are used inside Linux Kernel?!?!
is there any c++, Perl, python programs are used for peculiar tasks 
inside Linux Kernel?!?!


I have never seen c++, perl or python code in kernel source tree.
Imagine that, if kernel relies on perl, python or other 3rd-party code,
will it cause nested or mutual dependency issues? 3rd-party code bugs
may also cause problems that make the kernel unstable.

2. I believe some assembly language and shell scripting also used.. 
how can I check them? Can you point me which part of the source code 
contains the assembly and shell scripting




Sorry, I do not know what do you mean by "check them".
Assembly code are mostly put within the arch directory. They are used to 
interact

with your various arch CPUs.
In addition to arch directory, there are also some embedded assembly 
code that

could be found in C source code.
Shell scripts are always within tools and script directory.

By the way pure assembly codes files ends with ".S" extension, and shell 
scriptes with ".sh" extension.

You could find them by
find ${kernel_source_dir} -name "*.S"
and
find ${kernel_source_dir} -name "*.sh"

Regards
Larry

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: What will happen if I kill a process which is waiting for the retuan ioctl() syscall?

2018-03-13 Thread Larry Chen

Hello Douglas,

On 03/13/2018 07:56 PM, Douglas Su wrote:

If I have these:

1. I have implemented a simple ioctl() system call which just delay a period 
and return.
2. Call this ioctl() from a userspace process, of course, this process will be 
blocked until ioctl() return.
3. Before ioctl() return, use `kill -9 ` command terminates the process.

Question:

1. Can we instantly kill this process?
Of course, you can. But whether your behavior will affect your process 
depends on your implementation.

2. If we can instantly kill this process, does ioctl() still keep delay after 
killing?

It depends on your implementation of your ioctl.
If your ioctl has some kind of mechanism to check whether there is a 
signal received, you can let your ioctl return.

3. If ioctl() still running even after we terminate this process, where does 
the return value ioctl() will return to?

That sounds insane.

4. How to keep the device's state consistent when we kill a process when it is 
invoking a system call?

Sorry, I did not get your point.

Thanks,
Larry


Best regards.




Douglas
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Queries on bottom halves

2018-09-02 Thread Larry Chen

Hello Abhinav,

On 09/01/2018 04:05 PM, Abhinav Misra wrote:

Hi,

Sorry for the delay in the reply.
I think the question is not correctly framed. Will try to do it again.

1. Which stack does the tasklet, softriq and workqueue use for their 
execution ?




Softirq actually is a group of N kernel threads(N equals to your cpu 
number), each thread is restricted to run on its corresponding cpu.


A tasklet is a call-back function that runs on softirq thread.

In the latest kernel version, a tasklet uses softirq thread stack.

A workqueue is almost the same, a work is almost the same as the a 
tasklet, it runs on a worker thread and shares the stack with worker thread.




2. Why can't we sleep in tasklet and softriq ?

Yes, you can.
Tasklet runs on softirq thread, it has its own task_struct, you can 
sleep or call schedule in your tasklet.


When you sleep in your tasklet, the softirq thread that the tasklet is 
running on will sleep, the sequential tasklet could not be executed 
until next schedule.


BR,
Larry


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Queries on bottom halves

2018-09-02 Thread Larry Chen

Hi Abhinav,

On 09/02/2018 11:28 PM, Abhinav Misra wrote:

Hi Larry,

Based on your answers below are my further queries.

1. *Does softirq and tasklet will always runs in ksoftirqd thread context ?*
As it is mentioned in the LKD (by robert love Pg-138) that there are 
multiple places where pending softirq's
are checked. Out of that one is in return from hardware interrupt code 
path i.e in do_irq function.


If that is the case then it will be running in the irq context with just 
   ~~ --->> Sorry, does "it" mean softirq or 
somethine else??
do_irq just wake up softirq thread. That does not mean softirq runs in 
irq context.



the interrupts enabled.


Now I know LKD is old and based on linux kernel 2.6. *Is that above 
scenario is changed in new version of kernel ?*


Even I tried one example mentioned in LDD by Jerry cooperstein and 
printing the pid of current task (current->pid) in the
tasklet which is getting scheduled by the shared interrupt from n/w 
card. Every time it is printing the pid of the ksoftirqd thread.


So does that mean, now in latest kernel, softirq and tasklet will always 
run in context of ksoftirqd thread ?


Yes.

2. If we can sleep or use blocking calls in softirq's and tasklets then 
*what is the difference between softirq/tasklet and workqueue's ?


That's another question, workqueue and tasklet is two machnisms provided 
for async operations. Generally I think workqueue is more powerful and 
flexible. You can get more info from kernel docs.



*Because in old kernel, the main difference between softirq/tasklet and 
workqueue's (Wq's) is that Wq's runs in process context
and hence sleep is allowed while the same is not the case with other 
counterparts.
I refered to kernel 2.6 version, softirq and tasklet are still almost 
the same machnism with the latest version.


Here is an explanation

https://www.safaribooksonline.com/library/view/understanding-the-linux/0596005652/ch04s07.html



But if in new kernel this implementation is changed then why we need so 
many options to defer the work as all of them are basically getting 
executed in almost the same way.*In that case code running softirq, 
tasklet, workqueue and kernel thread are all same ?*
If this is true then why we just remove all these these option and keep 
one or two alternative.


Emmm... tasklet and workqueue have something in common, but I think 
tasklet can satisfy simple scenarios, while workqueue, I think is more 
powerfull and flexible, does well in more complicated scenarios.


Maybe when you make clear what's their difference, you'll understand more.

BR,
Larry

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies