ubuntu 11.10, systemtap and building my own kernel

2012-04-10 Thread Robert P. J. Day

  (sort of a combo of ubuntu, systemtap and kernel question, hoping
it's not too far off-topic.)

  for the purpose of an upcoming tutorial, i decided to install
systemtap on my fully-updated 64-bit ubuntu 11.10 laptop, then build a
new kernel and show how simple it is to use systemtap.  it didn't turn
out well.

  since i would be using a self-built kernel, i started here:

  http://sourceware.org/systemtap/wiki/SystemTapWithSelfBuiltKernel

but i'm not convinced that page is entirely correct.

  while i made sure all of the listed kernel options were selected, my
first concern is that i'm not sure why i should have to do make
headers_install.  all that does is populate the in-tree usr/include/
directory with the exported header files.  i'm not sure why that's
necessary.  is it really required?  does systemtap actually go looking
there for header files?

  also, the rest of that page seems to explain how to make sure
systemtap can find your kernel build tree.  but if you build and
install, then /lib/modules/release/build is a symlink to the build
tree, so i'm not sure anything else has to be done.  the rest of that
page also seems unnecessary.  thoughts?

  in any event, i configured, built and installed my new kernel (based
on latest git pull from development kernel source), and rebooted to
get:

$ uname -r
3.4.0-rc2+
$

which is correct so, theoretically, i should be read to try a simple
systemtap example.  reading here:

  http://www.domaigne.com/blog/random/running-systemtap-on-ubuntu/

i tried:

$ stap -e 'probe kernel.function(sys_open) {log(hello world) exit()}'

and got:

= start =

In file included from /usr/share/systemtap/runtime/transport/transport.c:53:0,
 from /usr/share/systemtap/runtime/print.c:18,
 from /usr/share/systemtap/runtime/runtime.h:128,
 from 
/tmp/stapadEYdA/stap_59bddd394f89d5f186da7e250db36434_876.c:55:
/usr/share/systemtap/runtime/transport/relay_v2.c:242:2: error: initialization 
from incompatible pointer type [-Werror]
/usr/share/systemtap/runtime/transport/relay_v2.c:242:2: error: (near 
initialization for ‘__stp_relay_callbacks.create_buf_file’) [-Werror]
In file included from /usr/share/systemtap/runtime/print.c:18:0,
 from /usr/share/systemtap/runtime/runtime.h:128,
 from 
/tmp/stapadEYdA/stap_59bddd394f89d5f186da7e250db36434_876.c:55:
/usr/share/systemtap/runtime/transport/transport.c: In function 
‘_stp_get_root_dir’:
/usr/share/systemtap/runtime/transport/transport.c:380:8: error: ‘struct 
hlist_head’ has no member named ‘next’
In file included from 
/tmp/stapadEYdA/stap_59bddd394f89d5f186da7e250db36434_876.c:57:0:
/usr/share/systemtap/runtime/stat.c: In function ‘_stp_stat_get’:
/usr/share/systemtap/runtime/stat.c:213:2: error: ‘cpu_possible_map’ undeclared 
(first use in this function)
/usr/share/systemtap/runtime/stat.c:213:2: note: each undeclared identifier is 
reported only once for each function it appears in
/usr/share/systemtap/runtime/stat.c: In function ‘_stp_stat_clear’:
/usr/share/systemtap/runtime/stat.c:248:2: error: ‘cpu_possible_map’ undeclared 
(first use in this function)
cc1: all warnings being treated as errors

make[1]: *** [/tmp/stapadEYdA/stap_59bddd394f89d5f186da7e250db36434_876.o] 
Error 1
make: *** [_module_/tmp/stapadEYdA] Error 2
Pass 4: compilation failed.  Try again with another '--vp 0001' option.

= end =

  that doesn't look good.  in particular, this error just looks
strange:

/usr/share/systemtap/runtime/transport/transport.c:380:8: error: ‘struct 
hlist_head’ has no member named ‘next’

  to make a long story short, that diagnostic is entirely correct --
struct hlist_head as it's defined in types.h is:

struct hlist_head {
struct hlist_node *first;
};

but that systemtap source file is trying to refer to a member called
next, which clearly does not exist.

  am i doing something silly?  can someone else with an ubuntu system
try this and let me know what happens?  thanks.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


TinyLinux project status

2012-04-10 Thread Ezequiel García
Hello,

I would like to know what is the current status of the tiny linux
project? (The current goals, status and activeness).
I've found this:

http://elinux.org/Linux_Tiny

but it seems a bit outdated.

Also, I would like to know what's the smaller kernel (static and
dynamic memory footprint) that can be achieved
right now (without losing signicant funcionality).

