Re: What are the most frequently used methods for system level-tracing?

2020-07-08 Thread Augusto Mecking Caringi
Hi,

On Wed, Jul 8, 2020 at 11:17 PM 孙世龙 sunshilong  wrote:
>
> Hi, list
>
> What are the most frequently used methods for system level-tracing?
> I would appreciate it if you could give me some related documents to go 
> through.

3 links for you:

https://jvns.ca/blog/2017/07/05/linux-tracing-systems/
http://www.brendangregg.com/blog/2015-07-08/choosing-a-linux-tracer.html
https://www.kernel.org/doc/html/latest/trace/index.html


Regards,

> Thank you for your attention to this matter.
> Best regards.
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-- 
Augusto Mecking Caringi

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


Re: function stack frames in the kernel

2018-11-11 Thread Augusto Mecking Caringi
On Sun, Nov 11, 2018 at 6:04 PM Carter Cheng  wrote:
> I am wondering how the compiler divines which stack to use for function calls 
> and placement of locals and arguments when a function call is made inside the 
> kernel since the kernel has multiple call stacks. Are function calls handled 
> manually inside kernel code or is there something special inside the compiler 
> for handling this?

I think this link can answer your question...

https://stackoverflow.com/questions/12911841/kernel-stack-and-user-space-stack

-- 
Augusto Mecking Caringi

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


Re: Linux kernel Books

2018-03-24 Thread Augusto Mecking Caringi
On Fri, Mar 23, 2018 at 10:00 AM, Milad Kahsari <m.kahs...@gmail.com> wrote:
> This book illustrates virtual memory space in a reasonably clear way, easy
> to follow with lots of diagrams, which I did not find in other books.
> Although it states IA-64, the concept is pretty much the same if you are
> looking for IA-32, excellent book, definitely recommend it! :)

It's worth to note that IA-64 [1] is not x86-64 [2].

IA-64 is the Itanium ISA. Is there still anyone using this? :)

Best regards,

[1] https://en.wikipedia.org/wiki/IA-64
[2] https://en.wikipedia.org/wiki/X86-64

-- 
Augusto Mecking Caringi

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


Re: Linux Kernel contains only C code?

2018-02-02 Thread Augusto Mecking Caringi
On Fri, Feb 2, 2018 at 11:11 AM, Daniel. <danielhi...@gmail.com> wrote:
> I'm just curious. What problems in kernel involves parsing?

$ find -name *.[yl]
./drivers/scsi/aic7xxx/aicasm/aicasm_scan.l
./drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
./drivers/scsi/aic7xxx/aicasm/aicasm_macro_scan.l
./drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y
./tools/perf/util/pmu.l
./tools/perf/util/expr.y
./tools/perf/util/parse-events.y
./tools/perf/util/parse-events.l
./tools/perf/util/pmu.y
./tools/bpf/bpf_exp.y
./tools/bpf/bpf_exp.l
./scripts/genksyms/parse.y
./scripts/genksyms/lex.l
./scripts/dtc/dtc-lexer.l
./scripts/dtc/dtc-parser.y
./scripts/kconfig/zconf.l
./scripts/kconfig/zconf.y

So, really in the kernel just a SCSI driver that needs to parse a
"Host adapter sequencer assembler"...

The others *[yl] files are in tools or scripts directories (userspace
tools like perf or build support scripts).

-- 
Augusto Mecking Caringi

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


Re: Linux Kernel contains only C code?

2018-02-01 Thread Augusto Mecking Caringi
On Thu, Feb 1, 2018 at 5:37 PM, Aruna Hewapathirane
<aruna.hewapathir...@gmail.com> wrote:
>> On Fri, Jan 26, 2018 at 1:58 AM, inventsekar <inventse...@gmail.com>
>> wrote:
>> 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?!?!
>
> Well, let's find out ? If you open up a shell/terminal and change into the
> top level directory of your Linux kernel source and run the command below:
>
> find . -type f -and -printf "%f\n" | grep -io '\.[^.]*$' | sort | uniq -c |
> sort -rn ( Breaking this down, find all files+get the filename+pull out the
> file extension+sort+only keep unique ext+sort with a stats count)

For that I recommend a tool called sloccount [1]...

BTW, running it now against Linux Kernel source I got:

Totals grouped by language (dominant language first):
ansic: 16675070 (97.83%)
asm: 294179 (1.73%)
perl: 26346 (0.15%)
sh:   18781 (0.11%)
python:   15642 (0.09%)
cpp:   6512 (0.04%)
yacc:  4586 (0.03%)
lex:   2479 (0.01%)
awk:   1387 (0.01%)
pascal: 231 (0.00%)
sed:  5 (0.00%)
Total Physical Source Lines of Code (SLOC)        = 17,045,218


