Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3516212pxb; Mon, 4 Apr 2022 19:33:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfUynBOtc9CR/b1OjLE2FApss4l9G8eQaIm0869jxAYJRqifzuIDfJ/6CjVMReMXZpSLTy X-Received: by 2002:a17:902:d714:b0:153:2e9:3bcc with SMTP id w20-20020a170902d71400b0015302e93bccmr1252301ply.83.1649125996845; Mon, 04 Apr 2022 19:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649125996; cv=none; d=google.com; s=arc-20160816; b=iwq+N19ZOqcR8jLKiMx9pyp8WO3ZAEvNIvB8QJBrzoQEBxYgyhKB3XYSHhUVb2InNr JPAxHZSFA2+WIJrrrB2fVn3viUZYdKMN1R0Vxtros9RC+CkvCv2/94VGShsCFl8I1HES pQHi9bAl+353adE/6TIXELPgkivVhZ2MdsMbdLxfOZWvG2eHn7TELtNsDx3dU3ovcPhM za23xfEQ6azXrQnahA+UMYQkYF2QBROpI2Pig3xeNMy3nZs6Ik7OD/4uOnLuz/040Vca BHHc/9w0hgpttsVByUxUeXjps0FRq6yKb9NeOgDtktzmk5C0xn444vXWmZD9raiCqCf+ Fbmw== 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=QaKZqz8gJE1qe33eHsaYAKuzr4In/J4ciy0i99MvKqc=; b=F78ZDRMoY2VHBOSsuy4Jszr0s3AuFo4L2TrUQWbHhKcVYDjV+Hj0E/sESSrtVJhrlb ShCphODvq2L1fwTLNDHNjrXbhJ/EH5k8zVU6stC/f8p/fMLn6KbynjGDBKDLW7uaRD1Z I7tcjc7ZUVJUfZDI5F3/Ki+0lixdHLyv2awaAxbpaKB6zOHFsV7Uncng3yuPAlGhWSWr 3im1FswxPkDwm4hEf/81Mhu1Mq9+bsJ0/rlFSX+zcSoCdqlkaPtxqMgRAA3/a9pipe87 a9khy3WL0jGYauUcFIloItPcxTK8q096sQU5tTsnEGN225iEmM35ZqTUqo88XU9DjJxJ vg+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GAmnS0ip; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mh6-20020a17090b4ac600b001bd14e01f4csi820957pjb.58.2022.04.04.19.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:33:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GAmnS0ip; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 D7B2DECB3E; Mon, 4 Apr 2022 17:56:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232745AbiDBVPw (ORCPT + 99 others); Sat, 2 Apr 2022 17:15:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231334AbiDBVPw (ORCPT ); Sat, 2 Apr 2022 17:15:52 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 956ED17E20 for ; Sat, 2 Apr 2022 14:13:59 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id d5so10669087lfj.9 for ; Sat, 02 Apr 2022 14:13:59 -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=QaKZqz8gJE1qe33eHsaYAKuzr4In/J4ciy0i99MvKqc=; b=GAmnS0ip/T3wLkz/ApnSMSBM2P9vtOlPl0eEi0yjY4MEq6oWfRPTcCi1fxZ+wfR9Yb vMXaufdzR03LTtwRUN+wXDE8zBC3BO0eOZPj3HB39JABha10yb63hslqDeEET5ub+yCn lojCN3kzxwY3uJ4tc81jXhmvzxWSnMgX+pQcy7y91hn6KTgqXTfJ8QioBzOTp7LemkJG bYz7HpqRntwME02jOlnwZS3BtQakBBlQVeczbw8TQm5vQSI7vJLvdNkdn4MEExsRoUyl 4MGsC47fsnjGg/LJDl1y9PKJESaV9hZFL3zHbKXmQGjAw+WTbenyi4qpEChBdYw6T/S3 CcUw== 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=QaKZqz8gJE1qe33eHsaYAKuzr4In/J4ciy0i99MvKqc=; b=PcbYb1YCBnG8Tdwlv/cCBiMvG9Fl7i3X731M8P/AYaWI1JC9H+gKB4B4WBlkobVnaH tFFfnXOfw1Fjonce0p9wRCOq82H7mtvAdDgVA7C6ua0KCQbYllqbT+O3TYvNjDTkaqjV AZEAW8B4x61B5ik55v3TRXmAdNwynigFnsDX4R6gjg77NgMAJ9kCKnkqrmoTvltNuCsL GaMYjZp76OXwJQAEQGJROyb9fR10ICrtEZ3o5gljIu0VJfeeVNmKb9O3lEDIF03bfaZi 5wugTzHFPItyUpGltltWX5h7zvAk9auJGkI/BLikNn6+NZx60kUWS3ZcF9nkkhJzk965 DLyQ== X-Gm-Message-State: AOAM530pntlXNr2Dfm2vdHYeRxgAJX2+ZHSUAMGLwDkGvi/0FVyBtGgX jSW1IA24onLYBHAwUkiH40U= X-Received: by 2002:a05:6512:16a2:b0:448:1fbb:8ca1 with SMTP id bu34-20020a05651216a200b004481fbb8ca1mr18023319lfb.125.1648934037132; Sat, 02 Apr 2022 14:13:57 -0700 (PDT) Received: from [192.168.1.11] ([46.235.67.247]) by smtp.gmail.com with ESMTPSA id n12-20020a19ef0c000000b0044a2aea14bdsm616812lfh.277.2022.04.02.14.13.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 02 Apr 2022 14:13:56 -0700 (PDT) Message-ID: Date: Sun, 3 Apr 2022 00:13:55 +0300 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: Michael Straube Cc: Larry Finger , Phillip Potter , "open list:STAGING SUBSYSTEM" , Linux Kernel Mailing List , Greg KH References: <356c24cf-625b-eea2-2c04-ce132d881cac@gmail.com> From: Pavel Skripkin In-Reply-To: <356c24cf-625b-eea2-2c04-ce132d881cac@gmail.com> 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 Hi Michael, On 4/2/22 23:47, 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? > I've looked into this like a month ago. IMO, this code just need to be redesigned, since locking scheme is very complicated there and, as smatch says, not correct. Simple s/mutex_lock/spin_lock/ may work in that case, but one day locking scheme should be reworked... Or just some code parts should be dropped :)) With regards, Pavel Skripkin