QAT_Engine icon indicating copy to clipboard operation
QAT_Engine copied to clipboard

icp_sal_userStartMultiProcess() in a multi-threaded app ?

Open nanayak opened this issue 4 years ago • 5 comments

Hi,

This is more of a QAT sharing related query when using the QAT crypto engine in a multi-threaded process.

Would like to get an opinion on the following:

a. The question is for a multi-threaded process. Would like to create multiple (atleast a couple) user-defined sections in the QAT config to share across threads. For example: Thread-A will use the QAT (for SSL - using the crypto engine), Thread-B will also need to attach/init to QAT for a different purpose (maps to "User-Proc-Section-B" in QAT config).

b. I am wondering if there is a procedure to invoke "icp_sal_userStartMultiProcess()" from two threads and get them to init two different sections ("User-Proc-Section-A" and "User-Proc- Section-B) in the QAT config ?

c. My observation so far has been the following, QAT initialization for the process occurs on the first invocation of "icp_sal_userStartMultiProcess", the second invocation (from another thread) does not fail but it actually is more of a no-op. The initialization of QAT instances etc has already been done by the first call to "icp_sal_userStartMultiProcess", hence the second call does not read any instances or config from the QAT config file.

Given the above, it looks like the only approach to share the QAT in a process is to initialize once (icp_sal_userStartMultiProcess) for the process (maybe in main thread) and then share the instances across threads.

Appreciate any pointers. Thanks.

-- BR, nanayak

nanayak avatar Apr 28 '20 17:04 nanayak