public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Farman <farman@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org,
	Farhan Ali <alifm@linux.ibm.com>
Subject: Re: [PULL 08/10] vfio-ccw: Introduce a new CRW region
Date: Tue, 2 Jun 2020 10:46:25 -0400	[thread overview]
Message-ID: <71bf02e5-dbb4-0b3f-0956-b1b13dadf42a@linux.ibm.com> (raw)
In-Reply-To: <20200602151313.0e639b57.cohuck@redhat.com>



On 6/2/20 9:13 AM, Cornelia Huck wrote:
> On Mon, 25 May 2020 11:41:13 +0200
> Cornelia Huck <cohuck@redhat.com> wrote:
> 
>> From: Farhan Ali <alifm@linux.ibm.com>
>>
>> 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@linux.ibm.com>
>> Signed-off-by: Eric Farman <farman@linux.ibm.com>
>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>> Message-Id: <20200505122745.53208-7-farman@linux.ibm.com>
>> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
>> ---
>>  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.

> 
>> +
>> +	if (!vfio_ccw_crw_region) {
>> +		ret = -ENOMEM;
>> +		goto out_err;
>> +	}
>> +
>>  	isc_register(VFIO_CCW_ISC);
>>  	ret = css_driver_register(&vfio_ccw_sch_driver);
>>  	if (ret) {
> 
> (...)
> 
>> diff --git a/include/uapi/linux/vfio_ccw.h b/include/uapi/linux/vfio_ccw.h
>> index 758bf214898d..cff5076586df 100644
>> --- a/include/uapi/linux/vfio_ccw.h
>> +++ b/include/uapi/linux/vfio_ccw.h
>> @@ -44,4 +44,12 @@ struct ccw_schib_region {
>>  	__u8 schib_area[SCHIB_AREA_SIZE];
>>  } __packed;
>>  
>> +/*
>> + * Used for returning a Channel Report Word to userspace.
>> + * Note: this is controlled by a capability
>> + */
>> +struct ccw_crw_region {
>> +	__u32 crw;
>> +} __packed;
>> +
>>  #endif
> 

  reply	other threads:[~2020-06-02 14:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25  9:41 [PULL 00/10] vfio-ccw patches for 5.8 Cornelia Huck
2020-05-25  9:41 ` [PULL 01/10] vfio-ccw: Enable transparent CCW IPL from DASD Cornelia Huck
2020-05-25  9:41 ` [PULL 02/10] vfio-ccw: document possible errors Cornelia Huck
2020-05-25  9:41 ` [PULL 03/10] vfio-ccw: Introduce new helper functions to free/destroy regions Cornelia Huck
2020-05-25  9:41 ` [PULL 04/10] vfio-ccw: Register a chp_event callback for vfio-ccw Cornelia Huck
2020-05-25  9:41 ` [PULL 05/10] vfio-ccw: Refactor the unregister of the async regions Cornelia Huck
2020-05-25  9:41 ` [PULL 06/10] vfio-ccw: Introduce a new schib region Cornelia Huck
2020-05-25  9:41 ` [PULL 07/10] vfio-ccw: Refactor IRQ handlers Cornelia Huck
2020-05-25  9:41 ` [PULL 08/10] vfio-ccw: Introduce a new CRW region Cornelia Huck
2020-06-02 13:13   ` Cornelia Huck
2020-06-02 14:46     ` Eric Farman [this message]
2020-06-02 15:34       ` Cornelia Huck
2020-05-25  9:41 ` [PULL 09/10] vfio-ccw: Wire up the CRW irq and " Cornelia Huck
2020-05-25  9:41 ` [PULL 10/10] vfio-ccw: Add trace for CRW event Cornelia Huck
2020-05-28 12:42 ` [PULL 00/10] vfio-ccw patches for 5.8 Vasily Gorbik
2020-05-28 14:22   ` Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71bf02e5-dbb4-0b3f-0956-b1b13dadf42a@linux.ibm.com \
    --to=farman@linux.ibm.com \
    --cc=alifm@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pasic@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox