Closed abalib closed 2 years ago
9.6.1.2 H_QUERY_NX_CAPABILITIES
@abalib According to the POWER ISA, a HCALL can only be executed from kernel space. In order to implement this, we first need the kernel to provide this information via an API.
Have you already discussed about this with Haren?
I didn't discuss this particular H_QUERY_NX_CAPABILITIES call with Haren.
He said will add a field to this struct https://github.com/libnxz/power-gzip/blob/develop/inc_nx/nx-gzip.h#L47 for PowerVM purposes. We won't be able to select a device (vas_id) in PowerVM. Perhaps we can use few other fields in that structure that are filled in at the time of open.
_vas_gzip_setup_attr this is the struct we fill when opening the device rc = ioctl(fd, VAS_GZIP_TX_WINOPEN, (unsigned long)&txattr); One idea is to return the 1M limit in the same struct. This is so that the library avoids a second kernel call after the ioctl. If you are going to export it through sysfs, I guess that is acceptable
Haren Myneni: let us try to export values through sysfs as much as possible. vas_gzip_setup_attr should be used to set values per specific window. Assume 1MB limit per call in the first release
Note: One of the test samples sends 4MB per call (1<<22). CC=3 is returned on PowerVM and since the sample code doesn't know how to adjust buffer sizes it aborts (but libnxz can handle this). We should update the test sample too.
@hmyneni just shared with me this value has been exported through sysfs:
One other change in tools/testing/selftests/powerpc/nx-gzip/gzfht_test.c : //chunk = 1<<22; chunk = 1048576;
cat /sys/devices/vio/ibm,compression-v1/NxGzCaps/req_max_processed_len 1048576
Fixed by #130
https://github.com/libnxz/power-gzip/blob/develop/lib/nx_zlib.c#L929 Per job length is set to 1MB.
On PowerVM consider doing an HCALL to get the job limits and set per_job_len to less than that.
libnxz will still function correctly without that query but it's good to have.