Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3431449pxb; Mon, 4 Apr 2022 16:48:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPNLgCHZSttcgRx5iRsHWugpEawLD9BuBOAhl2Q9ABLNvzcE0zPbBAn0F5n3Fqy3j+ZpPf X-Received: by 2002:a63:6a41:0:b0:386:5d6f:a643 with SMTP id f62-20020a636a41000000b003865d6fa643mr521829pgc.169.1649116082530; Mon, 04 Apr 2022 16:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649116082; cv=none; d=google.com; s=arc-20160816; b=FiDXXuAfSlaSjGe8fZWTfraKqYlu6Ql3hYWIiBv1+cFkHcHS68BM3IhOA/L1ykVWYN Uo8ESiemukBNTyF93+VFDJsQTQVar1giEUfrcrjNjw5i1pN/wL799JT6tvlxs5qNWmkz 8Fi7BmVtTEABMRisNVB+4gYMyjf3nfigBvyOYxTxdwm/D+Eu2/cdo7l4vJg4FIHv816h 8Q6OtMUKkRDV/hZ/wqDhHETpPyphZf5TGtwgU18g3xH6u5KdLSlZYo3UrwQcOFFxocPT Z0qeyNWeAsomqjVxip4KoKkhflTwDG756tUINCzkcMXGCKK5qaYVVo2aS319HSWt+MG7 Y5rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=4eyOOj1vOFuP0XMQ1EZmTvABGeICZ85D2/5XTsbw8mg=; b=fz0DcEzXZZCSuLQ1U5Wxj8Yn7w5H84SY092Y4GjIqiFa1fofsL1czD63McylD/cMa3 IQgeCcoSxkZVa2XOX6PsrjA4dBBao9VxFeZVatn1v1BPP/eCy8Ul4ijR8LpxKE5Pdd7M Gn7h1WhvVBwHMABTRuDbGMD06CPM4eNZGd0nC1+1n+uibzTPQy2XU1oc51m+Z3KRkhrf VNCBOP7dPm0lmxvs72o8rL7fErHQSJ+lDU+bWMyaNcWxP2RMJOVdnu3JVUrm0QlZu2iN SKYks79SOkNTEBFRsKRwRN7vfdftYnRB4WMArkTV9wuOH5oUduY01xsBXfWAp2jtDg6g TcoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cgXWqFg1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t6-20020a170902e84600b00153ba5786bfsi12494762plg.437.2022.04.04.16.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:48:02 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cgXWqFg1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 01CBF33E15; Mon, 4 Apr 2022 16:34:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356869AbiDCLKf (ORCPT + 99 others); Sun, 3 Apr 2022 07:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233544AbiDCLKd (ORCPT ); Sun, 3 Apr 2022 07:10:33 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C2017666 for ; Sun, 3 Apr 2022 04:08:39 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id qh7so4484917ejb.11 for ; Sun, 03 Apr 2022 04:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=4eyOOj1vOFuP0XMQ1EZmTvABGeICZ85D2/5XTsbw8mg=; b=cgXWqFg1UKZRWHAfxScb7y024+HG8naz7HJUBYsvmtkIXs2gqC2g638RR3l40mU2jS X4PA/g5bBcaEgW+qcTC/UBKUh7V25/l4G1Zl+luiUUgAnBh5ObHCFSXtY8i62PjeUwdR 3K1HLijJlk2FGsNVjU06bWvwY10gLvTXeADDuzwjmZ5/daB9J8YYl4x6BbugRjAC1fik Sd6Ofu2AEuvE8A+jHkamrIzvGD3X+UVagc+GauzPpkNUPA2Tvr3f3Gkl2hzsCFUPg68Y SfJ3o8LG12h0m/68O24EQB8qNVesfLnd+oREkWfLa00stA/Eh1J92ZbdMJXtnxfSYY20 rELQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=4eyOOj1vOFuP0XMQ1EZmTvABGeICZ85D2/5XTsbw8mg=; b=T1tRY3YHZq90x6fujaseS1MCbRbwpQs3/Rd9Rm/mtPqKOE/C54gQiIchWAp4CRCmD2 ZHHz9QDE7Ec+4wLM8RHnAgnUoBkRTe/V5nxvEw6321Y2oahagUYH1qHIslq4C2kf/Siu ffFYAPaAl8JJSm5jNdr6CaVf/b/K8pMeAf4yCEOtm4V22h/aZLYr5+wf198IlooxctIP tJKLY++TIvsL/KvlRzTi1s6CUQw4MilOPrAOhwTP4sEly9LiJxIiSqy8smOejNMdEjqh tQUfnfj7cRp5PRLkayuINF2OGXh1VTjO/JnzxrU/P/4oJWYXLcM112/OqWO3+bc8MMie SW7A== X-Gm-Message-State: AOAM531eGvjb2AAoDwrUQ+TbMq6t2GHNbPJlAdzTme6DSlMeQb0ZKZcJ 7sDdq6kKDJAu0cy5IJH+ffE= X-Received: by 2002:a17:907:7d8d:b0:6df:f3a6:b0d9 with SMTP id oz13-20020a1709077d8d00b006dff3a6b0d9mr6850742ejc.13.1648984117751; Sun, 03 Apr 2022 04:08:37 -0700 (PDT) Received: from [192.168.0.253] (ip5f5abb55.dynamic.kabel-deutschland.de. [95.90.187.85]) by smtp.gmail.com with ESMTPSA id s6-20020a170906778600b006dfc5be1ce0sm3206171ejm.146.2022.04.03.04.08.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Apr 2022 04:08:36 -0700 (PDT) Message-ID: <942bbcb6-725d-9b47-5dfe-f105d30ea6b7@gmail.com> Date: Sun, 3 Apr 2022 13:08:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: staging: r8188eu: how to handle nested mutex under spinlock Content-Language: en-US To: "Fabio M. De Francesco" Cc: Greg KH , Larry Finger , Phillip Potter , "open list:STAGING SUBSYSTEM" , Linux Kernel Mailing List References: <356c24cf-625b-eea2-2c04-ce132d881cac@gmail.com> <4389354.LvFx2qVVIh@leap> <1813843.tdWV9SEqCh@leap> From: Michael Straube In-Reply-To: <1813843.tdWV9SEqCh@leap> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 4/3/22 12:49, Fabio M. De Francesco wrote: > On domenica 3 aprile 2022 12:43:04 CEST Fabio M. De Francesco wrote: >> On sabato 2 aprile 2022 22:47:27 CEST Michael Straube wrote: >>> Hi all, >>> >>> smatch reported a sleeping in atomic context. >>> >>> rtw_set_802_11_disassociate() <- disables preempt >>> -> _rtw_pwr_wakeup() >>> -> ips_leave() >>> >>> rtw_set_802_11_disassociate() takes a spinlock and ips_leave() uses a >>> mutex. >>> >>> I'm fairly new to the locking stuff, but as far as I know this is not a >>> false positive since mutex can sleep, but that's not allowed under a >>> spinlock. >>> >>> What is the best way to handle this? >>> I'm not sure if converting the mutex to a spinlock (including all the >>> other places where the mutex is used) is the right thing to do? >>> >>> thanks, >>> Michael >>> >> Hi Michael, >> >> No, this is a false positive: ips_leave is never called under spinlocks. >> Some time ago I blindly trusted Smatch and submitted a patch for what you >> are reporting just now again. Soon after submission I realized it and >> then I had to ask Greg to discard my patch. >> >> Please read the related thread: >> >> [PATCH] staging: r8188eu: Use kzalloc() with GFP_ATOMIC in atomic context >> https://lore.kernel.org/lkml/20220206225943.7848-1-fmdefrancesco@gmail.com/ >> >> Thanks, >> >> Fabio > > I'm sorry, the correct link is the following: > [PATCH v2 2/2] staging: r8188eu: Use kzalloc() with GFP_ATOMIC in atomic context > https://lore.kernel.org/lkml/20220208180426.27455-3-fmdefrancesco@gmail.com/ > > Fabio > Hi Fabio, Ah I see now, thanks. Well, I think the code is not very clear and easy to follow here. Perhaps we should refactor this area someday to avoid future confusions. regards, Michael