mbox series

[RFC,0/3] phb4/capp: Provide user tunable for STQ/DMA engine allocation

Message ID 20180909114140.9836-1-vaibhav@linux.ibm.com
Headers show
Series phb4/capp: Provide user tunable for STQ/DMA engine allocation | expand

Message

Vaibhav Jain Sept. 9, 2018, 11:41 a.m. UTC
When CAPP is initialized on request of CXL, opal reserves certain number
of PEC STQ/DMA engines needed for communication with the PSL/XSL on the card.
Since this allocation comes from the shared pool of PEC resources, it will have
an impact on the performance of a CAPI or PCI throughput.

Presently this allocation is statically defined in skiboot with CAPP init code
only taking into account the link width. However since different cards will
have will different workload properties hence it might be prudent to let user
tune these values to get an optimal performance for their CAPI workload.

Hence this patchset proposes a new scheme called 'capp attribute overrides'
that lets user set a nvram config to override the the number of DMA/STQ engines
opal reserves for CAPP. The nvram config is defined following a certain
convention to address multiple CAPPs present in the system.

The first patch "capp: Add ability to fetch CAPP attribute override values"
implements infrastructure in skiboot to search for an attribute override for
given CAPP in nvram. The subsequent two patches use this infrastructure to
implement override for number of STQ/DMA engines allocates to CAPP.


Vaibhav Jain (3):
  capp: Add ability to fetch CAPP attribute override values from nvram
  phb4/capp: Introduce 'stq-buffers' capp attribute override
  phb4/capp: Introduce 'dma-engines' capp attribute override

 hw/capp.c      |  50 +++++++++++++++++++++
 hw/phb4.c      | 118 ++++++++++++++++++++++++-------------------------
 include/capp.h |   2 +
 3 files changed, 110 insertions(+), 60 deletions(-)

Comments

Andrew Donnellan Sept. 9, 2018, 1:23 p.m. UTC | #1
On 09/09/18 21:41, Vaibhav Jain wrote:
> When CAPP is initialized on request of CXL, opal reserves certain number
> of PEC STQ/DMA engines needed for communication with the PSL/XSL on the card.
> Since this allocation comes from the shared pool of PEC resources, it will have
> an impact on the performance of a CAPI or PCI throughput.
> 
> Presently this allocation is statically defined in skiboot with CAPP init code
> only taking into account the link width. However since different cards will
> have will different workload properties hence it might be prudent to let user
> tune these values to get an optimal performance for their CAPI workload.
> 
> Hence this patchset proposes a new scheme called 'capp attribute overrides'
> that lets user set a nvram config to override the the number of DMA/STQ engines
> opal reserves for CAPP. The nvram config is defined following a certain
> convention to address multiple CAPPs present in the system.

While NVRAM attributes might be a good idea for bringup/enablement 
environments I think it's not ideal for doing device-specific 
configuration in production environments.

Would it be possible to expose this to Linux in the form of an 
additional OPAL API call, or does this need to be determined too early 
in the process? That would allow the allocation to be determined by the 
driver, where it's easier to add device-specific quirks.
Vaibhav Jain Sept. 10, 2018, 5:23 a.m. UTC | #2
Thanks for looking into these patches Andrew,

Andrew Donnellan <andrew.donnellan@au1.ibm.com> writes:

> While NVRAM attributes might be a good idea for bringup/enablement 
> environments I think it's not ideal for doing device-specific 
> configuration in production environments.
This is more likely AFU specific rather than device specific. Since the
split between coherent/dma traffic might be specific to an AFU hence its
difficult to comeup with an optimal default.

> Would it be possible to expose this to Linux in the form of an 
> additional OPAL API call, or does this need to be determined too early 
> in the process? That would allow the allocation to be determined by the 
> driver, where it's easier to add device-specific quirks.
Yes, but presently opal_pci_set_phb_capi_mode() is too restrictive and
we may need to add a new opal call to enable capi mode and providing it
with necessary info based on device quirks. But then too, it might not
be optimal for certain AFUs.

>
> -- 
> Andrew Donnellan              OzLabs, ADL Canberra
> andrew.donnellan@au1.ibm.com  IBM Australia Limited
Andrew Donnellan Sept. 10, 2018, 6:04 a.m. UTC | #3
On 10/09/18 15:23, Vaibhav Jain wrote:
> Thanks for looking into these patches Andrew,
> 
> Andrew Donnellan <andrew.donnellan@au1.ibm.com> writes:
> 
>> While NVRAM attributes might be a good idea for bringup/enablement
>> environments I think it's not ideal for doing device-specific
>> configuration in production environments.
> This is more likely AFU specific rather than device specific. Since the
> split between coherent/dma traffic might be specific to an AFU hence its
> difficult to comeup with an optimal default.

