Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8139745ybn; Tue, 1 Oct 2019 03:56:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUOsUDjKVLDAtYcBW4CRpi4FjCtQFAt32I15Kh/kNqcMTM3SjCyX2IjxbwwEQvOJCdZud4 X-Received: by 2002:a17:906:4a11:: with SMTP id w17mr22809200eju.21.1569927408404; Tue, 01 Oct 2019 03:56:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569927408; cv=none; d=google.com; s=arc-20160816; b=hKEsJpJInbdZcBweb3Y6MZ2LJt+EdBcVUmY2LegT1jYqnZLHyyDr1W+f701Xw9vSm3 2yAL54wpOZq673E2xW/WYrPTBHPvxAB8uJfHGh6JWCbZG9yQMr6yWvMSydmB6hRPWUdR vIVhtg+om7fGhhZ8Jix3i3hgjleWQCQcJMrZQRt4xEdbLkzBtY0MWYsV8g8lIyAn/qTL Yr67QuVA15/PyyibAeqHw38M/ajERTaM29x3mP4iAeAdcHtqj4TlfZq0kO6P+RKq5G+C 7mzkg8rKxiTdq8XObfqrWO9qzWqhKVkWIO0nY53HmATUHlhT8lhoiFI1S+N/MGE+9KDA 03ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=5gJYpb2hs/H6MOmJ4HQdouDhL55RKqY1jLEDoXv6ZNw=; b=T87W7JqrW5v5fk/b1WahrKRncYwzhVlp25ypnokdoR4A1sz9EpGtv1vvEWj4PltM9/ kk1giujYURS3kXV3cioS3ys52MfWz9gNYuM+twkwQfrEHQxNMwkGpJJJ3jKxHyqDq1zq 2s0jBStxDeFGVBAfrVwcM/79q2v73kxvYjwf05hIowZhBwzsknG+i5JrUNVfNvoiO5bL nfTj3AgpXEJV8ZKEhmNMBBSu0McT17tP5gtQSZyqq68LWkixrIv6wWxtv8Y75Qmu8XXu 8FUsuTJFpeVJU9OdknHZiMb5cVYoiupvRjWdOanR6bTo+UQD4M4xAJHMWBCfHnN5iLR4 Vtfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M1tIb8Tf; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b27si8500957ede.233.2019.10.01.03.56.23; Tue, 01 Oct 2019 03:56:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M1tIb8Tf; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731342AbfJAKxI (ORCPT + 99 others); Tue, 1 Oct 2019 06:53:08 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:57503 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726885AbfJAKxI (ORCPT ); Tue, 1 Oct 2019 06:53:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1569927186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5gJYpb2hs/H6MOmJ4HQdouDhL55RKqY1jLEDoXv6ZNw=; b=M1tIb8Tfr7xR88wvV7Sf91KNFu28Yk5WkQ5s4645IxooLsVoFrvHu4N0JNt+KZRVmwp23T zIwPw6geGI+pykOQTihyBnl0vz7H8xHimN+0pFLPPMj1wd+g+UQLaYmimKikkVyxWNz8Q4 fga9Yyx6qRzkFPXog+t7scAOiF4zbFQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-131-zXTii9snNDqTtFYu7tjgpQ-1; Tue, 01 Oct 2019 06:53:03 -0400 Received: by mail-ed1-f72.google.com with SMTP id n14so8374883edt.3 for ; Tue, 01 Oct 2019 03:53:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=aM58yx80a+FhIQLxLs41jbjNWFaNvGrL/FnYLUpnwoo=; b=FS5iM+EKO4qAD72J6ed1mxG1WZrjzKQyWis1G7st0yKW8b6c8oRFZ+hfE6j38sdr4i hywWFDdcO18K2YB4UX88+03ga1XqdbiGZQtxUq3/zvy3C/Z0aOU2TET4XlLjS+S5NwiK F0uViUNy3c7JV+g54SM4IXJlmfvpSXq9P3zQ66W1oDtI5i/20P4vGnQkRZEWPPclYMUS 5mLJxwhcTCOzf9iORADAom5cMRM9kbZLpm8ytW7Zu0JUPM2gCHktigYWpUUIOSOu8byy 5JxSkZMv/90GhZmqv4KktLjlGEnscIGaZZ+qm/oNkn2R9uluRNkZRmKX+7y2SEiObkRQ kGJg== X-Gm-Message-State: APjAAAWgogJVvjD3TNfNGvkhKsrRxkN2hzxjt97ZVtT20qcA1PwIywOf XzzAIiIxl5squ9laJffkCybsFMfyyQjTKCDf/I/j+lxh2UUbaNimPUdPNbLQ1jUV+vH73jb4pWj 03aBflQwl43ApmuGcAu1qoki4YTg= X-Received: by 2002:a17:906:f08:: with SMTP id z8mr23869908eji.18.1569927182077; Tue, 01 Oct 2019 03:53:02 -0700 (PDT) X-Received: by 2002:a17:906:f08:: with SMTP id z8mr23869888eji.18.1569927181830; Tue, 01 Oct 2019 03:53:01 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id a36sm3069038edc.58.2019.10.01.03.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2019 03:53:01 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 8AB0B18063D; Tue, 1 Oct 2019 12:53:00 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Johannes Berg , linux-wireless@vger.kernel.org Cc: Johannes Berg , Jiri Kosina , Aaron Hill , Lukas Redlinger , Oleksii Shevchuk Subject: Re: [PATCH] mac80211: keep BHs disabled while calling drv_tx_wake_queue() In-Reply-To: <1569924485-I3e8838c5ecad878e59d4a94eb069a90f6641461a@changeid> References: <1569924485-I3e8838c5ecad878e59d4a94eb069a90f6641461a@changeid> X-Clacks-Overhead: GNU Terry Pratchett Date: Tue, 01 Oct 2019 12:53:00 +0200 Message-ID: <87blv0visz.fsf@toke.dk> MIME-Version: 1.0 X-MC-Unique: zXTii9snNDqTtFYu7tjgpQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Johannes Berg writes: > From: Johannes Berg > > Drivers typically expect this, as it's the case for almost all cases > where this is called (i.e. from the TX path). Also, the code in mac80211 > itself (if the driver calls ieee80211_tx_dequeue()) expects this as it > uses this_cpu_ptr() without additional protection. > > This should fix various reports of the problem: > https://bugzilla.kernel.org/show_bug.cgi?id=3D204127 > https://lore.kernel.org/linux-wireless/CAN5HydrWb3o_FE6A1XDnP1E+xS66d5kiE= uhHfiGKkLNQokx13Q@mail.gmail.com/ > https://lore.kernel.org/lkml/nycvar.YFH.7.76.1909111238470.473@cbobk.fhfr= .pm/ > > Reported-by: Jiri Kosina > Reported-by: Aaron Hill > Reported-by: Lukas Redlinger > Reported-by: Oleksii Shevchuk > Signed-off-by: Johannes Berg > --- > net/mac80211/util.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/mac80211/util.c b/net/mac80211/util.c > index 051a02ddcb85..ad1e88958da2 100644 > --- a/net/mac80211/util.c > +++ b/net/mac80211/util.c > @@ -273,9 +273,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_su= b_if_data *sdata, int ac) > =09=09=09=09=09=09&txqi->flags)) > =09=09=09=09continue; > =20 > -=09=09=09spin_unlock_bh(&fq->lock); > +=09=09=09spin_unlock(&fq->lock); > =09=09=09drv_wake_tx_queue(local, txqi); > -=09=09=09spin_lock_bh(&fq->lock); > +=09=09=09spin_lock(&fq->lock); Okay, so this will mean that the drv_wake_tx_queue() entry point will be called with bhs disabled. But there are lots of uses of spin_{,un}lock_bh() in tx.c: $ git grep lock_bh tx.c tx.c: spin_lock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_lock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_lock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); tx.c: spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); tx.c: spin_lock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_lock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_lock_bh(&sta->lock); tx.c: spin_unlock_bh(&sta->lock); tx.c: spin_lock_bh(&sta->lock); tx.c: spin_unlock_bh(&sta->lock); tx.c: spin_lock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_lock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_lock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_unlock_bh(&fq->lock); tx.c: spin_lock_bh(&local->active_txq_lock[ac]); tx.c: spin_unlock_bh(&local->active_txq_lock[ac]); tx.c: spin_lock_bh(&local->active_txq_lock[txq->ac]); tx.c: spin_unlock_bh(&local->active_txq_lock[txq->ac]); tx.c: spin_lock_bh(&local->active_txq_lock[ac]); tx.c: spin_unlock_bh(&local->active_txq_lock[ac]); tx.c: spin_unlock_bh(&local->active_txq_lock[ac]); tx.c: spin_lock_bh(&local->active_txq_lock[ac]); tx.c: spin_unlock_bh(&local->active_txq_lock[ac]); tx.c: spin_lock_bh(&local->tim_lock); tx.c: spin_unlock_bh(&local->tim_lock); so won't that mean that the driver still gets bhs re-enabled after (for instance) the first call to ieee80211_tx_dequeue()? I must admit that I'm a bit fuzzy on this whole bh/not-bh thing; I've mostly been cargo-culting the _bh variant of the locking... :) -Toke