[1] https://www.dwheeler.com/sloccount/

-- 
Augusto Mecking Caringi

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


Re: Linux Kernel contains only C code?

2018-01-29 Thread Augusto Mecking Caringi
On Fri, Jan 26, 2018 at 2:12 PM,  <valdis.kletni...@vt.edu> wrote:
> On Fri, 26 Jan 2018 05:53:20 -0500, Ruben Safir said:
>> Its not even really C, at least not as a normal application developer
>> thinks of it.  This is systems programming with a lot of kernel specific
>> libraries.
>
> It's C.  The fact that things like stdio aren't available inside the kernel
> doesn't mean it's not C.

I would say that is C with GNU extensions [1]... Not plain/pure (ANSI/ISO) C.

That's why it's not so easy to build the Linux Kernel with any other C compiler.

There is a ongoing effort to build it with Clang [2].

I'm not sure how is the current status regarding the Intel C Compiler.

> (I've worked on large userspace code bases where you could go for several
> hundred thousand lines without seeing anything from /usr/include, and nobody
> would argue that code wasn't C.)

Best regards,

[1] https://www.ibm.com/developerworks/linux/library/l-gcc-hacks/
[2] https://lwn.net/Articles/734071/

-- 
Augusto Mecking Caringi

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


Re: Virtual Address Space

2016-09-28 Thread Augusto Mecking Caringi
On Wed, Sep 28, 2016 at 6:06 AM, Madhu K <madhu.s...@gmail.com> wrote:
> Hi All,
>
> This is to understand the Virtual address space.Basically who generates the
> virtual addresses CPU or GNU compiler?

Hi,

 In my view, the linker.

 The compiler normally generates absolute addresses (starting from
0), creating object code.

 Then the linker generates an executable by combining different
object files together and assigning virtual addresses.

 Finally, is CPU (MMU) job (with the kernel helping) to translate
these virtual addresses to physical ones.

 Best regards,

-- 
Augusto Mecking Caringi

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


Re: Call Trace analysis doubt

2016-06-20 Thread Augusto Mecking Caringi
On Wed, Jun 15, 2016 at 3:26 AM, Muni Sekhar <munisekhar...@gmail.com> wrote:
> Hi,
>
> Let’s assume WARNING message says something like:
>
>
> [0.00] Call Trace:
>
> [0.00]  [] dump_stack+0x45/0x56
>
> [0.00]  [] warn_slowpath_common+0x7d/0xa0
>
> [0.00]  [] warn_slowpath_fmt_taint+0x44/0x50
>
> [0.00]  [] ? acpi_tb_acquire_table+0x3e/0x6c
>
> [0.00]  [] warn_invalid_dmar+0x81/0x93
>
> [0.00]  [] detect_intel_iommu+0xe9/0x172
>
> [0.00]  [] pci_iommu_alloc+0x4a/0x6c
>
> [0.00]  [] mem_init+0x17/0x9c
>
> [0.00]  [] start_kernel+0x23b/0x47d
>
> [0.00]  [] ? set_init_arg+0x53/0x53
>
> [0.00]  [] ? early_idt_handlers+0x120/0x120
>
> [0.00]  [] x86_64_start_reservations+0x2a/0x2c
>
> [0.00]  [] x86_64_start_kernel+0x143/0x152
>
> [0.00] ---[ end trace c32c0e307381ad8a ]---
>
>
>
> Few symbols in the above mentioned call trace are prefixed with “?”
> (for e.g.  ?early_idt_handlers\? set_init_arg\?
> acpi_tb_acquire_table), what does it mean?
> Does it needs to be considered while debugging the kernel module?

Hi,

There is an explanation about the meaning of these '?' here:

https://www.kernel.org/doc/Documentation/x86/kernel-stacks

-- 
Augusto Mecking Caringi

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


Re: boot param to change tick

2016-06-20 Thread Augusto Mecking Caringi
On Sun, May 29, 2016 at 11:51 PM, Lax Clarke <lax.cla...@gmail.com> wrote:
> Is there a way to change a grub/lilo kernel boot param to change the kernel
> tick rate?

AFAIK, no.

You have to rebuild the kernel to change the HZ value.

-- 
Augusto Mecking Caringi

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


Re: inline functions

2016-06-04 Thread Augusto Mecking Caringi
On Sat, Jun 4, 2016 at 11:59 AM, Muni Sekhar <munisekhar...@gmail.com> wrote:
> Hi,
>
> I tested with the below mentioned code("inline.c") to understand about
> inline functions.
>
> I explicitly instructed gcc to translate inline.c to inline.s.
>
> Next I removed the inline keyword from inline.c and re-created the
> inline.s file, but I don’t see any difference in the assembly code. Is
> it correct behavior?
>
> Could you guys point few good examples to understand the concept of inline?

Hi Muni,

Probably gcc is automatic inlining your function even in the
absence of 'inline' keyword...

Take a look here:


http://www.cocoabuilder.com/archive/xcode/269025-how-to-disable-gcc-automatic-inlining.html

And here:

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

There are a few inline related flags, including this:

-finline-functions-called-once
Consider all static functions called once for inlining into their
caller even if they are not marked inline. If a call to a given
function is integrated, then the function is not output as assembler
code in its own right.
Enabled at levels -O1, -O2, -O3 and -Os.

Best regards,

-- 
Augusto Mecking Caringi

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


Re: Eudyptula Challenge Submission and no response?

2014-06-05 Thread Augusto Mecking Caringi
On Thu, Jun 5, 2014 at 9:58 AM, George E. Moore g...@x-ctr-l.com wrote:

 Is there a POC (email contact for Eudyptula Challenge)? Submitted
 response to Eudyptula Challenge, task 01 (05/23/14) and have yet to
 receive response.


This is due the high number of subscribers (much more than expected) in the
challenge.

I recommend this text in LWN:

Taking the Eudyptula Challenge

http://lwn.net/Articles/599231/

-- 
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: head.S

2014-06-02 Thread Augusto Mecking Caringi
On Mon, Jun 2, 2014 at 12:53 PM, Saurabh Jain saurabh4768j...@gmail.com
wrote:

 hello every one !

 I am trying to trace Linux kernel booting process for ARM architecture.
 Right now i am doing it manually . I am getting problem in reading assembly
 codes (like in head.s and other files) . Can any body tell me the correct
 way of tracing the linux kernel booting process ? Is there any guide which
 perfectly document Linux kernel files function by function ?


Hi Saurabh,

I don't know of any guide for Linux ARM boot code.

But there are some guides for Linux x86 boot code for ancient Linux
Kernels, like this:

http://www.oldlinux.org/Linux.old/study/eclk-03-boot.pdf

Best regards!

-- 
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to trace the send() in client call

2014-05-27 Thread Augusto Mecking Caringi
On Tue, May 27, 2014 at 8:31 AM, Robert Clove cloverob...@gmail.com wrote:

 But there will be other packets also coming from the network like if some
 one is browsing the net on mozilla.
 I only want to trace the send() calls that i have used in my code,is that
 possible?


Robert,

You must specify the PID of your process (to attach strace to a running
process), or run your program through strace.

Yon can use grep to filter only the write syscall.

Regards.

--
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to trace the send() in client call

2014-05-26 Thread Augusto Mecking Caringi
On Mon, May 26, 2014 at 1:48 PM, Robert Clove cloverob...@gmail.com wrote:

 Hi All,

 I need your help.
 I have written the client server program in which client is sending the
 packets to the server.
 I want to trace the send() that is used in the client program actually
 want to trace the system call  the packet traverses .
 How to trace ?


Hi Robert,

You can use the strace command line tool.

There is an argument to trace only network related syscalls:

-e trace=network
   Trace all the network related system calls.

Take a look on the strace manual page for more information.

Best regards.

-- 
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Adding a dummy system call

2014-04-04 Thread Augusto Mecking Caringi
On Fri, Apr 4, 2014 at 9:20 PM, Adam Fowler ajf2...@columbia.edu wrote:

 Hi Everyone,
  I am trying to learn the linux kernel via the book Linux Kernel
 Development 3rd edition by Robert Love, and in it he advises to use the
 macro _syscallX to allow access to user added syscalls not wrapped by glibc
 functions. In my attempt to add a system call this macro failed me and
 after a little man page perusal I noticed _syscallX is obselete. Is it
 considered a better practice to declare the asmlinkage int sys_X(..)
 declaration myself instead of using this obsolete macro? Or did syscall(2)
 replace it? And if it was replaced does anyone have a reference they could
 point me for adding system calls in kernel 3.10 or similar? thank you in
 advance!

Hi,

To call a new/generic syscall in userspace, take a look here:

http://www.gnu.org/software/libc/manual/html_node/System-Calls.html

To add a new syscall to a recent kernel, take a look here:

http://blog.techveda.org/adding-system-calls-linux-kernel-3-5-x/

-- 
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Adding custom system calls

2014-03-20 Thread Augusto Mecking Caringi
On Thu, Mar 20, 2014 at 2:25 PM, arun kumar arunkr.li...@gmail.com wrote:

 How do i add a Custom system call to my Linux Kernel.
 I want to know what files to modify and where to make the entries.

 Arch : x86 64bit
 Kernel: 3.12.14


http://lmgtfy.com/?q=how+to+add+a+syscall+to+Linux+kernel+3.x

:)

