On Tue, 2 Jun 2020 10:46:25 -0400 Eric Farman <farman@xxxxxxxxxxxxx> wrote: > On 6/2/20 9:13 AM, Cornelia Huck wrote: > > On Mon, 25 May 2020 11:41:13 +0200 > > Cornelia Huck <cohuck@xxxxxxxxxx> wrote: > > > >> From: Farhan Ali <alifm@xxxxxxxxxxxxx> > >> > >> This region provides a mechanism to pass a Channel Report Word > >> that affect vfio-ccw devices, and needs to be passed to the guest > >> for its awareness and/or processing. > >> > >> The base driver (see crw_collect_info()) provides space for two > >> CRWs, as a subchannel event may have two CRWs chained together > >> (one for the ssid, one for the subchannel). As vfio-ccw will > >> deal with everything at the subchannel level, provide space > >> for a single CRW to be transferred in one shot. > >> > >> Signed-off-by: Farhan Ali <alifm@xxxxxxxxxxxxx> > >> Signed-off-by: Eric Farman <farman@xxxxxxxxxxxxx> > >> Reviewed-by: Cornelia Huck <cohuck@xxxxxxxxxx> > >> Message-Id: <20200505122745.53208-7-farman@xxxxxxxxxxxxx> > >> Signed-off-by: Cornelia Huck <cohuck@xxxxxxxxxx> > >> --- > >> Documentation/s390/vfio-ccw.rst | 19 ++++++++++ > >> drivers/s390/cio/vfio_ccw_chp.c | 55 +++++++++++++++++++++++++++++ > >> drivers/s390/cio/vfio_ccw_drv.c | 20 +++++++++++ > >> drivers/s390/cio/vfio_ccw_ops.c | 8 +++++ > >> drivers/s390/cio/vfio_ccw_private.h | 4 +++ > >> include/uapi/linux/vfio.h | 2 ++ > >> include/uapi/linux/vfio_ccw.h | 8 +++++ > >> 7 files changed, 116 insertions(+) > >> > > > > (...) > > > >> @@ -413,6 +423,16 @@ static int __init vfio_ccw_sch_init(void) > >> goto out_err; > >> } > >> > >> + vfio_ccw_crw_region = kmem_cache_create_usercopy("vfio_ccw_crw_region", > >> + sizeof(struct ccw_crw_region), 0, > >> + SLAB_ACCOUNT, 0, > >> + sizeof(struct ccw_crw_region), NULL); > > > > Ugh, I just tested this rebased to the s390 features branch, and I must > > have used some different options, because I now get > > > > kmem_cache_create(vfio_ccw_crw_region) integrity check failed > > > > presumably due to the size of the ccw_crw_region. > > > > We maybe need to pad it up (leave it unpacked)? Eric, what do you think? > > Certainly packing a single one-word struct is weird, and the message is > coming out of the tiny struct itself: > > mm/slab-common.c:88: > if (!name || in_interrupt() || size < sizeof(void *) || > size > KMALLOC_MAX_SIZE) { > pr_err("kmem_cache_create(%s) integrity check failed\n", > name); > > That's protected by CONFIG_DEBUG_VM which wasn't enabled in my config. > So playing around with things, we'd have to explicitly add a pad (or the > second CRW, ha!) to get the struct back up to a doubleword. That'd be > fine with me. I think I'll just go with struct ccw_crw_region { __u32 crw; __u32 pad; } __packed; here and in the doc. I'll do some tests and do another pull request tomorrow.