Commit 3566ee1d authored by Michael Kawano's avatar Michael Kawano Committed by Alex Williamson
Browse files

vfio/ccw: Remove UUID from s390 debug log



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: default avatarMichael Kawano <mkawano@linux.ibm.com>
Fixes: 60e05d1c ("vfio-ccw: add some logging")
Fixes: b7701dfb ("vfio-ccw: Register a chp_event callback for vfio-ccw")
[farman: reworded commit message, added Fixes: tags]
Signed-off-by: default avatarEric Farman <farman@linux.ibm.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: default avatarKirti Wankhede <kwankhede@nvidia.com>
Link: https://lore.kernel.org/r/20220707135737.720765-2-farman@linux.ibm.com


Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 7654a888
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);

+12 −14
Original line number Diff line number Diff line
@@ -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;
+4 −4
Original line number Diff line number Diff line
@@ -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);

+0 −5
Original line number Diff line number Diff line
@@ -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);