-- 
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: tcp packet split

2014-01-19 Thread Augusto Mecking Caringi
On Sun, Jan 19, 2014 at 2:31 AM, net.study@gmail.com wrote:

 How does the application level recognize each segment bridge in tcp stream
 ?
 i.e packe a 30bytes packet b 50bytes packet a 20bytes
 And why it is possible for one packet to contain uncontinuous part of
 different  user protocol packets?


It's not a kernel question in my opinion, but...

Take a look here:

Segmentation is the process of carving up information into smaller pieces.
The documentation for Transmission Control Protocol (TCP) refrers to what
it calls 'data streams'. A data stream is really nothing more than a series
of zeroes and ones that represent information. TCP receives data from an
application and segments the data into pieces. This segmentation is
necessary so that the information can be placed inside the TCP data field.

TCP reassembles segments into a data stream and feeds that data stream to
the application. The best known example of this activity is HTTP transfer
of a web page. The web server loads a web page from disk, encapsulates the
web page text in HTTP headers, the passes the HTTP encoded stream of text
to TCP. TCP segments the text stream for transport across the network. The
networking software (the stack) receives the TCP data segments and
reassembles the HTTP stream of text, which your web browser reads, and
renders as a web page.

http://www.inetdaemon.com/tutorials/internet/tcp/segmentation.shtml



 在 2014-1-18,22:04,Augusto Mecking Caringi augustocari...@gmail.com 写道:

 On Sat, Jan 18, 2014 at 12:08 AM, net.study@gmail.com wrote:

 Hi :
  If one tcp data packet contains serveral  user protocol packet. .
 How is it splitter over to separate packet ?


 Hi,

 It's an application protocol level problem and it's application job to
 do this.

 This is also called TCP desegmentation or TCP reassembly. Take a look
 here:

 http://wiki.wireshark.org/TCP_Reassembly

 Regards.

 --
 Augusto Mecking Caringi