Is it possible to run linux a 1 MB SRAM board (no DRAM) ? (I am
thinking at a ARM7 LPC2294 header board).

Thanks a lot,
Ezequiel.

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


Re: TinyLinux project status

2012-04-10 Thread Dave Stevens
Quoting Ezequiel García elezegar...@gmail.com:

 Hello,

 I would like to know what is the current status of the tiny linux
 project? (The current goals, status and activeness).
 I've found this:

 http://elinux.org/Linux_Tiny

 but it seems a bit outdated.

 Also, I would like to know what's the smaller kernel (static and
 dynamic memory footprint) that can be achieved
 right now (without losing signicant funcionality).

 Is it possible to run linux a 1 MB SRAM board (no DRAM) ? (I am
 thinking at a ARM7 LPC2294 header board).

 Thanks a lot,
 Ezequiel.

you might find what you're looking for at distrowatch.org

d


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




-- 
It is told that such are the aerodynamics and wing loading of the  
bumblebee that, in principle, it cannot fly...if all this be  
true...life among bumblebees must bear a remarkable resemblance to  
life in the United States.

-- John Kenneth Galbraith, in American Capitalism: The Concept of  
Countervailing Power


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


Re: TinyLinux project status

2012-04-10 Thread Dave Hylands
Hi Ezequiel,

2012/4/10 Ezequiel García elezegar...@gmail.com:
 Hello,

 I would like to know what is the current status of the tiny linux
 project? (The current goals, status and activeness).
 I've found this:

 http://elinux.org/Linux_Tiny

 but it seems a bit outdated.

 Also, I would like to know what's the smaller kernel (static and
 dynamic memory footprint) that can be achieved
 right now (without losing signicant funcionality).

 Is it possible to run linux a 1 MB SRAM board (no DRAM) ? (I am
 thinking at a ARM7 LPC2294 header board).

I'm going to hazard a guess and say no. I remember working with the
2.4.x kernel and being able to get it to run on a board with 4 MB of
RAM, and we were fairly tight.

You have to keep in mind that your 1 Mb has to store your currently
running user-mode programs as well.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

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


[Q] TinyLinux project status (resend)

2012-04-10 Thread Ezequiel García
Hello,

I would like to know what is the current status of the tiny linux
project? (The current goals, status and activeness).
I've found this:

http://elinux.org/Linux_Tiny

but it seems a bit outdated.

I'm adding Thomas to CC, cause he maintains (or used to according to elinux)
a list of relevant patches. What's the status of this?

Also, I would like to know what's the smallest kernel (static and
dynamic memory footprint) that can be achieved
right now (without losing signicant funcionality).

Is it possible to run linux a 1 MB SRAM board (no DRAM) ? (I am
thinking at a ARM7 LPC2294 header board).
I now this might sound crazy, but perhaps with In-Place stuff
and some hacks it could be possible.

I've seen tests with 2 MB but not with 1 MB. Also, I've seen
presentations by Matt Mackall [1] and Thomas Petazzoni [2].
but they're a few years old (ages in kernel time, right? :)

Also, wich is the relevant mailing list? Not sure.

Thanks a lot,
Ezequiel.

[1] http://ols.fedoraproject.org/OLS/Reprints-2004/Reprint-Mackall-OLS2004.pdf
[2] http://www.celinux.org/elc08_presentations/linux-tiny.pdf

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


Re: No subject

