Skip to contentSkip to conversation

pds_vdpa: updates

PATCH In review Shannon Nelson 2 participants 8 messages Nov 10, 2023 – Nov 14, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover pds_vdpa: updates

The first patch cleans up a kernel test robot complaint. The others are for a couple of things seen in further testing.

Shannon Nelson (3):
pds_vdpa: fix up format-truncation complaint
pds_vdpa: clear config callback when status goes to 0
pds_vdpa: set features order

 drivers/vdpa/pds/debugfs.c  | 2 +-
 drivers/vdpa/pds/vdpa_dev.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 pds_vdpa: fix up format-truncation complaint

Our friendly kernel test robot has recently been pointing out some format-truncation issues. Here's a fix for one of them.

---
 drivers/vdpa/pds/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/pds/debugfs.c +1 -1
index 9b04aad6ec35..c328e694f6e7 100644
@@ -261,7 +261,7 @@ void pds_vdpa_debugfs_add_vdpadev(struct pds_vdpa_aux *vdpa_aux)
 	debugfs_create_file("config", 0400, vdpa_aux->dentry, vdpa_aux->pdsv, &config_fops);
 
 	for (i = 0; i < vdpa_aux->pdsv->num_vqs; i++) {
-		char name[8];
+		char name[16];
 
 		snprintf(name, sizeof(name), "vq%02d", i);
 		debugfs_create_file(name, 0400, vdpa_aux->dentry,
Signature · 1 line
2.17.1
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH virtio 1/3] pds_vdpa: fix up format-truncation complaint

Quoted 7 lines · Shannon Nelson

Our friendly kernel test robot has recently been pointing out some format-truncation issues. Here's a fix for one of them.

I think this is needed for -stable?

Thanks

Quoted 20 lines
---
 drivers/vdpa/pds/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/pds/debugfs.c +1 -2
index 9b04aad6ec35..c328e694f6e7 100644
@@ -261,7 +261,7 @@ void pds_vdpa_debugfs_add_vdpadev(struct pds_vdpa_aux *vdpa_aux)
        debugfs_create_file("config", 0400, vdpa_aux->dentry, vdpa_aux->pdsv, &config_fops);
 
        for (i = 0; i < vdpa_aux->pdsv->num_vqs; i++) {
-               char name[8];
+               char name[16];
 
                snprintf(name, sizeof(name), "vq%02d", i);
                debugfs_create_file(name, 0400, vdpa_aux->dentry,
--

2.17.1

#3 lore raw

PATCH 2/3 pds_vdpa: clear config callback when status goes to 0

In reply to Shannon Nelson

If the client driver is setting status to 0, something is getting shutdown and possibly removed. Make sure we clear the config_cb so that it doesn't end up crashing when trying to call a bogus callback.

---
 drivers/vdpa/pds/vdpa_dev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vdpa/pds/vdpa_dev.c +3 -1
index 52b2449182ad..9fc89c82d1f0 100644
@@ -461,8 +461,10 @@ static void pds_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)
 
 	pds_vdpa_cmd_set_status(pdsv, status);
 
-	/* Note: still working with FW on the need for this reset cmd */
 	if (status == 0) {
+		struct vdpa_callback null_cb = { };
+
+		pds_vdpa_set_config_cb(vdpa_dev, &null_cb);
 		pds_vdpa_cmd_reset(pdsv);
 
 		for (i = 0; i < pdsv->num_vqs; i++) {
Signature · 1 line
2.17.1
Acked-by on v1 2/3
#4 lore raw

Re: [PATCH virtio 2/3] pds_vdpa: clear config callback when status goes to 0

Quoted 7 lines · Shannon Nelson

If the client driver is setting status to 0, something is getting shutdown and possibly removed. Make sure we clear the config_cb so that it doesn't end up crashing when trying to call a bogus callback.

Thanks

Quoted 23 lines
---
 drivers/vdpa/pds/vdpa_dev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vdpa/pds/vdpa_dev.c +3 -2
index 52b2449182ad..9fc89c82d1f0 100644
@@ -461,8 +461,10 @@ static void pds_vdpa_set_status(struct vdpa_device *vdpa_dev, u8 status)
 
        pds_vdpa_cmd_set_status(pdsv, status);
 
-       /* Note: still working with FW on the need for this reset cmd */
        if (status == 0) {
+               struct vdpa_callback null_cb = { };
+
+               pds_vdpa_set_config_cb(vdpa_dev, &null_cb);
                pds_vdpa_cmd_reset(pdsv);
 
                for (i = 0; i < pdsv->num_vqs; i++) {
--

2.17.1

#5 lore raw

PATCH 3/3 pds_vdpa: set features order

In reply to Shannon Nelson

Fix up the order that the device and negotiated features are checked to get a more reliable difference when things get changed.

---
 drivers/vdpa/pds/vdpa_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/vdpa/pds/vdpa_dev.c +1 -2
index 9fc89c82d1f0..25c0fe5ec3d5 100644
@@ -318,9 +318,8 @@ static int pds_vdpa_set_driver_features(struct vdpa_device *vdpa_dev, u64 featur
 		return -EOPNOTSUPP;
 	}
 
-	pdsv->negotiated_features = nego_features;
-
 	driver_features = pds_vdpa_get_driver_features(vdpa_dev);
+	pdsv->negotiated_features = nego_features;
 	dev_dbg(dev, "%s: %#llx => %#llx\n",
 		__func__, driver_features, nego_features);
 
Signature · 1 line
2.17.1
#6 lore raw

Re: [PATCH virtio 3/3] pds_vdpa: set features order

Quoted 15 lines · Shannon Nelson

Fix up the order that the device and negotiated features are checked to get a more reliable difference when things get changed.

---
 drivers/vdpa/pds/vdpa_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/vdpa/pds/vdpa_dev.c +0 -0
index 9fc89c82d1f0..25c0fe5ec3d5 100644

drivers/vdpa/pds/vdpa_dev.c static int pds_vdpa_set_driver_features(struct vdpa_device *vdpa_dev, u64 featur · line 322

Quoted 7 lines
drivers/vdpa/pds/vdpa_dev.c +1 -2
@@ -318,9 +318,8 @@ static int pds_vdpa_set_driver_features(struct vdpa_device *vdpa_dev, u64 featur
                return -EOPNOTSUPP;
        }
 
-       pdsv->negotiated_features = nego_features;
-
        driver_features = pds_vdpa_get_driver_features(vdpa_dev);
+       pdsv->negotiated_features = nego_features;

I may miss something, but I don't see how things have changed here.

Thanks

Quoted 6 lines
drivers/vdpa/pds/vdpa_dev.c +0 -1
        dev_dbg(dev, "%s: %#llx => %#llx\n",
                __func__, driver_features, nego_features);
 
--

2.17.1

Acked-by
#7 lore raw

Re: [PATCH virtio 3/3] pds_vdpa: set features order

Quoted 20 lines · Jason Wang
Quoted 18 lines · Shannon Nelson

Fix up the order that the device and negotiated features are checked to get a more reliable difference when things get changed.

---
 drivers/vdpa/pds/vdpa_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/vdpa/pds/vdpa_dev.c +0 -0
index 9fc89c82d1f0..25c0fe5ec3d5 100644
@@ -318,9 +318,8 @@ static int pds_vdpa_set_driver_features(struct vdpa_device *vdpa_dev, u64 featur
                return -EOPNOTSUPP;
        }
 
Quoted 6 lines

drivers/vdpa/pds/vdpa_dev.c static int pds_vdpa_set_driver_features(struct vdpa_device *vdpa_dev, u64 featur · line 322

Quoted 4 lines
drivers/vdpa/pds/vdpa_dev.c +1 -2
-       pdsv->negotiated_features = nego_features;
-
        driver_features = pds_vdpa_get_driver_features(vdpa_dev);
+       pdsv->negotiated_features = nego_features;

I may miss something, but I don't see how things have changed here.

Ok, I think I get it. driver_feautres here means the old negotiated features.

We probably need a better name (not a native speaker though).

Thanks

Quoted 9 lines

Thanks

Quoted 6 lines
drivers/vdpa/pds/vdpa_dev.c +0 -1
        dev_dbg(dev, "%s: %#llx => %#llx\n",
                __func__, driver_features, nego_features);
 
--

2.17.1