-- 
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: tcp packet split

2014-01-19 Thread Augusto Mecking Caringi
On Sun, Jan 19, 2014 at 2:31 AM, net.study@gmail.com wrote:

 How does the application level recognize each segment bridge in tcp stream
 ?
 i.e packe a 30bytes packet b 50bytes packet a 20bytes
 And why it is possible for one packet to contain uncontinuous part of
 different  user protocol packets?


Take a look here also:

http://www.wireshark.org/docs/wsdg_html_chunked/ChDissectReassemble.html

-- 
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Introducing Myself, Looking to Learn

2013-09-03 Thread Augusto Mecking Caringi
On Tue, Sep 3, 2013 at 4:29 PM, Varad Gautam varadgau...@live.com wrote:

 Hi!
 I want to start working on the Linux kernel but am an absolute beginner. I
 am currently on my way through Robert Love's Linux Kernel Development and
 need help with finding something I can work on to get a hang of what it's
 like.

 I have also subscribed to the LKML, but find it completely
 incomprehensible! As a beginner, would it be better to work with the kernel
 of a specific OS (I'm running Ubuntu), or work on the upstream kernel?


Hi,

If you are an absolute beginner, I recommend you to start studying and
hacking a small O.S., like the xv6:

http://pdos.csail.mit.edu/6.828/2012/xv6.html

http://pdos.csail.mit.edu/6.828/2012/xv6/book-rev7.pdf

If you need a background on the low level, I suggest you to read this:

http://download.savannah.gnu.org/releases/pgubook/ProgrammingGroundUp-1-0-booksize.pdf

-- 
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernel generates vmImage instead of zImage

2013-04-04 Thread Augusto Mecking Caringi
On Thu, Apr 4, 2013 at 7:02 AM, Onur Cem Çelebi occel...@gmail.com wrote:

 Output is:

 root@F15:~/ruclinux/uClinux-dist# make zImage
 make: *** No rule to make target `zImage'.  Stop.

Maybe, this is the answer:

Though zImage is a valid Makefile target for all the architectures we
discussed in depth in Chapter 3, there are other Linux architectures
for which it isn't valid.

http://books.google.com.br/books?id=xnFdWfJAK9wCpg=PT188lpg=PT188dq=zImage+is+a+valid+Makefile+target+for+all+the+architectures+we+discussed+insource=blots=GFTLM7_665sig=77Oi5e_TmkXME_5du3H5GdqPw4chl=pt-BRsa=Xei=xZ5dUeqqIY3x0wH4x4D4Cwved=0CD0Q6AEwAQ#v=onepageqf=false

--
Augusto Mecking Caringi

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