Right, when I say "device-specific" I'm really getting at "AFU 
specific", obviously for FPGA cards it's about the AFU not about the 
FPGA model.

By extension, if skiboot exposed this to Linux, Linux can in turn expose 
it via the driver or via the internal kernel API so that AFU-specific 
code can set it.
Vaibhav Jain Sept. 10, 2018, 9:01 a.m. UTC | #4
Andrew Donnellan <andrew.donnellan@au1.ibm.com> writes:

> On 10/09/18 15:23, Vaibhav Jain wrote:
>> Thanks for looking into these patches Andrew,
>> 
>> Andrew Donnellan <andrew.donnellan@au1.ibm.com> writes:
>> 
>>> While NVRAM attributes might be a good idea for bringup/enablement
>>> environments I think it's not ideal for doing device-specific
>>> configuration in production environments.
>> This is more likely AFU specific rather than device specific. Since the
>> split between coherent/dma traffic might be specific to an AFU hence its
>> difficult to comeup with an optimal default.
>
> Right, when I say "device-specific" I'm really getting at "AFU 
> specific", obviously for FPGA cards it's about the AFU not about the 
> FPGA model.
Ok thanks for clarifying this.

> By extension, if skiboot exposed this to Linux, Linux can in turn expose 
> it via the driver or via the internal kernel API so that AFU-specific 
> code can set it.
Agree, and this a similar model used for CX5 adapter init. However not
many AFU designers (atleast in case of CAPI2) will be writing there own
drivers and will rely on CXL module to interact with their cards. So it
would be better to expose this via CXL or some sysfs attribute to the
PCI bridge. This would also need a new opal call to init capp so that
can be send these values down to skiboot's capp init code.

The values are populated during the CAPP init that happens in middle of
the card probe. So their values are needed very early during the init
phase. Resetting them would need a re-init of CAPP.

>
> -- 
> Andrew Donnellan              OzLabs, ADL Canberra
> andrew.donnellan@au1.ibm.com  IBM Australia Limited
Frederic Barrat Sept. 11, 2018, 3:33 p.m. UTC | #5
Le 09/09/2018 à 13:41, Vaibhav Jain a écrit :
> When CAPP is initialized on request of CXL, opal reserves certain number
> of PEC STQ/DMA engines needed for communication with the PSL/XSL on the card.
> Since this allocation comes from the shared pool of PEC resources, it will have
> an impact on the performance of a CAPI or PCI throughput.
> 
> Presently this allocation is statically defined in skiboot with CAPP init code
> only taking into account the link width. However since different cards will
> have will different workload properties hence it might be prudent to let user
> tune these values to get an optimal performance for their CAPI workload.
> 
> Hence this patchset proposes a new scheme called 'capp attribute overrides'
> that lets user set a nvram config to override the the number of DMA/STQ engines
> opal reserves for CAPP. The nvram config is defined following a certain
> convention to address multiple CAPPs present in the system.
> 
> The first patch "capp: Add ability to fetch CAPP attribute override values"
> implements infrastructure in skiboot to search for an attribute override for
> given CAPP in nvram. The subsequent two patches use this infrastructure to
> implement override for number of STQ/DMA engines allocates to CAPP.
> 

I think the value is mostly for debug/lab experiments. We've been asked 
quite a few times to update those settings, and each time, it requires 
an updated skiboot, install, etc... On top of that, we always seem to 
get it wrong, so having a centralized point where we decide the dma 
engine and storage queue counts, then derive the capp setup and PEC 
setup seems better to me (instead of having 2 disconnected flows as it 
currently is).

As already mentioned, driving it from linux would require at least an 
new opal call. But the problem is that the driver doesn't really know 
what the optimum settings are for the AFU and it needs to be done early, 
leaving little time for customisation. I believe that to address it 
correctly, we'd need some PSL extension so that the AFU could report 
what it needs and that the driver could query. But since that's capi2, I 
wouldn't hold my breath.

   Fred

> Vaibhav Jain (3):
>    capp: Add ability to fetch CAPP attribute override values from nvram
>    phb4/capp: Introduce 'stq-buffers' capp attribute override
>    phb4/capp: Introduce 'dma-engines' capp attribute override
> 
>   hw/capp.c      |  50 +++++++++++++++++++++
>   hw/phb4.c      | 118 ++++++++++++++++++++++++-------------------------
>   include/capp.h |   2 +
>   3 files changed, 110 insertions(+), 60 deletions(-)
>