diff mbox series

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

Message ID 20230609131817.712867-2-xianting.tian@linux.alibaba.com
State New
Headers show
Series fixup potential cpu stall | expand

Commit Message

Xianting Tian June 9, 2023, 1:18 p.m. UTC
From: Xianting Tian <tianxianting.txt@alibaba-inc.com>

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@linux.alibaba.com>
---
 drivers/crypto/virtio/virtio_crypto_core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Xianting Tian June 10, 2023, 3:20 a.m. UTC | #1
在 2023/6/9 下午11:57, Michael S. Tsirkin 写道:
> On Fri, Jun 09, 2023 at 09:18:15PM +0800, Xianting Tian wrote:
>> From: Xianting Tian <tianxianting.txt@alibaba-inc.com>
>>
>> Cpu stall issue may happen if device is configured with multi queues
>> and large queue depth, so fix it.
> What does "may happen" imply exactly?
> was this observed?
I didn't met such issue, this patch set just a theoretical fix.
>
>> Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
>> ---
>>   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();
>>   	}
>>   }
>>   
>> -- 
>> 2.17.1
Greg Kroah-Hartman June 10, 2023, 6:51 a.m. UTC | #2
On Sat, Jun 10, 2023 at 11:20:49AM +0800, Xianting Tian wrote:
> 
> 在 2023/6/9 下午11:57, Michael S. Tsirkin 写道:
> > On Fri, Jun 09, 2023 at 09:18:15PM +0800, Xianting Tian wrote:
> > > From: Xianting Tian <tianxianting.txt@alibaba-inc.com>
> > > 
> > > Cpu stall issue may happen if device is configured with multi queues
> > > and large queue depth, so fix it.
> > What does "may happen" imply exactly?
> > was this observed?
> I didn't met such issue, this patch set just a theoretical fix.

Then I would not recommend adding it at this time, as you just slowed
down the kernel for something that no one has reported :(

thanks,

greg k-h
diff mbox series

Patch

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();
 	}
 }