2012-04-10 Thread Vladimir Murzin
On Tue, Apr 10, 2012 at 10:48:14AM +0600, Martynov Semen wrote:
 one more time in plain text
 
 Yes, of course.
 It contains only one line:
 
 obj-$(CONFIG_MY_PROCLISTOUTPUT) += proclistoutput.o
 
 and works with Kconfig
 
 config MY_PROCLISTOUTPUT
 tristate Display a list of processes
 default y
 ---help---
  This module prints a list of processes
 
 
 But I'm sure that the reason is not in my file, because:
 - If I put my code in a folder /drivers (and include my Makefile and Kconfig) 
 then everything works perfectly (I can build kernel object and I can built-in 
 my code to the kernel)
 - If I put my code in a folder /samples (and include my Makefile and Kconfig) 
 then build-in the code I can't, but with .ko it works fine...
 
 I suppose that the reason in the kernel Makefile. The root Makefile contains 
 this code (http://lxr.free-electrons.com/source/Makefile#L914)
 
 ifdef CONFIG_SAMPLES
  $(Q)$(MAKE) $(build)=samples
 endif
 
 where
 $(Q) = @
 $(build) = -f scripts/Makefile.build obj
 
 and further I lose understanding of the events...
 
 
 10.04.2012, 08:26, Vladimir Murzin murzi...@gmail.com:
  Hi Semen
 
  Could you share a Makefile for your module?
 
  Best wishes,
  Vladimir Murzin
 
  -Original Message-
  From: Martynov Semen semen-marty...@yandex.ru
  Sender: kernelnewbies-boun...@kernelnewbies.org
  Date: Mon, 09 Apr 2012 23:56:15
  To: kernelnewbies@kernelnewbies.orgkernelnewbies@kernelnewbies.org
  Subject: No subject
 
  Good afternoon,
 
  I would like to understand, why I can't make the built-in object, when my 
  code is in a folder /samples...
 
  I have my module-code and if I put it in a folder /samples, I can receive 
  only loadable module (.ko) but if I want to receive the built-in object - 
  it turns out nothing (.о-file is created, but my code doesn't get in a 
  kernel). When I allocate my module-code in any other folder (for example, 
  /drivers) it works normally - I can receive .ko and I can make the built-in 
  object.
 
  Question - why I can't receive the built-in object when my code is in the 
  folder /samples? What instruction in a make-file restricts it, and how?
 
  P.S.: Sorry for my english.
  --
  Best regards,
  Semen A Martynov.
 
  Saint Petersburg, Russia.
  https://www.facebook.com/semen.martynov
 
  ___
  Kernelnewbies mailing list
  Kernelnewbies@kernelnewbies.org
  http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
 -- 
 
 
 Я на Facebook: http://www.facebook.com/profile.php?id=1095131825

Hi Semen

It happens because ./script isn't listed as a subdir for visiting and
linking objects into vmlinux. Please, refer to [1] for details.

[1] http://lxr.linux.no/linux+*/Makefile#L508

Best wishes,
Vladimir Murzin

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


Re: No subject

2012-04-10 Thread Semen Martynov
Yes, this is it! Thank you!

10.04.2012, 20:08, Vladimir Murzin murzi...@gmail.com:
 On Tue, Apr 10, 2012 at 10:48:14AM +0600, Martynov Semen wrote:

  one more time in plain text

  Yes, of course.
  It contains only one line:

  obj-$(CONFIG_MY_PROCLISTOUTPUT) += proclistoutput.o

  and works with Kconfig

  config MY_PROCLISTOUTPUT
  tristate Display a list of processes
  default y
  ---help---
   This module prints a list of processes

  But I'm sure that the reason is not in my file, because:
  - If I put my code in a folder /drivers (and include my Makefile and 
 Kconfig) then everything works perfectly (I can build kernel object and I 
 can built-in my code to the kernel)
  - If I put my code in a folder /samples (and include my Makefile and 
 Kconfig) then build-in the code I can't, but with .ko it works fine...

  I suppose that the reason in the kernel Makefile. The root Makefile 
 contains this code (http://lxr.free-electrons.com/source/Makefile#L914)

  ifdef CONFIG_SAMPLES
   $(Q)$(MAKE) $(build)=samples
  endif

  where
  $(Q) = @
  $(build) = -f scripts/Makefile.build obj

  and further I lose understanding of the events...

  10.04.2012, 08:26, Vladimir Murzin murzi...@gmail.com:
  Hi Semen

  Could you share a Makefile for your module?

  Best wishes,
  Vladimir Murzin

  -Original Message-
  From: Martynov Semen semen-marty...@yandex.ru
  Sender: kernelnewbies-boun...@kernelnewbies.org
  Date: Mon, 09 Apr 2012 23:56:15
  To: kernelnewbies@kernelnewbies.orgkernelnewbies@kernelnewbies.org
  Subject: No subject

  Good afternoon,

  I would like to understand, why I can't make the built-in object, when my 
 code is in a folder /samples...

  I have my module-code and if I put it in a folder /samples, I can receive 
 only loadable module (.ko) but if I want to receive the built-in object - 
 it turns out nothing (.о-file is created, but my code doesn't get in a 
 kernel). When I allocate my module-code in any other folder (for example, 
 /drivers) it works normally - I can receive .ko and I can make the built-in 
 object.

  Question - why I can't receive the built-in object when my code is in the 
 folder /samples? What instruction in a make-file restricts it, and how?

  P.S.: Sorry for my english.
  --
  Best regards,
  Semen A Martynov.

  Saint Petersburg, Russia.
  https://www.facebook.com/semen.martynov

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

  Я на Facebook: http://www.facebook.com/profile.php?id=1095131825

 Hi Semen

 It happens because ./script isn't listed as a subdir for visiting and
 linking objects into vmlinux. Please, refer to [1] for details.

 [1] http://lxr.linux.no/linux+*/Makefile#L508

 Best wishes,
 Vladimir Murzin

-- 
Best regards,
Semen A Martynov.

Saint Petersburg, Russia.
https://www.facebook.com/semen.martynov

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


Re: ubuntu 11.10, systemtap and building my own kernel

2012-04-10 Thread Robert P. J. Day
On Tue, 10 Apr 2012, Frank Ch. Eigler wrote:


 rpjday wrote:

  [...]
  $ stap -e 'probe kernel.function(sys_open) {log(hello world) exit()}'
  and got:
  = start =
  [...]
  cc1: all warnings being treated as errors
  make[1]: *** [/tmp/stapadEYdA/stap_59bddd394f89d5f186da7e250db36434_876.o] 
  Error 1
  make: *** [_module_/tmp/stapadEYdA] Error 2
  Pass 4: compilation failed.  Try again with another '--vp 0001' option.

 Please try systemtap 1.7, or build one out of
 git://sourceware.org/git/systemtap.git.  Newer kernels sometimes
 break systemtap assumptions; these are fixed pretty quickly in the
 source tree, and get rolled into later releases.

 Please report any further problems at system...@sourceware.org,
 including /usr/bin/stap-report output, if able.

  ok, but i'm curious ... i took a quick look at earlier kernels and i
don't see where struct hlist_head *ever* had a next member field
that is required by this version of systemtap (1.4).

  can you clarify which kernel version(s) would have worked with this
version of systemtap?  thanks.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: ubuntu 11.10, systemtap and building my own kernel

2012-04-10 Thread Frank Ch. Eigler
Hi -

On Tue, Apr 10, 2012 at 02:23:43PM -0400, Robert P. J. Day wrote:
 [...]
 ok, but i'm curious ... i took a quick look at earlier kernels and i
 don't see where struct hlist_head *ever* had a next member field
 that is required by this version of systemtap (1.4).

I believe this was related to a viro's linux commit 9591718a5a.

 can you clarify which kernel version(s) would have worked with this
 version of systemtap?  thanks.

According to http://sourceware.org/ml/systemtap/2011-q1/msg00036.html,
it was run with 2.6.9 ... 2.6.37.

- FChE

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


Re: ubuntu 11.10, systemtap and building my own kernel

2012-04-10 Thread Frank Ch. Eigler
Hi -

On Tue, Apr 10, 2012 at 04:17:25PM -0400, Robert P. J. Day wrote:
 [...]
   just FYI, this is the current problem:
 [...]

Yup, found it.  For now, you could adjust your copy of the runtime.h
header file s/map/mask/ and have at it.  We'll plop presently a
polished patch into proper place.

- FChE

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


IRQs and memory consistency

2012-04-10 Thread Christopher Harvey
This is a high level question about how IRQs work in the kernel.

I have a struct that was kmalloc'd into ram. Within this struct there
is an int, called devid. When I set this devid to a number that isn't
0, I print the following:

checking devid value327683 in 0xcb6953d4

where 327683 is the value of the int and 0xcb6953d4 is the address of
the struct that the devid value is in.

Then an interrupt happens and when I print this value again at the
beginning of the interrupt handler I get the following printed text:

checking devid value0 in 0xcb6953d4

notice that the devid has been set to 0. I can't find any code on my
end that would do this. Is there something, maybe related to memory
address spaces in IRQ handlers that I don't know about?

The IRQ and the setting of the devid value happen fairly close to
each other in time. (like less than a second, or closer)

Any ideas or guesses are appreciated.

-Chris


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


Re: ubuntu 11.10, systemtap and building my own kernel

2012-04-10 Thread Robert P. J. Day
On Tue, 10 Apr 2012, Frank Ch. Eigler wrote:

 Hi -

 On Tue, Apr 10, 2012 at 04:17:25PM -0400, Robert P. J. Day wrote:
  [...]
just FYI, this is the current problem:
  [...]

 Yup, found it.  For now, you could adjust your copy of the runtime.h
 header file s/map/mask/ and have at it.  We'll plop presently a
 polished patch into proper place.

  actually, would it be possible to simplify the code?  i see that
systemtap's stat.c defines its own CPU iteration macro:

#define stp_for_each_cpu(cpu)  for_each_cpu_mask((cpu), cpu_possible_map)

is there no way to directly use the kernel's linux/cpumask.h file,
and something like for_each_possible_cpu?

  in any event, i git cloned systemtap so i can just pull the fix
when it's committed.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday


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


Re: IRQs and memory consistency

2012-04-10 Thread Wink Saville
Sounds to me like there needs to be a flush of the processor cache
by using memory barriers.

I'm guessing that the IRQ is taken on a different thread and possibly
a different processor and the value needs to be flushed. You might
try having devid be an atomic_t and then use atomic_set
and atomic_read so that the proper memory barriers are used.

See: http://www.kernel.org/doc/Documentation/atomic_ops.txt

-- Wink


On Tue, Apr 10, 2012 at 1:22 PM, Christopher Harvey
ch...@basementcode.comwrote:

 This is a high level question about how IRQs work in the kernel.

 I have a struct that was kmalloc'd into ram. Within this struct there
 is an int, called devid. When I set this devid to a number that isn't
 0, I print the following:

 checking devid value327683 in 0xcb6953d4

 where 327683 is the value of the int and 0xcb6953d4 is the address of
 the struct that the devid value is in.

 Then an interrupt happens and when I print this value again at the
 beginning of the interrupt handler I get the following printed text:

 checking devid value0 in 0xcb6953d4

 notice that the devid has been set to 0. I can't find any code on my
 end that would do this. Is there something, maybe related to memory
 address spaces in IRQ handlers that I don't know about?

 The IRQ and the setting of the devid value happen fairly close to
 each other in time. (like less than a second, or closer)

 Any ideas or guesses are appreciated.

 -Chris


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

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


Re: TinyLinux project status

2012-04-10 Thread Peter Teoh
minimum specs is available within the page:

http://en.wikipedia.org/wiki/Tiny_Core_Linux

http://en.wikipedia.org/wiki/Damn_Small_Linux

2012/4/10 Ezequiel García elezegar...@gmail.com

 Hello,

 I would like to know what is the current status of the tiny linux
 project? (The current goals, status and activeness).
 I've found this:

 http://elinux.org/Linux_Tiny

 but it seems a bit outdated.

 Also, I would like to know what's the smaller kernel (static and
 dynamic memory footprint) that can be achieved
 right now (without losing signicant funcionality).

 Is it possible to run linux a 1 MB SRAM board (no DRAM) ? (I am
 thinking at a ARM7 LPC2294 header board).

 Thanks a lot,
 Ezequiel.

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




-- 
Regards,
Peter Teoh
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: TinyLinux project status

2012-04-10 Thread Peter Teoh
http://www.chibios.org/dokuwiki/doku.php?id=chibios:documents:requirements

This is 2KiB RAM for recommended configuration.

It is not Linux, but is based on RTOS.

2012/4/11 Peter Teoh htmldevelo...@gmail.com

 minimum specs is available within the page:

 http://en.wikipedia.org/wiki/Tiny_Core_Linux

 http://en.wikipedia.org/wiki/Damn_Small_Linux

 2012/4/10 Ezequiel García elezegar...@gmail.com

 Hello,

 I would like to know what is the current status of the tiny linux
 project? (The current goals, status and activeness).
 I've found this:

 http://elinux.org/Linux_Tiny

 but it seems a bit outdated.

 Also, I would like to know what's the smaller kernel (static and
 dynamic memory footprint) that can be achieved
 right now (without losing signicant funcionality).

 Is it possible to run linux a 1 MB SRAM board (no DRAM) ? (I am
 thinking at a ARM7 LPC2294 header board).

 Thanks a lot,
 Ezequiel.

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




 --
 Regards,
 Peter Teoh




-- 
Regards,
Peter Teoh
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: IRQs and memory consistency

2012-04-10 Thread Mulyadi Santosa
Hi

On Wed, Apr 11, 2012 at 03:22, Christopher Harvey
ch...@basementcode.com wrote:
 The IRQ and the setting of the devid value happen fairly close to
 each other in time. (like less than a second, or closer)

Hmmm, and how about the order? which one do you guess go first?
setting value? or the IRQ handler?

I had a sense that your code flow might (in reality) goes like this

allocating struct RAM -- interrupted -- printing struct content --
back to initialize struct

If that's true, then no wonder 0 (zero) is printed.

I suggest to grab a spin lock if you really need atomicity during
allocation and setting initial value, which in IRQ handler, you grab
the lock before printing. Oh and since memory allocation could go
slow, you might need to do allocation with GFP_ATOMIC.


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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