]> git.baikalelectronics.ru Git - kernel.git/commitdiff
vfio/ccw: Remove UUID from s390 debug log
authorMichael Kawano <mkawano@linux.ibm.com>
Thu, 7 Jul 2022 13:57:27 +0000 (15:57 +0200)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 7 Jul 2022 20:06:12 +0000 (14:06 -0600)
As vfio-ccw devices are created/destroyed, the uuid of the associated
mdevs that are recorded in $S390DBF/vfio_ccw_msg/sprintf get lost.
This is because a pointer to the UUID is stored instead of the UUID
itself, and that memory may have been repurposed if/when the logs are
examined. The result is usually garbage UUID data in the logs, though
there is an outside chance of an oops happening here.

Simply remove the UUID from the traces, as the subchannel number will
provide useful configuration information for problem determination,
and is stored directly into the log instead of a pointer.

As we were the only consumer of mdev_uuid(), remove that too.

Cc: Kirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: Michael Kawano <mkawano@linux.ibm.com>
Fixes: b495da45793a5 ("vfio-ccw: add some logging")
Fixes: 33ea05f26e120 ("vfio-ccw: Register a chp_event callback for vfio-ccw")
[farman: reworded commit message, added Fixes: tags]
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Link: https://lore.kernel.org/r/20220707135737.720765-2-farman@linux.ibm.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/s390/cio/vfio_ccw_drv.c
drivers/s390/cio/vfio_ccw_fsm.c
drivers/s390/cio/vfio_ccw_ops.c
include/linux/mdev.h

index ee182cfb467d141695b7a90f6f1f1345d61823eb..35055eb9411500aab14071a916c2189c4e058904 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/slab.h>
-#include <linux/uuid.h>
 #include <linux/mdev.h>
 
 #include <asm/isc.h>
