Comment 3 for bug 1884262

Revision history for this message
zhao.shuai (zhao.shuai.neusoft) wrote :

By analyzing the Log && latest QAT Driver code (qat1.7.l.4.5.0-00034.tar.gz),
the basic sequence of the problem is as follows:

qat_rsa_init_tfm()
     |-->qat_crypto_get_instance_node(get_current_node());
            |-->topology_physical_package_id(smp_processor_id());
-----------------------
Preemptive risk point:
static inline int get_current_node(void)
{
 return topology_physical_package_id(smp_processor_id());
}
----------------------
Solutions waiting to be discussed:

diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h b/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h
index 35f0f44..bbe95d9 100644
--- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h
+++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h
@@ -100,7 +100,11 @@ struct service_hndl {

 static inline int get_current_node(void)
 {
- return topology_physical_package_id(smp_processor_id());
+ unsigned int cpu;
+ preempt_disable();
+ cpu = smp_processor_id();
+ preempt_enable();
+ return topology_physical_package_id(cpu);
 }

 int adf_service_register(struct service_hndl *service);
--
2.7.4
----------------------
Reference materials:
https://www.kernel.org/doc/Documentation/preempt-locking.txt