accel-config: Remove cdev related code
ramesh.thomas at intel.com
PATCH 1/2 accel-config: Remove cdev related code
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
cdev major/minor method of opening idxd char dev will be deprecated. Currently even in non uacce mode the char dev is opened using the device name at /dev/dsa that is returned by accfg_wq_get_user_dev_path()
--- accfg/lib/libaccel-config.sym | 2 - accfg/lib/libaccfg.c | 80 ----------------------------------- accfg/lib/private.h | 2 - accfg/libaccel_config.h | 2 - util/json.c | 11 ----- 5 files changed, 97 deletions(-)
accfg/lib/libaccel-config.sym +0 -2
@@ -28,7 +28,6 @@ LIBACCFG_1 { accfg_device_get_state; accfg_device_get_max_tokens; accfg_device_get_max_batch_size; - accfg_device_get_cdev_major; accfg_device_is_active; accfg_device_get_token_limit; accfg_device_set_token_limit;
@@ -69,7 +68,6 @@ LIBACCFG_1 { accfg_wq_get_size; accfg_wq_get_block_on_fault; accfg_wq_get_state; - accfg_wq_get_cdev_minor; accfg_wq_get_type; accfg_wq_get_threshold; accfg_wq_set_size;
accfg/lib/libaccfg.c +0 -80
116 lines not on this page · raw message
accfg/lib/private.h +0 -2
@@ -50,7 +50,6 @@ struct accfg_device {int configurable;int max_tokens;unsigned int token_limit; -unsigned int cdev_major;unsigned int version;uint64_t max_transfer_size;uint64_t opcap;
@@ -118,7 +117,6 @@ struct accfg_wq {int priv;int priority;int block_on_fault; -int cdev_minor;unsigned int threshold;char *mode;char *name;
accfg/libaccel_config.h +0 -2
@@ -183,7 +183,6 @@ enum accfg_device_state accfg_device_get_state(struct accfg_device *device);unsigned int accfg_device_get_max_tokens (struct accfg_device *device);unsigned int accfg_device_get_max_batch_size (struct accfg_device *device);unsigned int accfg_device_get_token_limit (struct accfg_device *device); -unsigned int accfg_device_get_cdev_major (struct accfg_device *device);unsigned int accfg_device_get_version (struct accfg_device *device);int accfg_device_get_clients (struct accfg_device *device);int accfg_device_set_token_limit (struct accfg_device *dev,int val);
@@ -258,7 +257,6 @@ int accfg_wq_get_priority(struct accfg_wq *wq);unsigned int accfg_wq_get_priv (struct accfg_wq *wq);int accfg_wq_get_block_on_fault (struct accfg_wq *wq);enum accfg_wq_state accfg_wq_get_state (struct accfg_wq *wq); -int accfg_wq_get_cdev_minor (struct accfg_wq *wq);const char *accfg_wq_get_type_name (struct accfg_wq *wq);enum accfg_wq_type accfg_wq_get_type (struct accfg_wq *wq);unsigned int accfg_wq_get_max_batch_size (struct accfg_wq *wq);
util/json.c +0 -11
@@ -324,11 +324,6 @@ struct json_object *util_device_to_json(struct accfg_device *device,json_object_object_add (jdevice,"pasid_enabled" , jobj); } - jobj =json_object_new_int (accfg_device_get_cdev_major (device)); -if (!jobj) - goto err; -json_object_object_add (jdevice,"cdev_major" , jobj); - jobj =json_object_new_int (accfg_device_get_clients (device));if (!jobj) goto err;
@@ -439,12 +434,6 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,if (jobj)json_object_object_add (jaccfg,"max_transfer_size" , jobj); -if (!(flags &UTIL_JSON_SAVE ) &&accfg_wq_get_cdev_minor (wq) >=0 ) { - jobj =json_object_new_int (accfg_wq_get_cdev_minor (wq)); -if (jobj) -json_object_object_add (jaccfg,"cdev_minor" , jobj); - } - jobj =json_object_new_string (wq_type_str[accfg_wq_get_type (wq)]);if (jobj)json_object_object_add (jaccfg,"type" , jobj);
Signature · 1 line
2.26.3
ramesh.thomas at intel.com
PATCH 2/2 accel-config: Remove occurrences of cdev
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
cdev will not be listed in the list command because that field will be deprecated and not used by accel-config.
--- Documentation/accfg/accel-config-list.txt | 3 --- 1 file changed, 3 deletions(-)
Documentation/accfg/accel-config-list.txt +0 -3
@@ -43,7 +43,6 @@ EXAMPLE "max_transfer_size":2147483648, "configurable":1, "pasid_enabled":1, - "cdev_major":247, "clients":2, "groups":[ {
@@ -61,7 +60,6 @@ EXAMPLE "group_id":0, "priority":10, "block_on_fault":1, - "cdev_minor":0, "type":"user", "name":"app1", "threshold":15,
@@ -95,7 +93,6 @@ EXAMPLE "group_id":1, "priority":10, "block_on_fault":1, - "cdev_minor":1, "type":"user", "name":"app2", "threshold":0,
Signature · 1 line
2.26.3
Luck
Quoted 3 lines
cdev major/minor method of opening idxd char dev will be deprecated. Currently even in non uacce mode the char dev is opened using the device name at
/dev/dsathat is returned byaccfg_wq_get_user_dev_path()
Is there an option to accel-config that will show this device path?
-Tony
Thomas
Quoted 5 lines · Tony Luck
Quoted 3 lines
cdev major/minor method of opening idxd char dev will be deprecated. Currently even in non uacce mode the char dev is opened using the device name at
/dev/dsathat is returned byaccfg_wq_get_user_dev_path()Is there an option to accel-config that will show this device path?
No, it is only returned in the library API. The cdev major/minor was being shown in wq listing.
Quoted 3 lines
-Tony
Thomas
Should we add "cdev path : /dev/dsa/..." to the wq listing?
Quoted 10 lines · Ramesh Thomas
Quoted 6 lines · Tony Luck
Quoted 4 lines
cdev major/minor method of opening idxd char dev will be deprecated. Currently even in non uacce mode the char dev is opened using the device
name at/dev/dsathat is returned byaccfg_wq_get_user_dev_path()Is there an option to accel-config that will show this device path?
No, it is only returned in the library API. The cdev major/minor was being shown in wq listing.
Luck
Quoted 1 line
Should we add "cdev path :
/dev/dsa/..." to the wq listing?
That's the direction I was thinking (based on the fact that you took away cdev major/minor and didn't replace them).
But it isn't all that equivalent. A command line only solution might have had a tough time getting from the major/minor devices to actually opening a device.
So the answer is maybe ... but only if we can convince ourselves that somebody is going to use "accel-config list" to feed into some script that extracts the pathname and hands it onto a process to open/mmap. That seems something of a stretch.
-Tony
Thomas
Quoted 10 lines · Tony Luck
Quoted 1 line
Should we add "cdev path :
/dev/dsa/..." to the wq listing?That's the direction I was thinking (based on the fact that you took away cdev major/minor
and didn't replace them).But it isn't all that equivalent. A command line only solution might have had a tough time
getting from the major/minor devices to actually opening a device.
Quoted 6 lines
So the answer is maybe ... but only if we can convince ourselves that somebody is
going to use "accel-config list" to feed into some script that extracts the pathname
and hands it onto a process to open/mmap. That seems something of a stretch.
accfg_wq_get_user_dev_path() was the replacement. I thought the display of major/minor in the listing was only for informative purpose i.e. user can use that info in their application. Note that there is also a library API to retrieve the major/minor which I think we can leave for now if users are still using it and driver provides backward compatibility.
-Ramesh
Dave Jiang
Quoted 5 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
cdev major/minor method of opening idxd char dev will be deprecated. Currently even in non uacce mode the char dev is opened using the device name at
/dev/dsathat is returned byaccfg_wq_get_user_dev_path()
I'm concerned about backward compatibility for apps (Intel user libs) that may still use minor/major API. Do we need to provide some sort of backward compatibility (maybe with warnings?) until they get off this train? Especially they have been doing releases already.
Quoted 225 lines
Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>--- accfg/lib/libaccel-config.sym | 2 - accfg/lib/libaccfg.c | 80 ----------------------------------- accfg/lib/private.h | 2 - accfg/libaccel_config.h | 2 - util/json.c | 11 ----- 5 files changed, 97 deletions(-)accfg/lib/libaccel-config.sym +0
-2@@ -28,7 +28,6 @@ LIBACCFG_1 { accfg_device_get_state; accfg_device_get_max_tokens; accfg_device_get_max_batch_size; - accfg_device_get_cdev_major; accfg_device_is_active; accfg_device_get_token_limit; accfg_device_set_token_limit;@@ -69,7 +68,6 @@ LIBACCFG_1 { accfg_wq_get_size; accfg_wq_get_block_on_fault; accfg_wq_get_state; - accfg_wq_get_cdev_minor; accfg_wq_get_type; accfg_wq_get_threshold; accfg_wq_set_size;accfg/lib/libaccfg.c +0
-80@@ -581,7 +581,6 @@ static void *add_device(void *parent, int id, const char *ctl_base, "pasid_enabled"); device->max_tokens =accfg_get_param_long (ctx, dfd,"max_tokens" ); device->token_limit =accfg_get_param_long (ctx, dfd,"token_limit" ); - device->cdev_major =accfg_get_param_long (ctx, dfd,"cdev_major" ); device->version =accfg_get_param_unsigned_llong (ctx, dfd,"version" ); device->device_path =realpath (ctl_base,NULL );close (dfd);@@ -727,7 +726,6 @@ static void *add_wq(void *parent, int id, const char *wq_base, "block_on_fault"); wq->mode =accfg_get_param_str (ctx, dfd,"mode" ); wq->state =accfg_get_param_str (ctx, dfd,"state" ); - wq->cdev_minor =accfg_get_param_long (ctx, dfd,"cdev_minor" ); wq_type =accfg_get_param_str (ctx, dfd,"type" ); wq->name =accfg_get_param_str (ctx, dfd,"name" ); wq->threshold =accfg_get_param_long (ctx, dfd,"threshold" );@@ -1378,12 +1376,6 @@ ACCFG_EXPORT unsigned int accfg_device_get_token_limit(return device->token_limit; } -ACCFG_EXPORT unsigned int accfg_device_get_cdev_major( -struct accfg_device *device) -{ -return device->cdev_major; -} - ACCFG_EXPORT unsigned int accfg_device_get_version(struct accfg_device *device) {@@ -1859,11 +1851,6 @@ ACCFG_EXPORT const char *accfg_wq_get_devname(struct accfg_wq *wq)return devpath_to_devname (wq->wq_path); } -ACCFG_EXPORT int accfg_wq_get_cdev_minor(struct accfg_wq *wq) -{ -return wq->cdev_minor; -} - ACCFG_EXPORT enum accfg_wq_type accfg_wq_get_type(struct accfg_wq *wq) {return wq->type;@@ -1923,68 +1910,6 @@ ACCFG_EXPORT int accfg_wq_priority_boundary(struct accfg_wq *wq)return 0 ; } -static int accfg_wq_retrieve_cdev_minor (struct accfg_wq *wq) -{ -struct accfg_ctx *ctx =accfg_wq_get_ctx (wq); -char *path = wq->wq_buf; -char buf[SYSFS_ATTR_SIZE ]; -int rc; - - rc =sprintf (wq->wq_buf,"%s/%s" , wq->wq_path,"cdev_minor" ); -if (rc <0 ) -return -errno; - -if (sysfs_read_attr (ctx, path, buf) <0 ) { -err (ctx,"%s: retrieve cdev minor failed: '%s': %s\n" , - __func__, wq->wq_path,strerror (errno)); -return -errno; - } - - wq->cdev_minor =atoi (buf); -return 0 ; -} - -static int accfg_wq_post_enable (struct accfg_wq *wq) -{ -enum accfg_wq_type type; -int rc; - - type =accfg_wq_get_type (wq); - -if (type ==ACCFG_WQT_USER ) { - rc =accfg_wq_retrieve_cdev_minor (wq); -if (rc <0 ) -return rc; - } - -return 0 ; -} - -static int accfg_wq_post_disable (struct accfg_wq *wq) -{ -enum accfg_wq_type type; - - type =accfg_wq_get_type (wq); - -if (type ==ACCFG_WQT_USER ) - wq->cdev_minor =-1 ; - -return 0 ; -} - -static int accfg_wq_control_post_processing (struct accfg_wq *wq, -enum accfg_control_flag flag) -{ -if (flag ==ACCFG_WQ_ENABLE ) -return accfg_wq_post_enable (wq); -else if (flag ==ACCFG_WQ_DISABLE ) -return accfg_wq_post_disable (wq); -else -return -EINVAL ; - -return 0 ; -} -static bool accfg_wq_state_expected (struct accfg_wq *wq,enum accfg_control_flag flag) {@@ -2052,11 +1977,6 @@ static int accfg_wq_control(struct accfg_wq *wq, enum accfg_control_flag flag,return -ENXIO ; } -/* post processing */ - rc =accfg_wq_control_post_processing (wq, flag); -if (rc <0 ) -return rc; -return 0 ; }accfg/lib/private.h +0
-2@@ -50,7 +50,6 @@ struct accfg_device {int configurable;int max_tokens;unsigned int token_limit; -unsigned int cdev_major;unsigned int version;uint64_t max_transfer_size;uint64_t opcap;@@ -118,7 +117,6 @@ struct accfg_wq {int priv;int priority;int block_on_fault; -int cdev_minor;unsigned int threshold;char *mode;char *name;accfg/libaccel_config.h +0
-2@@ -183,7 +183,6 @@ enum accfg_device_state accfg_device_get_state(struct accfg_device *device);unsigned int accfg_device_get_max_tokens (struct accfg_device *device);unsigned int accfg_device_get_max_batch_size (struct accfg_device *device);unsigned int accfg_device_get_token_limit (struct accfg_device *device); -unsigned int accfg_device_get_cdev_major (struct accfg_device *device);unsigned int accfg_device_get_version (struct accfg_device *device);int accfg_device_get_clients (struct accfg_device *device);int accfg_device_set_token_limit (struct accfg_device *dev,int val);@@ -258,7 +257,6 @@ int accfg_wq_get_priority(struct accfg_wq *wq);unsigned int accfg_wq_get_priv (struct accfg_wq *wq);int accfg_wq_get_block_on_fault (struct accfg_wq *wq);enum accfg_wq_state accfg_wq_get_state (struct accfg_wq *wq); -int accfg_wq_get_cdev_minor (struct accfg_wq *wq);const char *accfg_wq_get_type_name (struct accfg_wq *wq);enum accfg_wq_type accfg_wq_get_type (struct accfg_wq *wq);unsigned int accfg_wq_get_max_batch_size (struct accfg_wq *wq);util/json.c +0
-11@@ -324,11 +324,6 @@ struct json_object *util_device_to_json(struct accfg_device *device,json_object_object_add (jdevice,"pasid_enabled" , jobj); } - jobj =json_object_new_int (accfg_device_get_cdev_major (device)); -if (!jobj) - goto err; -json_object_object_add (jdevice,"cdev_major" , jobj); - jobj =json_object_new_int (accfg_device_get_clients (device));if (!jobj) goto err;@@ -439,12 +434,6 @@ struct json_object *util_wq_to_json(struct accfg_wq *wq,if (jobj)json_object_object_add (jaccfg,"max_transfer_size" , jobj); -if (!(flags &UTIL_JSON_SAVE ) &&accfg_wq_get_cdev_minor (wq) >=0 ) { - jobj =json_object_new_int (accfg_wq_get_cdev_minor (wq)); -if (jobj) -json_object_object_add (jaccfg,"cdev_minor" , jobj); - } - jobj =json_object_new_string (wq_type_str[accfg_wq_get_type (wq)]);if (jobj)json_object_object_add (jaccfg,"type" , jobj);
Thomas
Quoted 11 lines · Dave Jiang
Quoted 5 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
cdev major/minor method of opening idxd char dev will be deprecated. Currently even in non uacce mode the char dev is opened using the device name at
/dev/dsathat is returned byaccfg_wq_get_user_dev_path()I'm concerned about backward compatibility for apps (Intel user libs) that may still use minor/major API. Do we need to provide some sort of backward compatibility (maybe with warnings?) until they get off this train? Especially they have been doing releases already.
I think we can leave the API for now as long as driver has backward compatibility. Driver was returning error (-6) when cdev_minor was accessed. The library was trying to validate cdev_minor after enabling a wq and setting cdev_minor = -1 after wq was disabled. Do you think we can remove that code?
-Ramesh
Dave Jiang
Quoted 12 lines · Ramesh
Quoted 10 lines · Dave Jiang
Quoted 5 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
cdev major/minor method of opening idxd char dev will be deprecated. Currently even in non uacce mode the char dev is opened using the device name at
/dev/dsathat is returned byaccfg_wq_get_user_dev_path()I'm concerned about backward compatibility for apps (Intel user libs) that may still use minor/major API. Do we need to provide some sort of backward compatibility (maybe with warnings?) until they get off this train? Especially they have been doing releases already.
Quoted 5 lines
I think we can leave the API for now as long as driver has backward compatibility. Driver was returning error (-6) when
cdev_minorwas accessed. The library was trying to validatecdev_minorafter enabling a wq and settingcdev_minor= -1 after wq was disabled. Do you think we can remove that code?
I think so. Basically lets leave the API call and provide the info if available. But no need to do checking.
Quoted 1 line
-Ramesh