@@ -358,8 +357,8 @@ static int vfio_ccw_chp_event(struct subchannel *sch,
                return 0;
 
        trace_vfio_ccw_chp_event(private->sch->schid, mask, event);
-       VFIO_CCW_MSG_EVENT(2, "%pUl (%x.%x.%04x): mask=0x%x event=%d\n",
-                          mdev_uuid(private->mdev), sch->schid.cssid,
+       VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: mask=0x%x event=%d\n",
+                          sch->schid.cssid,
                           sch->schid.ssid, sch->schid.sch_no,
                           mask, event);
 
index 8483a266051c216de71c21672a8d7e737e895a23..bbcc5b486749600ec6c26503e90b9872109cf9c6 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 #include <linux/vfio.h>
-#include <linux/mdev.h>
 
 #include "ioasm.h"
 #include "vfio_ccw_private.h"
@@ -242,7 +241,6 @@ static void fsm_io_request(struct vfio_ccw_private *private,
        union orb *orb;
        union scsw *scsw = &private->scsw;
        struct ccw_io_region *io_region = private->io_region;
-       struct mdev_device *mdev = private->mdev;
        char *errstr = "request";
        struct subchannel_id schid = get_schid(private);
 
@@ -256,8 +254,8 @@ static void fsm_io_request(struct vfio_ccw_private *private,
                if (orb->tm.b) {
                        io_region->ret_code = -EOPNOTSUPP;
                        VFIO_CCW_MSG_EVENT(2,
-                                          "%pUl (%x.%x.%04x): transport mode\n",
-                                          mdev_uuid(mdev), schid.cssid,
+                                          "sch %x.%x.%04x: transport mode\n",
+                                          schid.cssid,
                                           schid.ssid, schid.sch_no);
                        errstr = "transport mode";
                        goto err_out;
@@ -265,8 +263,8 @@ static void fsm_io_request(struct vfio_ccw_private *private,
                io_region->ret_code = cp_init(&private->cp, orb);
                if (io_region->ret_code) {
                        VFIO_CCW_MSG_EVENT(2,
-                                          "%pUl (%x.%x.%04x): cp_init=%d\n",
-                                          mdev_uuid(mdev), schid.cssid,
+                                          "sch %x.%x.%04x: cp_init=%d\n",
+                                          schid.cssid,
                                           schid.ssid, schid.sch_no,
                                           io_region->ret_code);
                        errstr = "cp init";
@@ -276,8 +274,8 @@ static void fsm_io_request(struct vfio_ccw_private *private,
                io_region->ret_code = cp_prefetch(&private->cp);
                if (io_region->ret_code) {
                        VFIO_CCW_MSG_EVENT(2,
-                                          "%pUl (%x.%x.%04x): cp_prefetch=%d\n",
-                                          mdev_uuid(mdev), schid.cssid,
+                                          "sch %x.%x.%04x: cp_prefetch=%d\n",
+                                          schid.cssid,
                                           schid.ssid, schid.sch_no,
                                           io_region->ret_code);
                        errstr = "cp prefetch";
@@ -289,8 +287,8 @@ static void fsm_io_request(struct vfio_ccw_private *private,
                io_region->ret_code = fsm_io_helper(private);
                if (io_region->ret_code) {
                        VFIO_CCW_MSG_EVENT(2,
-                                          "%pUl (%x.%x.%04x): fsm_io_helper=%d\n",
-                                          mdev_uuid(mdev), schid.cssid,
+                                          "sch %x.%x.%04x: fsm_io_helper=%d\n",
+                                          schid.cssid,
                                           schid.ssid, schid.sch_no,
                                           io_region->ret_code);
                        errstr = "cp fsm_io_helper";
@@ -300,16 +298,16 @@ static void fsm_io_request(struct vfio_ccw_private *private,
                return;
        } else if (scsw->cmd.fctl & SCSW_FCTL_HALT_FUNC) {
                VFIO_CCW_MSG_EVENT(2,
-                                  "%pUl (%x.%x.%04x): halt on io_region\n",
-                                  mdev_uuid(mdev), schid.cssid,
+                                  "sch %x.%x.%04x: halt on io_region\n",
+                                  schid.cssid,
                                   schid.ssid, schid.sch_no);
                /* halt is handled via the async cmd region */
                io_region->ret_code = -EOPNOTSUPP;
                goto err_out;
        } else if (scsw->cmd.fctl & SCSW_FCTL_CLEAR_FUNC) {
                VFIO_CCW_MSG_EVENT(2,
-                                  "%pUl (%x.%x.%04x): clear on io_region\n",
-                                  mdev_uuid(mdev), schid.cssid,
+                                  "sch %x.%x.%04x: clear on io_region\n",
+                                  schid.cssid,
                                   schid.ssid, schid.sch_no);
                /* clear is handled via the async cmd region */
                io_region->ret_code = -EOPNOTSUPP;
index b49e2e9db2dc6fe9f43d40777d4acb54c8940e0d..0e05bff78b8e710eb020a3156f16c196aacea38f 100644 (file)
@@ -131,8 +131,8 @@ static int vfio_ccw_mdev_probe(struct mdev_device *mdev)
        private->mdev = mdev;
        private->state = VFIO_CCW_STATE_IDLE;
 
-       VFIO_CCW_MSG_EVENT(2, "mdev %pUl, sch %x.%x.%04x: create\n",
-                          mdev_uuid(mdev), private->sch->schid.cssid,
+       VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: create\n",
+                          private->sch->schid.cssid,
                           private->sch->schid.ssid,
                           private->sch->schid.sch_no);
 
@@ -154,8 +154,8 @@ static void vfio_ccw_mdev_remove(struct mdev_device *mdev)
 {
        struct vfio_ccw_private *private = dev_get_drvdata(mdev->dev.parent);
 
-       VFIO_CCW_MSG_EVENT(2, "mdev %pUl, sch %x.%x.%04x: remove\n",
-                          mdev_uuid(mdev), private->sch->schid.cssid,
+       VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: remove\n",
+                          private->sch->schid.cssid,
                           private->sch->schid.ssid,
                           private->sch->schid.sch_no);
 
index bb539794f54a8f57312ed56b79dce2b9aecc6bea..47ad3b104d9e73728b6b69145c8703b2a1c94afa 100644 (file)
@@ -65,11 +65,6 @@ struct mdev_driver {
        struct device_driver driver;
 };
 
-static inline const guid_t *mdev_uuid(struct mdev_device *mdev)
-{
-       return &mdev->uuid;
-}
-
 extern struct bus_type mdev_bus_type;
 
 int mdev_register_device(struct device *dev, struct mdev_driver *mdev_driver);