From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: [patch] irq threading: fix PF_HARDIRQ definition Date: Thu, 12 Feb 2009 09:38:50 +0100 Message-ID: <20090212083850.GA29995@elte.hu> References: <20090211205533.329cea1c@torg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Thomas Gleixner , LKML , rt-users , Steven Rostedt , Peter Zijlstra , Carsten Emde To: Clark Williams Return-path: Received: from mx3.mail.elte.hu ([157.181.1.138]:43049 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750968AbZBLIjN (ORCPT ); Thu, 12 Feb 2009 03:39:13 -0500 Content-Disposition: inline In-Reply-To: <20090211205533.329cea1c@torg> Sender: linux-rt-users-owner@vger.kernel.org List-ID: * Clark Williams wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Wed, 11 Feb 2009 23:43:44 +0100 (CET) > Thomas Gleixner wrote: > > > After a 1.5 years sabbatical from preempt-rt we are pleased to > > announce a refactored preempt-rt patch against linux-2.6.29-rc4. > > > Hi Thomas, > > I got the following after booting on my T60: > > - ------------[ cut here ]------------ > WARNING: at crypto/blkcipher.c:327 blkcipher_walk_first+0x72/0x1aa() > Hardware name: > Modules linked in: fuse i915 drm i2c_algo_bit cfbcopyarea cfbimgblt cfbfillrect autofs4 coretemp sunrpc nf_conntrack_netbios_ns xt_state ipt_REJECT iptable_filter ip_tables cpufreq_ondemand dm_multipath scsi_dh uinput btusb bluetooth sg snd_hda_codec_analog snd_hda_intel snd_hda_codec iwl3945 snd_hwdep e1000e lib80211 snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss video snd_mixer_oss snd_pcm snd_timer snd soundcore snd_page_alloc i2c_i801 i2c_core thinkpad_acpi rfkill output iTCO_wdt iTCO_vendor_support button joydev hwmon dm_snapshot dm_zero dm_mirror dm_region_hash dm_log uhci_hcd ohci_hcd ehci_hcd [last unloaded: microcode] > Pid: 9, comm: sirq-tasklet/0 Not tainted 2.6.29-rc4-rt1-tip #50 > Call Trace: > [] warn_slowpath+0xaf/0xd6 > [] blkcipher_walk_first+0x72/0x1aa > [] ? enqueue_task_fair+0x25/0x68 > [] blkcipher_walk_virt+0x1a/0x1c > [] crypto_ecb_crypt+0x2b/0x9a > [] ? setkey+0xc4/0xd8 > [] ? arc4_crypt+0x0/0x5e > [] crypto_ecb_decrypt+0x31/0x33 > [] ? setkey+0xba/0xcd > [] ? __wake_up_common+0x49/0x7f > [] ieee80211_wep_decrypt_data+0x5e/0x95 > [] ieee80211_wep_decrypt+0x118/0x16f > [] ieee80211_crypto_wep_decrypt+0x4b/0x93 > [] ieee80211_invoke_rx_handlers+0x26b/0x1395 > [] ? native_smp_send_reschedule+0x59/0x5b > [] ? resched_task+0x60/0x62 > [] ? try_to_wake_up+0x352/0x364 > [] ? default_wake_function+0xf/0x11 > [] __ieee80211_rx_handle_packet+0x55f/0x59c > [] __ieee80211_rx+0x508/0x572 > [] ieee80211_tasklet_handler+0x6d/0xff > [] __tasklet_action+0xa1/0x112 > [] tasklet_action+0x39/0x3b > [] ksoftirqd+0x162/0x278 > [] ? ksoftirqd+0x0/0x278 > [] ? ksoftirqd+0x0/0x278 > [] kthread+0x48/0x73 > [] child_rip+0xa/0x20 > [] ? kthread+0x0/0x73 > [] ? child_rip+0x0/0x20 > - ---[ end trace b6a0ff9dfe960c5e ]--- > > It booted to runlevel 5, brought up GDM, I logged in and XFCE came up > fine. It wasn't until NetworkManager started dorking around with the > 802.11 adapter and started doing WEP things that I got the above > warning. Right after I got this, NetworkManager connected and the > system locked up. Sorry, no traceback from the panic. > > I haven't gone far in looking at this, but it looks like we might have > to adjust expectations in the crypto code, since it's probably ok to > be in_irq() in this case, since we're actually in a kthread. no, removing the warning would just hide the real bug. Could you try the fix below please? Ingo ---------------------------------> Subject: irq threading: fix PF_HARDIRQ definition From: Ingo Molnar Date: Thu Feb 12 09:29:14 CET 2009 Clark Williams reported the following warning: WARNING: at crypto/blkcipher.c:327 blkcipher_walk_first+0x72/0x1aa() [] blkcipher_walk_first+0x72/0x1aa [] blkcipher_walk_virt+0x1a/0x1c [] crypto_ecb_crypt+0x2b/0x9a [] crypto_ecb_decrypt+0x31/0x33 [] ieee80211_wep_decrypt_data+0x5e/0x95 [] ieee80211_wep_decrypt+0x118/0x16f [] ieee80211_crypto_wep_decrypt+0x4b/0x93 [] ieee80211_invoke_rx_handlers+0x26b/0x1395 [] __ieee80211_rx_handle_packet+0x55f/0x59c [] __ieee80211_rx+0x508/0x572 [] ieee80211_tasklet_handler+0x6d/0xff [] __tasklet_action+0xa1/0x112 [] tasklet_action+0x39/0x3b [] ksoftirqd+0x162/0x278 Which comes from: if (WARN_ON_ONCE(in_irq())) return -EDEADLK; This warning is surprising, as it clearly comes from a softirq context. The in_irq() definition looks like this on -rt: #define in_irq() (hardirq_count() || (current->flags & PF_HARDIRQ)) hardirq_count() is correct, but looking at PF_HARDIRQ's definition in sched.h: #define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ #define PF_HARDIRQ 0x08000020 /* hardirq context */ #define PF_NOSCHED 0x00000020 /* Userspace does not expect scheduling */ #define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ Reveals that due to a typo it not only overlaps the PF_NOSCHED bit, but also has a spurious 0x08000000 component. Move it to a free slot: 0x00000080. Reported-by: Clark Williams Signed-off-by: Ingo Molnar --- include/linux/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: tip/include/linux/sched.h =================================================================== --- tip.orig/include/linux/sched.h +++ tip/include/linux/sched.h @@ -1721,9 +1721,9 @@ extern cputime_t task_gtime(struct task_ #define PF_EXITING 0x00000004 /* getting shut down */ #define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ -#define PF_HARDIRQ 0x08000020 /* hardirq context */ #define PF_NOSCHED 0x00000020 /* Userspace does not expect scheduling */ #define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ +#define PF_HARDIRQ 0x00000080 /* hardirq context */ #define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ #define PF_DUMPCORE 0x00000200 /* dumped core */ #define PF_SIGNALED 0x00000400 /* killed by a signal */