From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E75E8C32771 for ; Sat, 24 Sep 2022 18:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231670AbiIXSvp (ORCPT ); Sat, 24 Sep 2022 14:51:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbiIXSvo (ORCPT ); Sat, 24 Sep 2022 14:51:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7951D4B0E3 for ; Sat, 24 Sep 2022 11:51:42 -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 0AE3D6108D for ; Sat, 24 Sep 2022 18:51:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD2D0C433D6; Sat, 24 Sep 2022 18:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664045501; bh=SBwsx2Bku90wjvj4IgO5Xqo4zAkx6rl0b66DMwcbMGY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZwZtgFJFFltPNgIZWHvHV5qMBgkjzx5U+w4yXqGuZBXAumrjLfGxVDQlpylrftX/e 9vyg0mDGe49kxU83E7fI4iEcJTmkL9NTwvMldW4akyCsisG4IfHhNgLUSgu3SG1y+f yNB8pqG2aIeNGzEshfrFrKAB/fUKsWsvhv029ZDyN3lZS9hCAzwSvQq8YB6JWKxQ7X t4uC/dZUxbRLdj5ZQklSw0NCilU1BP7ZXozXBtx00yHR6M6wqLzaWnp+Sqw/ocsLqK G07GDkPliR9CXmuzwk1ip14PBbm1DwLIkwPG9NHIGi+ZXA6b8i7rMA/dEY8ieDuj7+ yGek7qxVhiNwQ== Date: Sat, 24 Sep 2022 21:51:37 +0300 From: Leon Romanovsky To: Saeed Mahameed Cc: "David S . Miller" , Jakub Kicinski , Eric Dumazet , netdev@vger.kernel.org, Paolo Abeni Subject: Re: [PATCH net-next] net/mlx5: Make ASO poll CQ usable in atomic context Message-ID: References: <20220924172425.bfagbky4h5tbcxf4@fedora> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220924172425.bfagbky4h5tbcxf4@fedora> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, Sep 24, 2022 at 10:24:25AM -0700, Saeed Mahameed wrote: > On 24 Sep 14:17, Leon Romanovsky wrote: > > From: Leon Romanovsky > > > > Poll CQ functions shouldn't sleep as they are called in atomic context. > > The following splat appears once the mlx5_aso_poll_cq() is used in such > > flow. > > > > BUG: scheduling while atomic: swapper/17/0/0x00000100 > > ... > > > /* With newer FW, the wait for the first ASO WQE is more than 2us, put the wait 10ms. */ > > - err = mlx5_aso_poll_cq(aso, true, 10); > > + expires = jiffies + msecs_to_jiffies(10); > > + do { > > + err = mlx5_aso_poll_cq(aso, true); > > + } while (err && time_is_after_jiffies(expires)); > > mutex_unlock(&flow_meters->aso_lock); > ^^^^ > busy poll won't work, this mutex is held and can sleep anyway. > Let's discuss internally and solve this by design. This is TC code, it doesn't need atomic context and had mutex + sleep from the beginning. My change cleans mlx5_aso_poll_cq() from busy loop for the IPsec path, so why do you plan to change in the design? Thanks