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 5 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

Hi nanayak As an initial response I would refer you to https://01.org/sites/default/files/downloads//336210-012-intel-qat-swpg.pdf document pages 48, sction 5.2.4.1 icp_sal_userStart on page 72, page 74 section 5.2.5.1 icp_sal_getDevVersionInfo in which the function icp_sal_userStartMultiProcess is discussed. I can only refer you to the QAT driver team rather than QAT engine if you have further queries about this function.

Regards, paulturx

paulturx avatar Apr 29 '20 14:04 paulturx

Hi paulturx,

Thanks for response! I did check the sections mentioned, however looks like I will need to get in touch with the driver team for specifics. Do you know anyone in the driver team who could provide an authoritative feedback ?

-- Thanks & Regards, nanayak

nanayak avatar Apr 29 '20 17:04 nanayak

Hi nanayak We've emailed one of our QAT driver developers. He has come back with the following response pasted below. Please take a look and if there are any further queries please get back to us and we will forward your issue to another QAT driver engineer:-

"If they have 2 different process name in config say SSL & SSL1 then those two process can be started and used in two different threads or as two different process."

Regards, paulturx

paulturx avatar Apr 30 '20 14:04 paulturx

Hi nanayak Our QAT driver developer has come back with some additional information. He refers you to section 4.5 of the above document, i.e., https://01.org/sites/default/files/downloads//336210-012-intel-qat-swpg.pdf, in which it has details about 2 user space sections SSL and IPSEC. Although the in the document these are 2 separate processes, our engineer confirms that they can be threads instead. I hope this helps.

Regards, paulturx

paulturx avatar May 01 '20 13:05 paulturx

Thanks paulturx for all the information! Will re-verify and get back.

nanayak avatar May 01 '20 17:05 nanayak