Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp472029imw; Wed, 13 Jul 2022 01:53:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sgWgmeD89yZKiMcIn/X/1dDouFlUJFQSohfD7Pbc2XjatCR2jFRv8kV/9vokPvRG6tQDyY X-Received: by 2002:a63:b1e:0:b0:3fd:43d9:5354 with SMTP id 30-20020a630b1e000000b003fd43d95354mr2115645pgl.294.1657702428531; Wed, 13 Jul 2022 01:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657702428; cv=none; d=google.com; s=arc-20160816; b=CEzS+Lwtg6koIWsWt/VAnqGKmFzOW6QxqLtwkk/YziRwrVQ13oxcr4lwoVVXiywyGl 9dOoNJ+LyGvMVFkpwwOD/RuQ1eGorT6eQnsaq5fFzlZfNuzQvBewAhfkBzdSFpQjZ871 ZL+DzhLmoANQEpvXonHNE+e1mv1r57EQyyY7y9K8G3fomL7iIl/zt57kxKBPy4nuz9qT ZEz8szJq7EH/rS5CbpCFmxEEKurpjsZsY2ZB3ljSKr4uvvkyfb/Eeuc4O9vTe2n1oEy7 kaUhvL8FZXS0cTyTWXvt6gBda23N39Riaew4bvMxghHjfQOUQWh+2VEn7QEPw2oPY0fK 23uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:in-reply-to:reply-to :date:subject:cc:to:from:user-agent:references:dkim-signature :dkim-signature; bh=CcsBBbemJwPnREj8tUcGtqYBeLDK85WV0Rb0buPzp3s=; b=wgymR2ObI0gq1EmcKzKJIoRNN9Ddt+613Sa4n0ZH++XOQnsOyDKq6XDbpIK6Jq5Es+ zfsii9oxxgbempJ/kTRKXtZ8xZqn35ZoNvcEmMzoQNjj0h9P3fxch5aO8swjQkij3wpA 0ovmcujOP5gE33NRmYEPjvTFwDVbBb1tujGe/O22KPmBULKE9+yW0OogqVEJCT1rDi0E oT9ews3E3IuAGJ2Nm3wis/dG4hL8iDOfSySPJY5TDv5VubPMW+hoQOCkD9HHatflCnct HRQRL50p+jEN32fnIc0S4rmKPsihBJ03IpO1bx6brHgDjY6pNUjzdw+I+V9WkzhSu80e Jxfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="BJ/2pHkX"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020aa79af0000000b0052ac608e797si13827463pfp.177.2022.07.13.01.53.36; Wed, 13 Jul 2022 01:53:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="BJ/2pHkX"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235636AbiGMIfk (ORCPT + 99 others); Wed, 13 Jul 2022 04:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235582AbiGMIfh (ORCPT ); Wed, 13 Jul 2022 04:35:37 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B51DA58D0; Wed, 13 Jul 2022 01:35:37 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 4B64B1FD4C; Wed, 13 Jul 2022 08:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657701334; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CcsBBbemJwPnREj8tUcGtqYBeLDK85WV0Rb0buPzp3s=; b=BJ/2pHkXbNnHfTFeBIIZK9+C7zTuLNqlfrU5AON0AgJDEBieZg/cptr5j4lSS/Tth2GZh5 uTTDK6JayWctFwZVWdAzcIMoe1cRbOEyqznFtt3Io4SkUf29BmMApL/9YZ4yawoXTVuWCf erYJs5aGcZo5a/6X98xFnRLAQa4ADEA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657701334; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CcsBBbemJwPnREj8tUcGtqYBeLDK85WV0Rb0buPzp3s=; b=29egoYKkhz8DyFsT88GI2fB5xWVcR3WZlWzZxkJDRz32bg0P8E5Vfsut9piqSGhsjFOuvx Z82YwHDwj+9CZZBQ== Received: from g78 (unknown [10.163.24.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4DBB22C141; Wed, 13 Jul 2022 08:35:33 +0000 (UTC) References: <87wncknkfe.fsf@suse.de> User-agent: mu4e 1.6.10; emacs 28.1 From: Richard Palethorpe To: Dario Binacchi Cc: kernel test robot , lkp@intel.com, lkp@lists.01.org, Jeroen Hofstee , LKML , linux-can@vger.kernel.org, Linux Memory Management List , Marc Kleine-Budde , ltp@lists.linux.it Subject: Re: [LTP] [can] c4e54b063f: BUG:sleeping_function_called_from_invalid_context_at_kernel/workqueue.c Date: Wed, 13 Jul 2022 09:23:28 +0100 Reply-To: rpalethorpe@suse.de In-reply-to: Message-ID: <87v8s1l8a3.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, Dario Binacchi writes: > Hello, > > On Mon, Jul 11, 2022 at 10:05 AM Richard Palethorpe wrote: >> >> Hello, >> >> kernel test robot writes: >> >> > Greeting, >> > >> > FYI, we noticed the following commit (built with gcc-11): >> > >> > commit: c4e54b063f42f20a6b3ad1ffa61c574e631e0216 ("can: slcan: use CAN network device driver API") >> > https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git >> > master >> >> I guess the problem is this may sleep with soft irqs disabled. >> >> static int slc_close(struct net_device *dev) >> { >> struct slcan *sl = netdev_priv(dev); >> int err; >> >> spin_lock_bh(&sl->lock); <-- takes lock >> if (sl->tty) { >> if (sl->can.bittiming.bitrate && >> sl->can.bittiming.bitrate != CAN_BITRATE_UNKNOWN) { >> spin_unlock_bh(&sl->lock); >> err = slcan_transmit_cmd(sl, "C\r"); >> spin_lock_bh(&sl->lock); >> if (err) >> netdev_warn(dev, >> "failed to send close command 'C\\r'\n"); >> } >> >> /* TTY discipline is running. */ >> clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); >> } >> netif_stop_queue(dev); >> close_candev(dev); <-- calls cancel_delayed_work_sync() >> > > I would try (since I am unable to replicate the test) to move the > spin_unlock_bh() > before calling close_candev(). I haven't tried, but I think it should replicate every time with lockdep/lock debugging enabled. > Can the patch be sent now or do I have to wait until the code is in > mainline? IMO it *has* to be fixed before going into mainline :-p. I can't comment on the correctness of the proposed fix though. -- Thank you, Richard.