From: Cornelia Huck <cohuck@redhat.com>
To: Eric Farman <farman@linux.ibm.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
Farhan Ali <alifm@linux.ibm.com>,
Pierre Morel <pmorel@linux.ibm.com>,
linux-s390@vger.kernel.org, kvm@vger.kernel.org,
qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 2/6] vfio-ccw: rework ssch state handling
Date: Mon, 11 Mar 2019 10:47:40 +0100 [thread overview]
Message-ID: <20190311104740.6b271c6a.cohuck@redhat.com> (raw)
In-Reply-To: <2f3cd598-5d95-c1b5-24f8-4de2c454be59@linux.ibm.com>
On Fri, 8 Mar 2019 17:18:22 -0500
Eric Farman <farman@linux.ibm.com> wrote:
> On 03/01/2019 04:38 AM, Cornelia Huck wrote:
> > The flow for processing ssch requests can be improved by splitting
> > the BUSY state:
> >
> > - CP_PROCESSING: We reject any user space requests while we are in
> > the process of translating a channel program and submitting it to
> > the hardware. Use -EAGAIN to signal user space that it should
> > retry the request.
> > - CP_PENDING: We have successfully submitted a request with ssch and
> > are now expecting an interrupt. As we can't handle more than one
> > channel program being processed, reject any further requests with
> > -EBUSY. A final interrupt will move us out of this state; this also
> > fixes a latent bug where a non-final interrupt might have freed up
> > a channel program that still was in progress.
> > By making this a separate state, we make it possible to issue a
> > halt or a clear while we're still waiting for the final interrupt
> > for the ssch (in a follow-on patch).
> >
> > It also makes a lot of sense not to preemptively filter out writes to
> > the io_region if we're in an incorrect state: the state machine will
> > handle this correctly.
> >
> > Reviewed-by: Eric Farman <farman@linux.ibm.com>
> > Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> > ---
> > drivers/s390/cio/vfio_ccw_drv.c | 8 ++++++--
> > drivers/s390/cio/vfio_ccw_fsm.c | 19 ++++++++++++++-----
> > drivers/s390/cio/vfio_ccw_ops.c | 2 --
> > drivers/s390/cio/vfio_ccw_private.h | 3 ++-
> > 4 files changed, 22 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c
> > index a10cec0e86eb..0b3b9de45c60 100644
> > --- a/drivers/s390/cio/vfio_ccw_drv.c
> > +++ b/drivers/s390/cio/vfio_ccw_drv.c
> > @@ -72,20 +72,24 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work)
> > {
> > struct vfio_ccw_private *private;
> > struct irb *irb;
> > + bool is_final;
> >
> > private = container_of(work, struct vfio_ccw_private, io_work);
> > irb = &private->irb;
> >
> > + is_final = !(scsw_actl(&irb->scsw) &
> > + (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT));
> > if (scsw_is_solicited(&irb->scsw)) {
> > cp_update_scsw(&private->cp, &irb->scsw);
> > - cp_free(&private->cp);
> > + if (is_final)
> > + cp_free(&private->cp);
> > }
> > memcpy(private->io_region->irb_area, irb, sizeof(*irb));
> >
> > if (private->io_trigger)
> > eventfd_signal(private->io_trigger, 1);
> >
> > - if (private->mdev)
> > + if (private->mdev && is_final)
> > private->state = VFIO_CCW_STATE_IDLE;
> > }
> >
>
> Coincidentally, I did something AWESOME last night that the chunks
> listed above actually fix. I have a large channel program, and when it
> runs my host crashes which isn't nice.
Ouch.
(...)
> Recalling the above changes, I applied JUST the above pieces (not the
> remainder of this patch), and the above channel program works fine.
Thanks for pointing that out... I'll extract a patch with only the
changes above and post it with cc:stable. A channel program submitted
by the guest being able to crash the host is... not good.
next prev parent reply other threads:[~2019-03-11 9:47 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 9:38 [Qemu-devel] [PATCH v4 0/6] vfio-ccw: support hsch/csch (kernel part) Cornelia Huck
2019-03-01 9:38 ` [Qemu-devel] [PATCH v4 1/6] vfio-ccw: make it safe to access channel programs Cornelia Huck
2019-04-08 17:02 ` Farhan Ali
2019-04-08 17:02 ` Farhan Ali
2019-04-08 17:07 ` Cornelia Huck
2019-04-08 17:07 ` Cornelia Huck
2019-04-08 17:19 ` Farhan Ali
2019-04-08 17:19 ` Farhan Ali
2019-04-08 20:25 ` Eric Farman
2019-04-08 20:25 ` Eric Farman
2019-04-09 23:34 ` Halil Pasic
2019-04-09 23:34 ` Halil Pasic
2019-04-11 2:59 ` Eric Farman
2019-04-11 2:59 ` Eric Farman
2019-04-11 15:58 ` [Qemu-devel] [qemu-s390x] " Halil Pasic
2019-04-11 15:58 ` Halil Pasic
2019-04-11 16:25 ` Eric Farman
2019-04-11 16:25 ` Eric Farman
2019-04-11 16:36 ` Cornelia Huck
2019-04-11 16:36 ` Cornelia Huck
2019-04-11 18:07 ` Halil Pasic
2019-04-11 18:07 ` Halil Pasic
2019-04-11 21:27 ` [Qemu-devel] " Eric Farman
2019-04-11 21:27 ` Eric Farman
2019-04-12 8:14 ` Cornelia Huck
2019-04-12 8:14 ` Cornelia Huck
2019-03-01 9:38 ` [Qemu-devel] [PATCH v4 2/6] vfio-ccw: rework ssch state handling Cornelia Huck
2019-03-08 22:18 ` Eric Farman
2019-03-11 9:47 ` Cornelia Huck [this message]
2019-03-01 9:38 ` [Qemu-devel] [PATCH v4 3/6] vfio-ccw: protect the I/O region Cornelia Huck
2019-03-01 9:39 ` [Qemu-devel] [PATCH v4 4/6] vfio-ccw: add capabilities chain Cornelia Huck
2019-04-15 14:40 ` Eric Farman
2019-04-15 14:40 ` Eric Farman
2019-04-15 15:24 ` Farhan Ali
2019-04-15 15:24 ` Farhan Ali
2019-03-01 9:39 ` [Qemu-devel] [PATCH v4 5/6] s390/cio: export hsch to modules Cornelia Huck
2019-03-01 9:39 ` [Qemu-devel] [PATCH v4 6/6] vfio-ccw: add handling for async channel instructions Cornelia Huck
2019-04-15 14:56 ` Eric Farman
2019-04-15 14:56 ` Eric Farman
2019-04-15 15:25 ` Farhan Ali
2019-04-15 15:25 ` Farhan Ali
2019-03-07 21:28 ` [Qemu-devel] [PATCH v4 0/6] vfio-ccw: support hsch/csch (kernel part) Eric Farman
2019-04-15 11:51 ` Cornelia Huck
2019-04-15 11:51 ` Cornelia Huck
2019-04-15 16:43 ` Cornelia Huck
2019-04-15 16:43 ` 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=20190311104740.6b271c6a.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=alifm@linux.ibm.com \
--cc=farman@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pasic@linux.ibm.com \
--cc=pmorel@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).