accel-config: Add wq ats_disable support
Xiaochen Shen
cover accel-config: Add wq ats_disable support
Upstream kernel 5.11 introduced ATS disable knob for work queues in commit 92de5fa2dc39 ("dmaengine: idxd: add ATS disable knob for work queues"). Accel-config needs to add support to match kernel driver change.
Add wq ats_disable support in library, configuration file, json interface, and config-wq command.
Add unit test and documentation for wq option ats_disable.
Xiaochen Shen (5):
accel-config: Add ats_disable wq function in lib
accel-config: Add ats_disable in config and json
accel-config: Add ats_disable attr to config-wq command
accel-config: Add ats_disable unit test
accel-config: Add documentation for wq option ats-disable
Documentation/accfg/accel-config-config-wq.txt | 6 ++++++ accfg/config.c | 1 + accfg/config_attr.c | 16 ++++++++++++++++ accfg/lib/libaccel-config.sym | 6 ++++++ accfg/lib/libaccfg.c | 3 +++ accfg/lib/private.h | 1 + accfg/libaccel_config.h | 3 +++ test/dsa.c | 1 + test/dsa.h | 1 + test/libaccfg.c | 12 ++++++++++++ util/json.c | 4 ++++ 11 files changed, 54 insertions(+)
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH 1/5 accel-config: Add ats_disable wq function in lib
Add new library functions:accfg_wq_get_ats_disbleaccfg_wq_set_ats_disble
--- accfg/lib/libaccel-config.sym | 6 ++++++ accfg/lib/libaccfg.c | 3 +++ accfg/lib/private.h | 1 + accfg/libaccel_config.h | 3 +++ 4 files changed, 13 insertions(+)
accfg/lib/libaccel-config.sym +6 -0
@@ -141,3 +141,9 @@ global: accfg_remove_mdev; accfg_device_get_mdev_enabled; } LIBACCFG_6; + +LIBACCFG_8 { +global: + accfg_wq_get_ats_disable; + accfg_wq_set_ats_disable; +} LIBACCFG_7;
accfg/lib/libaccfg.c +3 -0
@@ -699,6 +699,7 @@ static void *add_wq(void *parent, int id, const char *wq_base, wq->threshold =accfg_get_param_long (ctx, dfd,"threshold" ); wq->max_batch_size =accfg_get_param_long (ctx, dfd,"max_batch_size" ); wq->max_transfer_size =accfg_get_param_long (ctx, dfd,"max_transfer_size" ); + wq->ats_disable =accfg_get_param_long (ctx, dfd,"ats_disable" );wq_parse_type (wq, wq_type);free (wq_type);
@@ -2088,6 +2089,7 @@ accfg_wq_set_field(wq, val, group_id) accfg_wq_set_field(wq, val, block_on_fault) accfg_wq_set_field(wq, val, threshold) accfg_wq_set_field(wq, val, max_batch_size) +accfg_wq_set_field(wq, val, ats_disable)#define accfg_wq_set_long_field (wq, val, field) \ ACCFG_EXPORT int accfg_wq_set_##field( \
@@ -2213,6 +2215,7 @@ accfg_wq_get_field(wq, priority) accfg_wq_get_field(wq, threshold) accfg_wq_get_field(wq, group_id) accfg_wq_get_field(wq, block_on_fault) +accfg_wq_get_field(wq, ats_disable) ACCFG_EXPORT int accfg_wq_set_mode(struct accfg_wq *wq,enum accfg_wq_mode wq_mode)
accfg/lib/private.h +1 -0
@@ -125,6 +125,7 @@ struct accfg_wq {char *state;unsigned int max_batch_size;unsigned long max_transfer_size; +int ats_disable; };#define ACCFG_EXPORT __attribute__ ((visibility("default")))
accfg/libaccel_config.h +3 -0
@@ -103,6 +103,7 @@ struct wq_parameters {int block_on_fault;unsigned int max_batch_size;unsigned long max_transfer_size; +int ats_disable;const char *mode;const char *type;const char *name;
@@ -260,6 +261,7 @@ unsigned int accfg_wq_get_max_batch_size(struct accfg_wq *wq);unsigned long accfg_wq_get_max_transfer_size (struct accfg_wq *wq);int accfg_wq_get_threshold (struct accfg_wq *wq);int accfg_wq_get_clients (struct accfg_wq *wq); +int accfg_wq_get_ats_disable (struct accfg_wq *wq);int accfg_wq_is_enabled (struct accfg_wq *wq);int accfg_wq_set_size (struct accfg_wq *wq,int val);int accfg_wq_set_priority (struct accfg_wq *wq,int val);
@@ -267,6 +269,7 @@ int accfg_wq_set_group_id(struct accfg_wq *wq, int val);int accfg_wq_set_threshold (struct accfg_wq *wq,int val);int accfg_wq_set_block_on_fault (struct accfg_wq *wq,int val);int accfg_wq_set_max_batch_size (struct accfg_wq *wq,int val); +int accfg_wq_set_ats_disable (struct accfg_wq *wq,int val);int accfg_wq_set_max_transfer_size (struct accfg_wq *wq,unsigned long val);int accfg_wq_set_str_mode (struct accfg_wq *wq,const char * val);int accfg_wq_set_mode (struct accfg_wq *wq,enum accfg_wq_mode mode);
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH 2/5 accel-config: Add ats_disable in config and json
In reply to Xiaochen ShenAdd support for ats_disable field in wq_table Add support for ats_disable attribute in json interface
--- accfg/config.c | 1 + util/json.c | 4 ++++ 2 files changed, 5 insertions(+)
accfg/config.c +1 -0
@@ -101,6 +101,7 @@ static const struct wq_set_table wq_table[] = { { "max_transfer_size", NULL, accfg_wq_set_max_transfer_size, NULL, NULL }, { "threshold", accfg_wq_set_threshold, NULL, NULL, is_wq_threshold_writable }, + { "ats_disable", accfg_wq_set_ats_disable, NULL, NULL, NULL }, }; static const struct engine_set_table engine_table[] = {
util/json.c +4 -0
@@ -444,6 +444,10 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,if (jobj)json_object_object_add (jaccfg,"max_batch_size" , jobj); + jobj =json_object_new_int (accfg_wq_get_ats_disable (wq)); +if (jobj) +json_object_object_add (jaccfg,"ats_disable" , jobj); + jobj =json_object_new_int64 (accfg_wq_get_max_transfer_size (wq));if (jobj)json_object_object_add (jaccfg,"max_transfer_size" , jobj);
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH 3/5 accel-config: Add ats_disable attr to config-wq command
In reply to Xiaochen ShenAdd ats_disable wq attribute to config-wq command.
--- accfg/config_attr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
accfg/config_attr.c +16 -0
@@ -37,6 +37,7 @@ static struct wq_parameters wq_param = { .threshold = INT_MAX, .max_batch_size = INT_MAX, .max_transfer_size = INT_MAX, + .ats_disable = INT_MAX, };static struct engine_parameters engine_param;
@@ -188,6 +189,13 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,return -EINVAL ; } +if (wq_params->ats_disable >1 + && (wq_params->ats_disable !=INT_MAX )) { +fprintf (stderr, +"valid ats-disable should be either 0 or 1\n" ); +return -EINVAL ; + } +if (wq_params->mode) { rc =accfg_wq_set_str_mode (wq, wq_params->mode);if (rc <0 )
@@ -249,6 +257,12 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,return rc; } +if (wq_params->ats_disable !=INT_MAX ) { + rc =accfg_wq_set_ats_disable (wq, wq_params->ats_disable); +if (rc <0 ) +return rc; + } +return 0 ; }
@@ -437,6 +451,8 @@ int cmd_config_wq(int argc, const char **argv, void *ctx) "specify max-batch-size used by wq"),OPT_U64 ('x' ,"max-transfer-size" , &wq_param.max_transfer_size,"specify max-transfer-size used by wq" ), +OPT_INTEGER ('a' ,"ats-disable" , &wq_param.ats_disable, +"specify ats-disble by wq" ), OPT_END(), };
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH 4/5 accel-config: Add ats_disable unit test
In reply to Xiaochen ShenAdd ats_disable to wq parameters for config test.
--- test/dsa.c | 1 + test/dsa.h | 1 + test/libaccfg.c | 12 ++++++++++++ 3 files changed, 14 insertions(+)
test/dsa.c +1 -0
@@ -179,6 +179,7 @@ int dsa_alloc(struct dsa_context *ctx, int shared) ctx->bof =accfg_wq_get_block_on_fault (ctx->wq); ctx->wq_max_batch_size =accfg_wq_get_max_batch_size (ctx->wq); ctx->wq_max_xfer_size =accfg_wq_get_max_transfer_size (ctx->wq); + ctx->ats_disable =accfg_wq_get_ats_disable (ctx->wq); ctx->max_batch_size =accfg_device_get_max_batch_size (dev); ctx->max_xfer_size =accfg_device_get_max_transfer_size (dev);
test/dsa.h +1 -0
@@ -85,6 +85,7 @@ struct dsa_context {int bof;unsigned int wq_max_batch_size;unsigned long wq_max_xfer_size; +int ats_disable;int is_batch;union {
test/libaccfg.c +12 -0
@@ -84,6 +84,7 @@ static struct wq_parameters wq00_param = { .threshold = 15, .max_batch_size = 1, .max_transfer_size = 1, + .ats_disable = 0, .mode = "shared", .type ="user" , .name = "myapp1"
@@ -96,6 +97,7 @@ static struct wq_parameters wq01_param = { .block_on_fault = 0, .max_batch_size = (1 << 4), .max_transfer_size = (1l << 16), + .ats_disable = 0, .mode = "dedicated", .type ="user" , .name = "myapp2"
@@ -110,6 +112,7 @@ static struct wq_parameters wq02_param = { .threshold = 8, .max_batch_size = (1 << 8), .max_transfer_size = (1l << 30), + .ats_disable = 0, .mode = "shared", .type ="user" , .name = "guest1"
@@ -122,6 +125,7 @@ static struct wq_parameters wq03_param = { .block_on_fault = 0, .max_batch_size = (1 << 9), .max_transfer_size = (1l << 31), + .ats_disable = 0, .mode = "dedicated", .type ="user" , .name = "guest2"
@@ -138,6 +142,7 @@ static struct wq_parameters wq12_param = { .threshold = 50, .max_batch_size = 1, .max_transfer_size = 1, + .ats_disable = 0, .mode = "shared", .type ="user" , .name = "myapp3"
@@ -151,6 +156,7 @@ static struct wq_parameters wq13_param = { .threshold = 50, .max_batch_size = 1, .max_transfer_size = 1, + .ats_disable = 0, .mode = "shared", .type ="user" , .name = "myapp3"
@@ -164,6 +170,7 @@ static struct wq_parameters wq14_param = { .threshold = 50, .max_batch_size = 1, .max_transfer_size = 1, + .ats_disable = 0, .mode = "shared", .type ="user" , .name = "myapp3"
@@ -352,6 +359,7 @@ static int config_wq(struct accfg_ctx *ctx, int dev_id, int wq_id,accfg_wq_set_block_on_fault (wq, wq_param.block_on_fault);accfg_wq_set_max_batch_size (wq, wq_param.max_batch_size);accfg_wq_set_max_transfer_size (wq, wq_param.max_transfer_size); +accfg_wq_set_ats_disable (wq, wq_param.ats_disable);if (wq_param.threshold)accfg_wq_set_threshold (wq, wq_param.threshold); }
@@ -413,6 +421,10 @@ static int check_wq(struct accfg_ctx *ctx, int dev_id, int wq_id,fprintf (stderr,"check wq failed on wq name\n" );return -EINVAL ; } +if (wq_param.ats_disable !=accfg_wq_get_ats_disable (wq)) { +fprintf (stderr,"check_wq failed on ats_disable\n" ); +return -EINVAL ; + } } }
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH 5/5 accel-config: Add documentation for wq option ats-disable
In reply to Xiaochen ShenAdd man pages for config-wq option ats-disable.
--- Documentation/accfg/accel-config-config-wq.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/accfg/accel-config-config-wq.txt +6 -0
@@ -84,5 +84,11 @@ OPTIONS max_transfer_size attribute under device. If the value is not a power of 2, it will be rounded up to the next power of 2. +-a:: +--ats-disable:: + toggle whether ATS disable is turned on for the work queue. The value + should be either 0 or 1. 0 indicates ATS is on, and 1 indicates ATS is + off for the work queue. + include::../copyright.txt[]
Signature · 1 line
1.8.3.1
Thomas
Hi Xiaochen,
Could you please rebase this to the latest in the pending branch of
https://github.com/intel/idxd-config?
Thanks,
Ramesh
Quoted 31 lines · Xiaochen Shen
Upstream kernel 5.11 introduced ATS disable knob for work queues in commit
92de5fa2dc39("dmaengine: idxd: add ATS disable knob for work queues"). Accel-config needs to add support to match kernel driver change.Add wq
ats_disablesupport in library, configuration file, json interface, and config-wq command.
Add unit test and documentation for wq optionats_disable.Xiaochen Shen (5):
accel-config: Addats_disablewq function in lib
accel-config: Addats_disablein config and json
accel-config: Addats_disableattr to config-wq command
accel-config: Addats_disableunit test
accel-config: Add documentation for wq option ats-disableDocumentation/accfg/accel-config-config-wq.txt | 6 ++++++ accfg/config.c | 1 + accfg/config_attr.c | 16 ++++++++++++++++ accfg/lib/libaccel-config.sym | 6 ++++++ accfg/lib/libaccfg.c | 3 +++ accfg/lib/private.h | 1 + accfg/libaccel_config.h | 3 +++ test/dsa.c | 1 + test/dsa.h | 1 + test/libaccfg.c | 12 ++++++++++++ util/json.c | 4 ++++ 11 files changed, 54 insertions(+)--
1.8.3.1
Shen
Hi Ramesh,
No problem, I will rebase and resend these patches soon. Thank you.
Best regards,
Xiaochen
-----Original Message-----
From: Thomas, Ramesh <ramesh.thomas(a)intel.com>
Sent: Friday, July 9, 2021 1:59
To: Shen, Xiaochen <xiaochen.shen(a)intel.com>; accel-config(a)lists.01.org
Cc: Shen, Xiaochen <xiaochen.shen(a)intel.com>; Jiang, Dave <dave.jiang(a)intel.com>
Subject: RE: [PATCH 0/5] accel-config: Add wq ats_disable support
Hi Xiaochen,
Could you please rebase this to the latest in the pending branch of https://github.com/intel/idxd-config?
Thanks,
Ramesh
Quoted 31 lines · Xiaochen Shen
Upstream kernel 5.11 introduced ATS disable knob for work queues in commit
92de5fa2dc39("dmaengine: idxd: add ATS disable knob for work queues"). Accel-config needs to add support to match kernel driver change.Add wq
ats_disablesupport in library, configuration file, json interface, and config-wq command.
Add unit test and documentation for wq optionats_disable.Xiaochen Shen (5):
accel-config: Addats_disablewq function in lib
accel-config: Addats_disablein config and json
accel-config: Addats_disableattr to config-wq command
accel-config: Addats_disableunit test
accel-config: Add documentation for wq option ats-disableDocumentation/accfg/accel-config-config-wq.txt | 6 ++++++ accfg/config.c | 1 + accfg/config_attr.c | 16 ++++++++++++++++ accfg/lib/libaccel-config.sym | 6 ++++++ accfg/lib/libaccfg.c | 3 +++ accfg/lib/private.h | 1 + accfg/libaccel_config.h | 3 +++ test/dsa.c | 1 + test/dsa.h | 1 + test/libaccfg.c | 12 ++++++++++++ util/json.c | 4 ++++ 11 files changed, 54 insertions(+)--
1.8.3.1
Xiaochen Shen
v2 cover accel-config: Add wq ats_disable support
In reply to Xiaochen ShenUpstream kernel 5.11 introduced ATS disable knob for work queues in commit 92de5fa2dc39 ("dmaengine: idxd: add ATS disable knob for work queues"). Accel-config needs to add support to match kernel driver change.
Add wq ats_disable support in library, configuration file, json interface, and config-wq command.
Add unit test and documentation for wq option ats_disable.
Changelog:
v2:
- Rebase to the latest in the pending branch (v3.3).
Xiaochen Shen (5):
accel-config: Add ats_disable wq function in lib
accel-config: Add ats_disable in config and json
accel-config: Add ats_disable attr to config-wq command
accel-config: Add ats_disable unit test
accel-config: Add documentation for wq option ats-disable
Documentation/accfg/accel-config-config-wq.txt | 6 ++++++ accfg/config.c | 1 + accfg/config_attr.c | 16 ++++++++++++++++ accfg/lib/libaccel-config.sym | 6 ++++++ accfg/lib/libaccfg.c | 3 +++ accfg/lib/private.h | 1 + accfg/libaccel_config.h | 3 +++ test/dsa.c | 1 + test/dsa.h | 1 + test/libaccfg.c | 9 +++++++++ util/json.c | 4 ++++ 11 files changed, 51 insertions(+)
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH v2 1/5 accel-config: Add ats_disable wq function in lib
Add new library functions:accfg_wq_get_ats_disbleaccfg_wq_set_ats_disble
--- accfg/lib/libaccel-config.sym | 6 ++++++ accfg/lib/libaccfg.c | 3 +++ accfg/lib/private.h | 1 + accfg/libaccel_config.h | 3 +++ 4 files changed, 13 insertions(+)
accfg/lib/libaccel-config.sym +6 -0
@@ -149,3 +149,9 @@ LIBACCFG_9 { global: accfg_device_get_op_cap; } LIBACCFG_8; + +LIBACCFG_10 { +global: + accfg_wq_get_ats_disable; + accfg_wq_set_ats_disable; +} LIBACCFG_9;
accfg/lib/libaccfg.c +3 -0
@@ -733,6 +733,7 @@ static void *add_wq(void *parent, int id, const char *wq_base, wq->threshold =accfg_get_param_long (ctx, dfd,"threshold" ); wq->max_batch_size =accfg_get_param_long (ctx, dfd,"max_batch_size" ); wq->max_transfer_size =accfg_get_param_long (ctx, dfd,"max_transfer_size" ); + wq->ats_disable =accfg_get_param_long (ctx, dfd,"ats_disable" );wq_parse_type (wq, wq_type);free (wq_type);
@@ -2174,6 +2175,7 @@ accfg_wq_set_field(wq, val, group_id) accfg_wq_set_field(wq, val, block_on_fault) accfg_wq_set_field(wq, val, threshold) accfg_wq_set_field(wq, val, max_batch_size) +accfg_wq_set_field(wq, val, ats_disable)#define accfg_wq_set_long_field (wq, val, field) \ ACCFG_EXPORT int accfg_wq_set_##field( \
@@ -2299,6 +2301,7 @@ accfg_wq_get_field(wq, priority) accfg_wq_get_field(wq, threshold) accfg_wq_get_field(wq, group_id) accfg_wq_get_field(wq, block_on_fault) +accfg_wq_get_field(wq, ats_disable) ACCFG_EXPORT int accfg_wq_set_mode(struct accfg_wq *wq,enum accfg_wq_mode wq_mode)
accfg/lib/private.h +1 -0
@@ -126,6 +126,7 @@ struct accfg_wq {char *state;unsigned int max_batch_size;uint64_t max_transfer_size; +int ats_disable; };#define ACCFG_EXPORT __attribute__ ((visibility("default")))
accfg/libaccel_config.h +3 -0
@@ -107,6 +107,7 @@ struct wq_parameters {int block_on_fault;unsigned int max_batch_size;uint64_t max_transfer_size; +int ats_disable;const char *mode;const char *type;const char *name;
@@ -265,6 +266,7 @@ unsigned int accfg_wq_get_max_batch_size(struct accfg_wq *wq);uint64_t accfg_wq_get_max_transfer_size (struct accfg_wq *wq);int accfg_wq_get_threshold (struct accfg_wq *wq);int accfg_wq_get_clients (struct accfg_wq *wq); +int accfg_wq_get_ats_disable (struct accfg_wq *wq);int accfg_wq_is_enabled (struct accfg_wq *wq);int accfg_wq_set_size (struct accfg_wq *wq,int val);int accfg_wq_set_priority (struct accfg_wq *wq,int val);
@@ -272,6 +274,7 @@ int accfg_wq_set_group_id(struct accfg_wq *wq, int val);int accfg_wq_set_threshold (struct accfg_wq *wq,int val);int accfg_wq_set_block_on_fault (struct accfg_wq *wq,int val);int accfg_wq_set_max_batch_size (struct accfg_wq *wq,int val); +int accfg_wq_set_ats_disable (struct accfg_wq *wq,int val);int accfg_wq_set_max_transfer_size (struct accfg_wq *wq,uint64_t val);int accfg_wq_set_str_mode (struct accfg_wq *wq,const char *val);int accfg_wq_set_mode (struct accfg_wq *wq,enum accfg_wq_mode mode);
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH v2 2/5 accel-config: Add ats_disable in config and json
In reply to Xiaochen ShenAdd support for ats_disable field in wq_table Add support for ats_disable attribute in json interface
--- accfg/config.c | 1 + util/json.c | 4 ++++ 2 files changed, 5 insertions(+)
accfg/config.c +1 -0
@@ -101,6 +101,7 @@ static const struct wq_set_table wq_table[] = { { "max_transfer_size", NULL, accfg_wq_set_max_transfer_size, NULL, NULL }, { "threshold", accfg_wq_set_threshold, NULL, NULL, is_wq_threshold_writable }, + { "ats_disable", accfg_wq_set_ats_disable, NULL, NULL, NULL }, }; static const struct engine_set_table engine_table[] = {
util/json.c +4 -0
@@ -457,6 +457,10 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,if (jobj)json_object_object_add (jaccfg,"threshold" , jobj); + jobj =json_object_new_int (accfg_wq_get_ats_disable (wq)); +if (jobj) +json_object_object_add (jaccfg,"ats_disable" , jobj); +if (!(flags &UTIL_JSON_SAVE )) {switch (wq_state) {
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH v2 3/5 accel-config: Add ats_disable attr to config-wq command
In reply to Xiaochen ShenAdd ats_disable wq attribute to config-wq command.
--- accfg/config_attr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
accfg/config_attr.c +16 -0
@@ -37,6 +37,7 @@ static struct wq_parameters wq_param = { .threshold = INT_MAX, .max_batch_size = INT_MAX, .max_transfer_size = INT_MAX, + .ats_disable = INT_MAX, };static struct engine_parameters engine_param;
@@ -191,6 +192,13 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,return -EINVAL ; } +if (wq_params->ats_disable >1 + && (wq_params->ats_disable !=INT_MAX )) { +fprintf (stderr, +"valid ats-disable should be either 0 or 1\n" ); +return -EINVAL ; + } +if (wq_params->mode) { rc =accfg_wq_set_str_mode (wq, wq_params->mode);if (rc <0 )
@@ -252,6 +260,12 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,return rc; } +if (wq_params->ats_disable !=INT_MAX ) { + rc =accfg_wq_set_ats_disable (wq, wq_params->ats_disable); +if (rc <0 ) +return rc; + } +return 0 ; }
@@ -411,6 +425,8 @@ int cmd_config_wq(int argc, const char **argv, void *ctx) "specify max-batch-size used by wq"),OPT_U64 ('x' ,"max-transfer-size" , &wq_param.max_transfer_size,"specify max-transfer-size used by wq" ), +OPT_INTEGER ('a' ,"ats-disable" , &wq_param.ats_disable, +"specify ats-disble by wq" ), OPT_END(), };
Signature · 1 line
1.8.3.1
Thomas
[Accel-config] Re: [PATCH v2 3/5] accel-config: Add ats_disable attr to config-wq command
Quoted 47 lines · Xiaochen Shen
Add
ats_disablewq attribute to config-wq command.Signed-off-by Xiaochen Shen <xiaochen.shen(a)intel.com>--- accfg/config_attr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)accfg/config_attr.c +14
-0@@ -37,6 +37,7 @@ static struct wq_parameters wq_param = { .threshold = INT_MAX, .max_batch_size = INT_MAX, .max_transfer_size = INT_MAX, + .ats_disable = INT_MAX, };static struct engine_parameters engine_param;@@ -191,6 +192,13 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,return -EINVAL ; } +if (wq_params->ats_disable >1 + && (wq_params->ats_disable !=INT_MAX )) { +fprintf (stderr, +"valid ats-disable should be either 0 or 1\n" ); +return -EINVAL ; + } +if (wq_params->mode) { rc =accfg_wq_set_str_mode (wq, wq_params->mode);if (rc <0 )@@ -252,6 +260,12 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,return rc; } +if (wq_params->ats_disable !=INT_MAX ) { + rc =accfg_wq_set_ats_disable (wq, wq_params->ats_disable); +if (rc <0 ) +return rc; + } +return 0 ; }
accfg/config_attr.c int cmd_config_wq(int argc, const char **argv, void *ctx) · line 429
Quoted 5 lines
accfg/config_attr.c +2
-0@@ -411,6 +425,8 @@ int cmd_config_wq(int argc, const char **argv, void *ctx) "specify max-batch-size used by wq"),OPT_U64 ('x' ,"max-transfer-size" , &wq_param.max_transfer_size,"specify max-transfer-size used by wq" ), +OPT_INTEGER ('a' ,"ats-disable" , &wq_param.ats_disable, + "specify ats-disble by wq"),
Maybe "specify per wq ats-disable"?
Quoted 5 lines
accfg/config_attr.c +0
-1OPT_END(), }; --1.8.3.1
Xiaochen Shen
[Accel-config] Re: [PATCH v2 3/5] accel-config: Add ats_disable attr to config-wq command
Hi Ramesh,
Quoted 7 lines · Ramesh
accfg/config_attr.c int cmd_config_wq(int argc, const char **argv, void *ctx) · line 429
Quoted 6 lines
accfg/config_attr.c +2
-0@@ -411,6 +425,8 @@ int cmd_config_wq(int argc, const char **argv, void *ctx) "specify max-batch-size used by wq"),OPT_U64 ('x' ,"max-transfer-size" , &wq_param.max_transfer_size,"specify max-transfer-size used by wq" ), +OPT_INTEGER ('a' ,"ats-disable" , &wq_param.ats_disable, + "specify ats-disble by wq"),Maybe "specify per wq ats-disable"?
This description is much better. Thank you!
Quoted 3 lines
Quoted 3 lines
accfg/config_attr.c +0
-0OPT_END(), };
Signature · 2 lines
Best regards, Xiaochen
Xiaochen Shen
PATCH v3 3/5 accel-config: Add ats_disable attr to config-wq command
In reply to Xiaochen ShenAdd ats_disable wq attribute to config-wq command.
--- accfg/config_attr.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
accfg/config_attr.c +16 -0
@@ -37,6 +37,7 @@ static struct wq_parameters wq_param = { .threshold = INT_MAX, .max_batch_size = INT_MAX, .max_transfer_size = INT_MAX, + .ats_disable = INT_MAX, };static struct engine_parameters engine_param;
@@ -191,6 +192,13 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,return -EINVAL ; } +if (wq_params->ats_disable >1 + && (wq_params->ats_disable !=INT_MAX )) { +fprintf (stderr, +"valid ats-disable should be either 0 or 1\n" ); +return -EINVAL ; + } +if (wq_params->mode) { rc =accfg_wq_set_str_mode (wq, wq_params->mode);if (rc <0 )
@@ -252,6 +260,12 @@ static int accel_config_parse_wq_attribs(struct accfg_device *device,return rc; } +if (wq_params->ats_disable !=INT_MAX ) { + rc =accfg_wq_set_ats_disable (wq, wq_params->ats_disable); +if (rc <0 ) +return rc; + } +return 0 ; }
@@ -411,6 +425,8 @@ int cmd_config_wq(int argc, const char **argv, void *ctx) "specify max-batch-size used by wq"),OPT_U64 ('x' ,"max-transfer-size" , &wq_param.max_transfer_size,"specify max-transfer-size used by wq" ), +OPT_INTEGER ('a' ,"ats-disable" , &wq_param.ats_disable, +"specify per wq ats-disble" ), OPT_END(), };
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH v2 4/5 accel-config: Add ats_disable unit test
In reply to Xiaochen ShenAdd ats_disable to wq parameters for config test.
--- test/dsa.c | 1 + test/dsa.h | 1 + test/libaccfg.c | 9 +++++++++ 3 files changed, 11 insertions(+)
test/dsa.c +1 -0
@@ -175,6 +175,7 @@ int dsa_alloc(struct dsa_context *ctx, int shared) ctx->bof =accfg_wq_get_block_on_fault (ctx->wq); ctx->wq_max_batch_size =accfg_wq_get_max_batch_size (ctx->wq); ctx->wq_max_xfer_size =accfg_wq_get_max_transfer_size (ctx->wq); + ctx->ats_disable =accfg_wq_get_ats_disable (ctx->wq); ctx->max_batch_size =accfg_device_get_max_batch_size (dev); ctx->max_xfer_size =accfg_device_get_max_transfer_size (dev);
test/dsa.h +1 -0
@@ -86,6 +86,7 @@ struct dsa_context {int bof;unsigned int wq_max_batch_size;unsigned long wq_max_xfer_size; +int ats_disable;int is_batch;union {
test/libaccfg.c +9 -0
@@ -68,6 +68,7 @@ static struct wq_parameters wq00_param = { .threshold = 15, .max_batch_size = 16, .max_transfer_size = 16, + .ats_disable = 0, .mode = "shared", .type ="user" , .name = "myapp1"
@@ -80,6 +81,7 @@ static struct wq_parameters wq01_param = { .block_on_fault = 0, .max_batch_size = (1 << 4), .max_transfer_size = (1l << 16), + .ats_disable = 0, .mode = "dedicated", .type ="user" , .name = "myapp2"
@@ -93,6 +95,7 @@ static struct wq_parameters wq02_param = { .threshold = 8, .max_batch_size = (1 << 8), .max_transfer_size = (1l << 30), + .ats_disable = 0, .mode = "shared", .type ="mdev" , .name = "guest1"
@@ -105,6 +108,7 @@ static struct wq_parameters wq03_param = { .block_on_fault = 0, .max_batch_size = (1 << 9), .max_transfer_size = (1l << 31), + .ats_disable = 0, .mode = "dedicated", .type ="mdev" , .name = "guest2"
@@ -243,6 +247,7 @@ static int config_wq(struct accfg_ctx *ctx, struct accfg_device *device,SET_ERR (rc,accfg_wq_set_max_batch_size (wq, wq_param->max_batch_size));SET_ERR (rc,accfg_wq_set_max_transfer_size (wq, wq_param->max_transfer_size)); +SET_ERR (rc,accfg_wq_set_ats_disable (wq, wq_param->ats_disable));if (wq_param->threshold)SET_ERR (rc,accfg_wq_set_threshold (wq, wq_param->threshold));
@@ -291,6 +296,10 @@ static int check_wq(struct accfg_ctx *ctx, struct accfg_device *device,fprintf (stderr,"check wq failed on wq name\n" );return -EINVAL ; } +if (wq_param->ats_disable !=accfg_wq_get_ats_disable (wq)) { +fprintf (stderr,"check_wq failed on ats_disable\n" ); +return -EINVAL ; + }return 0 ; }
Signature · 1 line
1.8.3.1
Xiaochen Shen
PATCH v2 5/5 accel-config: Add documentation for wq option ats-disable
In reply to Xiaochen ShenAdd man pages for config-wq option ats-disable.
--- Documentation/accfg/accel-config-config-wq.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/accfg/accel-config-config-wq.txt +6 -0
@@ -84,5 +84,11 @@ OPTIONS max_transfer_size attribute under device. If the value is not a power of 2, it will be rounded up to the next power of 2. +-a:: +--ats-disable:: + toggle whether ATS disable is turned on for the work queue. The value + should be either 0 or 1. 0 indicates ATS is on, and 1 indicates ATS is + off for the work queue. + include::../copyright.txt[]
Signature · 1 line
1.8.3.1
Thomas
The change looks ok to me.
-Ramesh
Quoted 38 lines · Xiaochen Shen
Upstream kernel 5.11 introduced ATS disable knob for work queues in commit
92de5fa2dc39("dmaengine: idxd: add ATS disable knob for work queues"). Accel-config needs to add support to match kernel driver change.Add wq
ats_disablesupport in library, configuration file, json interface, and config-wq command.
Add unit test and documentation for wq optionats_disable.Changelog:
v2:
- Rebase to the latest in the pending branch (v3.3).Xiaochen Shen (5):
accel-config: Addats_disablewq function in lib
accel-config: Addats_disablein config and json
accel-config: Addats_disableattr to config-wq command
accel-config: Addats_disableunit test
accel-config: Add documentation for wq option ats-disableDocumentation/accfg/accel-config-config-wq.txt | 6 ++++++ accfg/config.c | 1 + accfg/config_attr.c | 16 ++++++++++++++++ accfg/lib/libaccel-config.sym | 6 ++++++ accfg/lib/libaccfg.c | 3 +++ accfg/lib/private.h | 1 + accfg/libaccel_config.h | 3 +++ test/dsa.c | 1 + test/dsa.h | 1 + test/libaccfg.c | 9 +++++++++ util/json.c | 4 ++++ 11 files changed, 51 insertions(+)--
1.8.3.1
_______________________________________________
Accel-config mailing list -- accel-config(a)lists.01.org To unsubscribe send an email to accel-config-leave(a)lists.01.org