Re: [PATCH 1/3] virtio-crypto: fixup potential cpu stall when free unused bufs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <tianxianting.txt@xxxxxxxxxxxxxxx>
> > 
> > Cpu stall issue may happen if device is configured with multi queues
> > and large queue depth, so fix it.
> > 
> > Signed-off-by: Xianting Tian <xianting.tian@xxxxxxxxxxxxxxxxx>
> > ---
> >  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



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux