Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7139122rwr; Tue, 25 Apr 2023 08:35:14 -0700 (PDT) X-Google-Smtp-Source: AKy350abE4b+pkwAktjbsBE5r0ujuV7a/1XanHfq0LOggJS4WcDWqAAQPlAYI7NBy58mL4HyCyt3 X-Received: by 2002:a17:902:e943:b0:1a6:5fa2:3293 with SMTP id b3-20020a170902e94300b001a65fa23293mr18403704pll.56.1682436914268; Tue, 25 Apr 2023 08:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682436914; cv=none; d=google.com; s=arc-20160816; b=0EbH7F/VYIZZbd6aGQ7Y537QG64nQNY2YTMOJ7n2ZpiP5b0UMXA6yNchDbb3l4QKvf byG+U9gY1HhRF2iPqBhiEDE3mr7hjKvUphe5HKAwmfJEmcETD6xtlyATX9O559fsZ8sV hsg6pHcKQybO1+E9aJb7ep0PCyyR6W2RvbD2BqT/BRHW6zDGOnxiDYdpC/9AJuk9ME18 Qy/vO3bqHJHZU62VQr1Bu4JiNJfTNWN2tLNdHVASIFR0ilQyuOkNX5zUnrdaLo4v6Z+r oIf5ecDB4iHybqSZri0TkELJTRy6+4szBm9EDSPahDoZ+I22gnwG01znhPjPm24hB2a5 6KjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ii5Gida/3igMrMalrpEPLgX2Or2IUtmbEEpPP4BiPyI=; b=C1AQZWxG+dLB+MX8EL87FwwCd5kVOuJXrTRCJUxea5rxWRqU/bYEL9v/SXfreekwNl s+bjvHmhAE89n/UATK0IcCSCWBuhBqAwsw982NrzoLsj37BJcYDNz65/Fa0mgBsj6TvY LMw3huNPfJiXdB8jcHtQrwnNn7LGSsgDeebKZBjGnQDlgVlXkImJT4Jwh21rFPX9gpuB so7VxzhBfFgjoFJFSmTOdKMJrOckmBGtqaLExvSBol59hySANatfLd4VSudMxSv5U2Yl ChwcAqbFex3gV+/9ue1TqX69ZZDhbUKh2m7C3TGUTFAIRuQTeYNnfQ1JPoqQb9b1+MI6 PZEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dJnw5W5I; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p18-20020a170902ebd200b001a6ef92d441si10731290plg.599.2023.04.25.08.35.02; Tue, 25 Apr 2023 08:35:14 -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=@kernel.org header.s=k20201202 header.b=dJnw5W5I; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234495AbjDYPeD (ORCPT + 99 others); Tue, 25 Apr 2023 11:34:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233685AbjDYPeC (ORCPT ); Tue, 25 Apr 2023 11:34:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C806A5F5; Tue, 25 Apr 2023 08:34:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 07C7B62EB3; Tue, 25 Apr 2023 15:34:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA429C433EF; Tue, 25 Apr 2023 15:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682436840; bh=OARleUAyajgwQosFGKsXcoGf5T0vXiZRIsLkdB7bnYE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dJnw5W5IQCT/YQeMxKHb+5Rvzd919/iRVjelMnbeE/qG0QY/xds0rMbpW1YRyVzSM dZYw2mbT1FPz3GuXwPw1U/KBn+nm5DNKAJutlanzC+Y0dUVi/6ImLguEIzhVC/A8RL /8TCaSynE8HzSp/E1LBAEoNGpu2nkmw166V4xCMZ27CEkzp4zNIQOgpS+QnscjiAUQ 1BEi5Du+AFr5sYV1Kj7xJjoPkvzauBK06g9GLgg5vk/rhYqQJWWRjTF8zvPdQBFNmD AOpxPGuH4Jdp1DkIe4y3dbulsrc9PCQRgyTka+FUFZRtTQ9On0CRP0ecPKRZCNNiBM xO10sUm1RwnEA== Date: Tue, 25 Apr 2023 18:33:53 +0300 From: Leon Romanovsky To: Mirsad Goran Todorovac Cc: Johannes Berg , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Gregory Greenman , Alexander Wetzel Subject: Re: [PATCH v3 1/1] wifi: mac80211: fortify the spinlock against deadlock by interrupt Message-ID: <20230425153353.GB27649@unreal> References: <20230425093547.1131-1-mirsad.todorovac@alu.unizg.hr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230425093547.1131-1-mirsad.todorovac@alu.unizg.hr> X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Tue, Apr 25, 2023 at 11:35:48AM +0200, Mirsad Goran Todorovac wrote: > In the function ieee80211_tx_dequeue() there is a particular locking > sequence: > > begin: > spin_lock(&local->queue_stop_reason_lock); > q_stopped = local->queue_stop_reasons[q]; > spin_unlock(&local->queue_stop_reason_lock); > > However small the chance (increased by ftracetest), an asynchronous > interrupt can occur in between of spin_lock() and spin_unlock(), > and the interrupt routine will attempt to lock the same > &local->queue_stop_reason_lock again. > > This will cause a costly reset of the CPU and the wifi device or an > altogether hang in the single CPU and single core scenario. > > This is the probable trace of the deadlock: > > Apr 10 00:58:33 marvin-IdeaPad-3-15ITL6 kernel: Possible unsafe locking scenario: > Apr 10 00:58:33 marvin-IdeaPad-3-15ITL6 kernel: CPU0 > Apr 10 00:58:33 marvin-IdeaPad-3-15ITL6 kernel: ---- > Apr 10 00:58:33 marvin-IdeaPad-3-15ITL6 kernel: lock(&local->queue_stop_reason_lock); > Apr 10 00:58:33 marvin-IdeaPad-3-15ITL6 kernel: > Apr 10 00:58:33 marvin-IdeaPad-3-15ITL6 kernel: lock(&local->queue_stop_reason_lock); > Apr 10 00:58:33 marvin-IdeaPad-3-15ITL6 kernel: > *** DEADLOCK *** Can you please add to the commit message whole lockdep trace? And please trim "Apr 10 00:58:33 marvin-IdeaPad-3-15ITL6 kernel: " line prefix, it doesn't add any value. Thanks