Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2523044rdh; Wed, 27 Sep 2023 05:26:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtWcm80fWmP0szw5mTfb8eV8QI/DjVJ9356DeBvVDzvsPLfm9HqwIxMxsuKhfjECBeLUtt X-Received: by 2002:a05:6808:c6:b0:3a7:2efb:cb71 with SMTP id t6-20020a05680800c600b003a72efbcb71mr2059787oic.25.1695817611498; Wed, 27 Sep 2023 05:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695817611; cv=none; d=google.com; s=arc-20160816; b=Vs+kT73+k/wAXtctQaSa07FRUV1nRrn271qIG+eXxhvs+Q6LBEKOUO8Ipk3C6iPdo5 Dtz99XN3WEHdYfzm2LqWDYpt0kHBVyylbR1pVfTne+dTSDscH5L2zSwcytgd4lF2Ehvk BL0/V1WAavZ1W3trC7KoP1GQ0M1UdtO8eWF468uCpRdSjQxI49W08AP2znt6jsAJ620F o5Q99G9bXvTx/l3BMDElN58ibUvQmgJK418yDrVmZMSYnOiNZLcutmcj7qvKex+u58DL u+Y7cXU6XhtKy26Ob604cswqVkgdckYzgyv7yq2/CqwrUsWp3dAcahJREjSqicY3Nz46 ituA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:user-agent :references:organization:in-reply-to:subject:cc:to:from :dkim-signature; bh=iuruE1nulZgndw+cQHO0vj1TexCC3+sKU/XFHVoq3fQ=; fh=eTFFewECZk8jZ4bbeKI6vGC8GvVB2ugV5hqdeXk8Urk=; b=VHg1OeiPH7hIeKeyYCfSVI3fWEwO+0XVvFY7blR/xd/oT05Pn4Txc5Tv3uWHSXDy+a QDz8KAhIvpTmrtEBgN5Y4su/Ihxh5ITHe8+CBMgL/DkO5/5JR89F/piYmENgObcI7vc0 QVxPUsM3OcLitmUmKhfTMvcx9OoeXMG7/AmV3lIJrXE4oiInphy5mbp5I+gVT/DoAUiF lZ1YEziQMwShmYBS3R/P56Zy95mzPN5FhvsOCufezd85s2n16yDR9pf+HeW4Vt42uq/7 WrEzjy9tZN7euMommDklimfO0Z2hdfk/1O6hoAxMK6RI6Re6OYl+Oqy8gY11EMWq81GF TOJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bbbAi4MZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id v20-20020a056a00149400b006910e8e46e0si16914922pfu.371.2023.09.27.05.26.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 05:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bbbAi4MZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5C16480278C8; Wed, 27 Sep 2023 03:11:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231169AbjI0KKM (ORCPT + 99 others); Wed, 27 Sep 2023 06:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbjI0KKG (ORCPT ); Wed, 27 Sep 2023 06:10:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C701B6 for ; Wed, 27 Sep 2023 03:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695809329; 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: in-reply-to:in-reply-to:references:references; bh=iuruE1nulZgndw+cQHO0vj1TexCC3+sKU/XFHVoq3fQ=; b=bbbAi4MZTEGmpfStSCmsegtoVKFjJm6d738RTx52LcyREL8AgUjLRrab79oump1tbfYYya cxsM52sJZtLCxoMCEg1+yUkP8TmGHXCCc3AFSdo4brX+3sG5bXMzki2roLbS0Bk/d8g9Kr +VvsesakLsbbZuyfuvZDsxZGVlujpps= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-H03athJJOsSVs1ir8KZCwg-1; Wed, 27 Sep 2023 06:08:46 -0400 X-MC-Unique: H03athJJOsSVs1ir8KZCwg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 761551C06E14; Wed, 27 Sep 2023 10:08:45 +0000 (UTC) Received: from localhost (dhcp-192-239.str.redhat.com [10.33.192.239]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7773214026F7; Wed, 27 Sep 2023 10:08:44 +0000 (UTC) From: Cornelia Huck To: Halil Pasic , "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 Subject: Re: [PATCH] crypto: virtio-crypto: call finalize with bh disabled In-Reply-To: <20230926184158.4ca2c0c3.pasic@linux.ibm.com> Organization: "Red Hat GmbH, Sitz: Werner-von-Siemens-Ring 12, D-85630 Grasbrunn, Handelsregister: Amtsgericht =?utf-8?Q?M=C3=BCnchen=2C?= HRB 153243, =?utf-8?Q?Gesch=C3=A4ftsf=C3=BChrer=3A?= Ryan Barnhart, Charles Cachera, Michael O'Neill, Amy Ross" References: <1914739e2de14ed396e5674aa2d4766c@huawei.com> <20230926184158.4ca2c0c3.pasic@linux.ibm.com> User-Agent: Notmuch/0.37 (https://notmuchmail.org) Date: Wed, 27 Sep 2023 12:08:43 +0200 Message-ID: <877coc2aj8.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 27 Sep 2023 03:11:53 -0700 (PDT) On Tue, Sep 26 2023, Halil Pasic wrote: > [..] >> --- 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). > > I don't have any results on x86 yet. My current understanding is that the > virtio-pci transport code disables interrupts locally somewhere in the > call chain (actually in vp_vring_interrupt() via spin_lock_irqsave()) > and then x86 would be fine. But I will get that verified. > > On the other hand virtio_airq_handler() calls vring_interrupt() with > interrupts enabled. (While vring_interrupt() is called in a (read) > critical section in virtio_airq_handler() we use read_lock() and > not read_lock_irqsave() to grab the lock. Whether that is correct in > it self (i.e. disregarding the crypto problem) or not I'm not sure right > now. Will think some more about it tomorrow.) If the way to go forward > is disabling interrupts in virtio-ccw before vring_interrupt() is > called, I would be glad to spin a patch for that. virtio_airq_handler() is supposed to be an interrupt handler for an adapter interrupt -- as such I would expect it to always run with interrupts disabled (and I'd expect vring_interrupt() to be called with interrupts disabled as well; if that's not the case, I think it would need to run asynchronously.) At least that was my understanding at the time I wrote the code. > > Copying Conny, as she may have an opinion on this (if I'm not wrong she > authored that code). > > Regards, > Halil