Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2101860rwd; Fri, 9 Jun 2023 06:46:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7GZYiRSn3BusTAv04YgATc8o9KZzy7Gu0w3w1u1HXtxV7Zzjiw7FYvBOdSl3aGROGVL6sf X-Received: by 2002:a05:6a21:32a2:b0:111:ee3b:59f1 with SMTP id yt34-20020a056a2132a200b00111ee3b59f1mr1697272pzb.0.1686318362652; Fri, 09 Jun 2023 06:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686318362; cv=none; d=google.com; s=arc-20160816; b=bDBy4EC+6SiQAtl0+9t+7/awE782F0RkU+VNjblcZ6TYyZmCitV7giRt2HX87uiKJV mmWe6dK7jx5tkjxWd/31C0mdnV8eeTkCDPmZe4BHdYlBCXOOSdyvc/bYKqYNlYl0qgAW RUHi10u9fmU31Vtfh1kMYLzObyhia34eykWcA+vVNprmritFc7e6eD61uW6xma4Xsm08 k1uQZTSxRbL20Wrl5zld8wMa0q7slHd6vM/LMAknmQU/VagiSlIigWDhh3X+yWhNPVEU 3MzVlFUu1xvqJUTL10iYXmp0krx5q4axW5Mg3gW9qFederhP0DDqC0y0CvzEGHarxDsl MdFw== 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=ShMlReLcXzU7TjduMTe837iTxsVD464HcLumwg46YRE=; b=T1vQD0nHJKm48GhdF+REuTTqpsB7iQxJO5gg7JnAflWnO87uHgp6k3ZP4kkw4CXIlD 05h1oaLDP9QLFEukVOn39v0sj/jxyb7qyRax130VSmGw5Sn1MoOWcOb7gwg5d9x5lvzg 6H0Ey9gBCtoLnu35hQ/+mEhAYo+NL9OyLKtZeRa8sNGcWtCF6PUVmRPLMW2wE+oMXbs8 gz7KsqbaZlGil6D24AlyZz9RiqCv6JvFkzuUnfjqjx0jsyikNtLWh3mT7IqGV/owC72M PEG2GfRLtAvKRPLc0SH4s6jqii8JtYWdwh8uM28i/hD+0xgGjBjApxF/UNFCmc6wfVMF ypEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wkKfaDpQ; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a63eb45000000b0053b8c98d14bsi2622380pgk.859.2023.06.09.06.45.48; Fri, 09 Jun 2023 06:46:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=@linuxfoundation.org header.s=korg header.b=wkKfaDpQ; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238987AbjFINlS (ORCPT + 99 others); Fri, 9 Jun 2023 09:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236150AbjFINlR (ORCPT ); Fri, 9 Jun 2023 09:41:17 -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 6AC753588; Fri, 9 Jun 2023 06:41:16 -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 F254A60EF4; Fri, 9 Jun 2023 13:41:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D794AC433EF; Fri, 9 Jun 2023 13:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686318075; bh=yjbSjmu9BKcOVBkALZ9aVw5SbohM/yF5/0fVveOk2Uk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wkKfaDpQt2SdpI3FmTZKILMbpvdN+jr3R5Qu/MXyusQxnrqylXhPSiT4Cl19gOdY1 d8QbhJPK/QtuMLzZuxM/keOSJTFy3eFpxi0dfEYYRlT9SfurNHZoPHSfJzBfaokBEv 5Dmzre1r/j+r1lO1wOmlD8fWHIfoMuRmIoJa6K1k= Date: Fri, 9 Jun 2023 15:41:12 +0200 From: Greg KH To: Xianting Tian Cc: arei.gonglei@huawei.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, herbert@gondor.apana.org.au, davem@davemloft.net, amit@kernel.org, arnd@arndb.de, marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Xianting Tian Subject: Re: [PATCH 1/3] virtio-crypto: fixup potential cpu stall when free unused bufs Message-ID: <2023060940-wrongdoer-wince-5701@gregkh> References: <20230609131817.712867-1-xianting.tian@linux.alibaba.com> <20230609131817.712867-2-xianting.tian@linux.alibaba.com> <2023060924-skinning-reset-e256@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2023060924-skinning-reset-e256@gregkh> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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-crypto@vger.kernel.org On Fri, Jun 09, 2023 at 03:39:24PM +0200, Greg KH wrote: > On Fri, Jun 09, 2023 at 09:18:15PM +0800, Xianting Tian wrote: > > From: Xianting Tian > > > > Cpu stall issue may happen if device is configured with multi queues > > and large queue depth, so fix it. > > > > Signed-off-by: Xianting Tian > > --- > > drivers/crypto/virtio/virtio_crypto_core.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c > > index 1198bd306365..94849fa3bd74 100644 > > --- a/drivers/crypto/virtio/virtio_crypto_core.c > > +++ b/drivers/crypto/virtio/virtio_crypto_core.c > > @@ -480,6 +480,7 @@ static void virtcrypto_free_unused_reqs(struct virtio_crypto *vcrypto) > > kfree(vc_req->req_data); > > kfree(vc_req->sgs); > > } > > + cond_resched(); > > that's not "fixing a stall", it is "call the scheduler because we are > taking too long". The CPU isn't stalled at all, just busy. > > Are you sure this isn't just a bug in the code? Why is this code taking > so long that you have to force the scheduler to run? This is almost > always a sign that something else needs to be fixed instead. And same comment on the other 2 patches, please fix this properly. Also, this is a tight loop that is just freeing memory, why is it taking so long? Why do you want it to take longer (which is what you are doing here), ideally it would be faster, not slower, so you are now slowing down the system overall with this patchset, right? thanks, greg k-h