RE: Crash when sending a lot of messages through a unix socket
Hi Mulyadi! I can't see your point, how can I have a race condition while I am atomic? Thanks for your response, Panos From: Mulyadi Santosa [mulyadi.sant...@gmail.com] Sent: 02 May 2012 19:55 To: Panagiotis Sakkos Cc: kernelnewbies@kernelnewbies.org Subject: Re: Crash when sending a lot of messages through a unix socket Hi :) On Wed, May 2, 2012 at 8:43 PM, Panagiotis Sakkos panos.sak...@cern.ch wrote: Hi, I am trying to log information from within the kernel with the use of a unix socket (/dev/log). My code is a kprobe handler, so while executing I am atomic and uninterrupted. The crashes begin when I do stress tests against my module, so i.e. more than 50 logs per second. Maybe that's the problem..under rapid call, kprobe handler must allocate stack for unwinding the call more and more. Not to mention that it began to push reentrancy problem to the surface. Regarding reentrancy, IMO think like this...your handler called once...ok fine, twice, perhaps still fine...but maybe more than 50 per sec, not to mention the possibility that they are executed by more than 1 core at once, perhaps that's the problem. race condition -- 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
RE: Crash when sending a lot of messages through a unix socket
Hi all, Just FYI, I set the MSG_DONTWAIT flag at my logging socket and now instead of crash I get failure of sending the message (which is much better than crashing...) Thanks, Panos -- http://www.cern.ch/psakkos From: kernelnewbies-boun...@kernelnewbies.org [kernelnewbies-boun...@kernelnewbies.org] on behalf of Panagiotis Sakkos [panos.sak...@cern.ch] Sent: 03 May 2012 10:31 To: kernelnewbies@kernelnewbies.org Subject: RE: Crash when sending a lot of messages through a unix socket Hi Mulyadi! I can't see your point, how can I have a race condition while I am atomic? Thanks for your response, Panos From: Mulyadi Santosa [mulyadi.sant...@gmail.com] Sent: 02 May 2012 19:55 To: Panagiotis Sakkos Cc: kernelnewbies@kernelnewbies.org Subject: Re: Crash when sending a lot of messages through a unix socket Hi :) On Wed, May 2, 2012 at 8:43 PM, Panagiotis Sakkos panos.sak...@cern.ch wrote: Hi, I am trying to log information from within the kernel with the use of a unix socket (/dev/log). My code is a kprobe handler, so while executing I am atomic and uninterrupted. The crashes begin when I do stress tests against my module, so i.e. more than 50 logs per second. Maybe that's the problem..under rapid call, kprobe handler must allocate stack for unwinding the call more and more. Not to mention that it began to push reentrancy problem to the surface. Regarding reentrancy, IMO think like this...your handler called once...ok fine, twice, perhaps still fine...but maybe more than 50 per sec, not to mention the possibility that they are executed by more than 1 core at once, perhaps that's the problem. race condition -- 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 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Crash when sending a lot of messages through a unix socket
Hi, I am trying to log information from within the kernel with the use of a unix socket (/dev/log). My code is a kprobe handler, so while executing I am atomic and uninterrupted. The crashes begin when I do stress tests against my module, so i.e. more than 50 logs per second. The crash messages I get every time are different (from NULL reference, unable to handle page request etc), so I suppose that something is overwritten and this leads to the crash. I don't want to post the code here because it ~100 LOC but these are my steps: Initialization: call sock_create_kern, with PF_UNIX, SOCK_DGRAM, 0 and the address of my socket, then I memset to 0 my sockaddr_un variable and then I set its sun_family to PF_UNIX and copy the /dev/log string to sun_path Logging: I have the message that I want to log in variable called buffer and its length in variable called message_length, I set the msg_name of the msghdr to the address of my sockaddr_un variable, than the msn_namelen to sizeof(sockadrr_un), the msg_iov to an iovec variable which contains the buffer and the message_length values, msg_iovlen to 1 and msg_control, msg_controllen to 0. Then I set the fs to KERNEL_DS, call sock_sendmsg with parameters my socket, the address of my msghdr and the message_length and then I restore the fs that there was before setting it to KERNEL_DS. Please note that my socket, sockadd_un and my buffer are static variables. Also I always use the socket which is initialized once in the Initialization state (function). Do you see any bad practice or something that could lead to crashes when stressing with a lot of messages the socket? Thank you in advance! Panos -- http://www.cern.ch/psakkos ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Crash when sending a lot of messages through a unix socket
Hi :) On Wed, May 2, 2012 at 8:43 PM, Panagiotis Sakkos panos.sak...@cern.ch wrote: Hi, I am trying to log information from within the kernel with the use of a unix socket (/dev/log). My code is a kprobe handler, so while executing I am atomic and uninterrupted. The crashes begin when I do stress tests against my module, so i.e. more than 50 logs per second. Maybe that's the problem..under rapid call, kprobe handler must allocate stack for unwinding the call more and more. Not to mention that it began to push reentrancy problem to the surface. Regarding reentrancy, IMO think like this...your handler called once...ok fine, twice, perhaps still fine...but maybe more than 50 per sec, not to mention the possibility that they are executed by more than 1 core at once, perhaps that's the problem. race condition -- 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
RE: Crash when sending a lot of messages through a unix socket
You mentioned your code is atomic. Are you certain that you can do a sock_sendmsg from a non process context? I believe you can't do that from a non process context cuz sock_sendmsg--udp_sendmsg for DGRAM and i think that assumes you are in process context. From: kernelnewbies-boun...@kernelnewbies.org [kernelnewbies-boun...@kernelnewbies.org] On Behalf Of kernelnewbies-requ...@kernelnewbies.org [kernelnewbies-requ...@kernelnewbies.org] Sent: Wednesday, May 02, 2012 9:30 PM To: kernelnewbies@kernelnewbies.org Subject: Kernelnewbies Digest, Vol 18, Issue 2 Send Kernelnewbies mailing list submissions to kernelnewbies@kernelnewbies.org To subscribe or unsubscribe via the World Wide Web, visit http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies or, via email, send a message with subject or body 'help' to kernelnewbies-requ...@kernelnewbies.org You can reach the person managing the list at kernelnewbies-ow...@kernelnewbies.org When replying, please edit your Subject line so it is more specific than Re: Contents of Kernelnewbies digest... Today's Topics: 1. please report distros with CONFIG_DYNAMIC_DEBUG, using ddebug_query= boot param (Jim Cromie) 2. Re: immutable wiki? (mic...@michaelblizek.twilightparadox.com) 3. Re: immutable wiki? (Bill Traynor) 4. Crash when sending a lot of messages through a unix socket (Panagiotis Sakkos) -- Message: 1 Date: Tue, 1 May 2012 12:36:04 -0600 From: Jim Cromie jim.cro...@gmail.com Subject: please report distros with CONFIG_DYNAMIC_DEBUG, using ddebug_query= boot param To: kernelnewbies kernelnewbies@kernelnewbies.org Message-ID: cajfubxw8ayimau7ko42vh_e-zzbnskw9hd8dx2tfcowl4ue...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 hi all, Ive been asked whether ddebug_query= boot param is used in any distros, I think the question seeks to determine a good deprecation schedule for it (its been obsoleted by dyndbg= in driver-core-next) Would you all be so kind as to check your favorite distros, and report the ones that have one or both ? Ubuntu 12.04 LTS lacks it: jimc@chumly:~/projects/lx/linux-2.6$ grep DYNAMIC_DEBUG /boot/config* /boot/config-3.0.0-17-generic:# CONFIG_DYNAMIC_DEBUG is not set /boot/config-3.2.0-24-generic:# CONFIG_DYNAMIC_DEBUG is not set Voyage linux also lacks it, (also debian based) Fedora-16 has config option: $ uname -a Linux groucho.jimc.earth 3.3.2-6.fc16.x86_64 #1 SMP Sat Apr 21 12:43:20 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux $ grep DYNAMIC_DEBUG /boot/config-3.3.* /boot/config-3.3.1-5.fc16.x86_64:CONFIG_DYNAMIC_DEBUG=y /boot/config-3.3.2-1.fc16.x86_64:CONFIG_DYNAMIC_DEBUG=y /boot/config-3.3.2-6.fc16.x86_64:CONFIG_DYNAMIC_DEBUG=y but its not used by default. I have modified my grub defaults: $ grep ddebug_query /etc/default/grub GRUB_CMDLINE_LINUX='quiet rhgb loglevel=8 ddebug_query=module params +p dynamic_debug.verbose=1 nouveau.dyndbg nouveau.force_post=1 it87.dyndbg=+p nouveau.perflvl_wr=' FYI, the above usage will eventually be unsupported, it can be replaced in driver-core-next by either of: dyndbg=module params +p params.dyndbg=+p params.dyndbg # defaults to +p the 2nd, 3rd forms also work for loadable modules (though params isnt one of them) thanks in advance Jim -- Message: 2 Date: Wed, 2 May 2012 12:52:38 +0200 From: mic...@michaelblizek.twilightparadox.com Subject: Re: immutable wiki? To: Bill Traynor w...@alphatroop.com Cc: kernelnewbies@kernelnewbies.org Message-ID: 20120502105237.GA2229@grml Content-Type: text/plain; charset=us-ascii Hi! On 09:29 Tue 01 May , Bill Traynor wrote: I have an Editor account for the kernelnewbies.org wiki, but all pages are currently immutable. Was the wiki made read-only at some point? You must be on http://kernelnewbies.org/EditorsGroup to make changes. This was made for spam procection. Everybody who is on the list can add you. What is your username in the wiki? -Michi -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com -- Message: 3 Date: Wed, 2 May 2012 08:06:36 -0400 From: Bill Traynor w...@alphatroop.com Subject: Re: immutable wiki? To: mic...@michaelblizek.twilightparadox.com Cc: kernelnewbies@kernelnewbies.org Message-ID: CAGfZjq69kO91rbiG8R5jTUmRDq3ZJRjp_oTLqS8wji1M=1n...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 On Wed, May 2, 2012 at 6:52 AM, mic...@michaelblizek.twilightparadox.com wrote: Hi! On 09:29 Tue 01 May ? ? , Bill Traynor wrote: I have an Editor account for the kernelnewbies.org wiki, but all pages are currently immutable. ?Was the wiki made read-only at some point? You must be on http://kernelnewbies.org/EditorsGroup to make changes. This was made for spam
Re: Crash when sending a lot of messages through a unix socket
Hi Pranay, This code logs the messages without problem if I don't stress it, so I suppose you can. If you want I will commit tomorrow my changes on github and I will send you the url to have a look. Cheers, Panos On May 2, 2012, at 10:31 PM, Pranay Kumar Srivastava wrote: You mentioned your code is atomic. Are you certain that you can do a sock_sendmsg from a non process context? I believe you can't do that from a non process context cuz sock_sendmsg--udp_sendmsg for DGRAM and i think that assumes you are in process context. From: kernelnewbies-boun...@kernelnewbies.org [kernelnewbies-boun...@kernelnewbies.org] On Behalf Of kernelnewbies-requ...@kernelnewbies.org [kernelnewbies-requ...@kernelnewbies.org] Sent: Wednesday, May 02, 2012 9:30 PM To: kernelnewbies@kernelnewbies.org Subject: Kernelnewbies Digest, Vol 18, Issue 2 Send Kernelnewbies mailing list submissions to kernelnewbies@kernelnewbies.org To subscribe or unsubscribe via the World Wide Web, visit http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies or, via email, send a message with subject or body 'help' to kernelnewbies-requ...@kernelnewbies.org You can reach the person managing the list at kernelnewbies-ow...@kernelnewbies.org When replying, please edit your Subject line so it is more specific than Re: Contents of Kernelnewbies digest... Today's Topics: 1. please report distros with CONFIG_DYNAMIC_DEBUG, using ddebug_query= boot param (Jim Cromie) 2. Re: immutable wiki? (mic...@michaelblizek.twilightparadox.com) 3. Re: immutable wiki? (Bill Traynor) 4. Crash when sending a lot of messages through a unix socket (Panagiotis Sakkos) -- Message: 1 Date: Tue, 1 May 2012 12:36:04 -0600 From: Jim Cromie jim.cro...@gmail.com Subject: please report distros with CONFIG_DYNAMIC_DEBUG, using ddebug_query= boot param To: kernelnewbies kernelnewbies@kernelnewbies.org Message-ID: cajfubxw8ayimau7ko42vh_e-zzbnskw9hd8dx2tfcowl4ue...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 hi all, Ive been asked whether ddebug_query= boot param is used in any distros, I think the question seeks to determine a good deprecation schedule for it (its been obsoleted by dyndbg= in driver-core-next) Would you all be so kind as to check your favorite distros, and report the ones that have one or both ? Ubuntu 12.04 LTS lacks it: jimc@chumly:~/projects/lx/linux-2.6$ grep DYNAMIC_DEBUG /boot/config* /boot/config-3.0.0-17-generic:# CONFIG_DYNAMIC_DEBUG is not set /boot/config-3.2.0-24-generic:# CONFIG_DYNAMIC_DEBUG is not set Voyage linux also lacks it, (also debian based) Fedora-16 has config option: $ uname -a Linux groucho.jimc.earth 3.3.2-6.fc16.x86_64 #1 SMP Sat Apr 21 12:43:20 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux $ grep DYNAMIC_DEBUG /boot/config-3.3.* /boot/config-3.3.1-5.fc16.x86_64:CONFIG_DYNAMIC_DEBUG=y /boot/config-3.3.2-1.fc16.x86_64:CONFIG_DYNAMIC_DEBUG=y /boot/config-3.3.2-6.fc16.x86_64:CONFIG_DYNAMIC_DEBUG=y but its not used by default. I have modified my grub defaults: $ grep ddebug_query /etc/default/grub GRUB_CMDLINE_LINUX='quiet rhgb loglevel=8 ddebug_query=module params +p dynamic_debug.verbose=1 nouveau.dyndbg nouveau.force_post=1 it87.dyndbg=+p nouveau.perflvl_wr=' FYI, the above usage will eventually be unsupported, it can be replaced in driver-core-next by either of: dyndbg=module params +p params.dyndbg=+p params.dyndbg # defaults to +p the 2nd, 3rd forms also work for loadable modules (though params isnt one of them) thanks in advance Jim -- Message: 2 Date: Wed, 2 May 2012 12:52:38 +0200 From: mic...@michaelblizek.twilightparadox.com Subject: Re: immutable wiki? To: Bill Traynor w...@alphatroop.com Cc: kernelnewbies@kernelnewbies.org Message-ID: 20120502105237.GA2229@grml Content-Type: text/plain; charset=us-ascii Hi! On 09:29 Tue 01 May , Bill Traynor wrote: I have an Editor account for the kernelnewbies.org wiki, but all pages are currently immutable. Was the wiki made read-only at some point? You must be on http://kernelnewbies.org/EditorsGroup to make changes. This was made for spam procection. Everybody who is on the list can add you. What is your username in the wiki? -Michi -- programing a layer 3+4 network protocol for mesh networks see http://michaelblizek.twilightparadox.com -- Message: 3 Date: Wed, 2 May 2012 08:06:36 -0400 From: Bill Traynor w...@alphatroop.com Subject: Re: immutable wiki? To: mic...@michaelblizek.twilightparadox.com Cc: kernelnewbies@kernelnewbies.org Message-ID: CAGfZjq69kO91rbiG8R5jTUmRDq3ZJRjp_oTLqS8wji1M=1n...@mail.gmail.com Content-Type: