From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54D48210B for ; Sat, 29 Jul 2023 11:07:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4833C433C8; Sat, 29 Jul 2023 11:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690628862; bh=XFPsoApbITff+ah69P91loWYngnR4L+QvZBYUA6T7PQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hURT3ZJmTVlc3jtqKmW8N+ECl58CT4W3hl6NDn2ah/vakPW7Gym1dnPvu8zpeBy6T 8WzjbuFyHe1PEt8aFUls7kfEQCQrv+a+ITy/QrndtsWVoVW9t7PrVK1gfTHMhq9n8a IYrhgjKWNwqNdH1F0yo2PazlAHcwp8BToy43YwhlBQPraHtfnVXOhTCQPbCa6mrfUF e8UCC1538yky3vBVAUl2or+Ncl0oKIpM5oqY9TmEwE2Z8t5W1FWUgRbXW+tw0ITE/g LEFKX2sr4CGTbLQ/ADYnE6RX0kwxgKihUDnt74j+y4lcD7Cl73NjWkTstg56gpe8Fv RWtrduuWvE4Wg== Date: Sat, 29 Jul 2023 13:07:38 +0200 From: Simon Horman To: Konstantin Khorenko Cc: Simon Horman , Jakub Kicinski , Manish Chopra , Ariel Elior , David Miller , Sudarsana Kalluru , netdev@vger.kernel.org, Paolo Abeni Subject: Re: [PATCH v2 1/1] qed: Fix scheduling in a tasklet while getting stats Message-ID: References: <20230727152609.1633966-1-khorenko@virtuozzo.com> <20230727152609.1633966-2-khorenko@virtuozzo.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230727152609.1633966-2-khorenko@virtuozzo.com> On Thu, Jul 27, 2023 at 06:26:09PM +0300, Konstantin Khorenko wrote: > Here we've got to a situation when tasklet called usleep_range() in PTT > acquire logic, thus welcome to the "scheduling while atomic" BUG(). > > BUG: scheduling while atomic: swapper/24/0/0x00000100 > > [] schedule+0x29/0x70 > [] schedule_hrtimeout_range_clock+0xb2/0x150 > [] schedule_hrtimeout_range+0x13/0x20 > [] usleep_range+0x4f/0x70 > [] qed_ptt_acquire+0x38/0x100 [qed] > [] _qed_get_vport_stats+0x458/0x580 [qed] > [] qed_get_vport_stats+0x1c/0xd0 [qed] > [] qed_get_protocol_stats+0x93/0x100 [qed] > qed_mcp_send_protocol_stats > case MFW_DRV_MSG_GET_LAN_STATS: > case MFW_DRV_MSG_GET_FCOE_STATS: > case MFW_DRV_MSG_GET_ISCSI_STATS: > case MFW_DRV_MSG_GET_RDMA_STATS: > [] qed_mcp_handle_events+0x2d8/0x890 [qed] > qed_int_assertion > qed_int_attentions > [] qed_int_sp_dpc+0xa50/0xdc0 [qed] > [] tasklet_action+0x83/0x140 > [] __do_softirq+0x125/0x2bb > [] call_softirq+0x1c/0x30 > [] do_softirq+0x65/0xa0 > [] irq_exit+0x105/0x110 > [] do_IRQ+0x56/0xf0 > > Fix this by making caller to provide the context whether it could be in > atomic context flow or not when getting stats from QED driver. > QED driver based on the context provided decide to schedule out or not > when acquiring the PTT BAR window. > > We faced the BUG_ON() while getting vport stats, but according to the > code same issue could happen for fcoe and iscsi statistics as well, so > fixing them too. > > Fixes: 6c75424612a7 ("qed: Add support for NCSI statistics.") > Fixes: 1e128c81290a ("qed: Add support for hardware offloaded FCoE.") > Fixes: 2f2b2614e893 ("qed: Provide iSCSI statistics to management") > Cc: Sudarsana Kalluru > Cc: David Miller > Cc: Manish Chopra > nit: no blank line here. > Signed-off-by: Konstantin Khorenko Reviewed-by: Simon Horman