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 C59A9C4167B for ; Thu, 2 Nov 2023 13:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376384AbjKBNBR convert rfc822-to-8bit (ORCPT ); Thu, 2 Nov 2023 09:01:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbjKBNBP (ORCPT ); Thu, 2 Nov 2023 09:01:15 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D127C112; Thu, 2 Nov 2023 06:01:11 -0700 (PDT) Received: from dggpemm500019.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SLkX16wDrzVm1M; Thu, 2 Nov 2023 21:01:05 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500019.china.huawei.com (7.185.36.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 2 Nov 2023 21:01:09 +0800 Received: from dggpemm500006.china.huawei.com ([7.185.36.236]) by dggpemm500006.china.huawei.com ([7.185.36.236]) with mapi id 15.01.2507.031; Thu, 2 Nov 2023 21:01:09 +0800 From: "Gonglei (Arei)" To: Halil Pasic CC: Herbert Xu , "linux-crypto@vger.kernel.org" , Marc Hartmayer , "Michael S. Tsirkin" , Jason Wang , "virtualization@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "pizhenwei@bytedance.com" , Cornelia Huck Subject: RE: [PATCH] crypto: virtio-crypto: call finalize with bh disabled Thread-Topic: [PATCH] crypto: virtio-crypto: call finalize with bh disabled Thread-Index: AdnvwZyqMOU4LXJLQHSIVFGYJFXR5QAk7LIAADLTkZAHGvVqsA== Date: Thu, 2 Nov 2023 13:01:09 +0000 Message-ID: References: <1914739e2de14ed396e5674aa2d4766c@huawei.com> <20230926184158.4ca2c0c3.pasic@linux.ibm.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.149.11] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping Herbert. Thanks. > -----Original Message----- > From: Gonglei (Arei) > Sent: Wednesday, September 27, 2023 5:18 PM > To: 'Halil Pasic' > Cc: Herbert Xu ; linux-crypto@vger.kernel.org; > Marc Hartmayer ; Michael S. Tsirkin > ; Jason Wang ; > virtualization@lists.linux-foundation.org; linux-kernel@vger.kernel.org; > pizhenwei@bytedance.com; Cornelia Huck > Subject: RE: [PATCH] crypto: virtio-crypto: call finalize with bh disabled > > > > > -----Original Message----- > > From: Halil Pasic [mailto:pasic@linux.ibm.com] > > Sent: Wednesday, September 27, 2023 12:42 AM > > To: Gonglei (Arei) > > Cc: Herbert Xu ; > > linux-crypto@vger.kernel.org; Marc Hartmayer ; > > Michael S. Tsirkin ; Jason Wang > ; > > virtualization@lists.linux-foundation.org; > > linux-kernel@vger.kernel.org; pizhenwei@bytedance.com; Halil Pasic > > ; Cornelia Huck > > Subject: Re: [PATCH] crypto: virtio-crypto: call finalize with bh > > disabled > > > > [..] > > > --- a/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > > > +++ b/drivers/crypto/virtio/virtio_crypto_akcipher_algs.c > > > @@ -61,8 +61,9 @@ static void virtio_crypto_akcipher_finalize_req( > > > vc_akcipher_req->src_buf = NULL; > > > vc_akcipher_req->dst_buf = NULL; > > > virtcrypto_clear_request(&vc_akcipher_req->base); > > > - > > > + local_bh_disable(); > > > > > > crypto_finalize_akcipher_request(vc_akcipher_req->base.dataq->engine > > > , > > > req, err); > > > + local_bh_enable(); > > > > Thanks Gonglei! > > > > I did this a quick spin, and it does not seem to be sufficient on s390x. > > Which does not come as a surprise to me, because > > > > #define lockdep_assert_in_softirq() > > \ > > do > > { > > \ > > WARN_ON_ONCE(__lockdep_enabled && > > \ > > (!in_softirq() || in_irq() || in_nmi())); \ > > } while (0) > > > > will still warn because in_irq() still evaluates to true (your patch > > addresses the !in_softirq() part). > > > You are right. > > So I think the core of this question is: Can we call crypto_finalize_request() in > the upper half of the interrupt? > If so, maybe we should introduce a new function, such as > lockdep_assert_in_interrupt(). > > #define lockdep_assert_in_interrupt() \ > do { \ > WARN_ON_ONCE(__lockdep_enabled && !in_interrupt()); \ > } while (0) > > If not, why? > > Herbert, do you have any suggestions? Thanks. > > > Regards, > -Gonglei >