From: Eric Farman <farman@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>, Farhan Ali <alifm@linux.ibm.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
linux-s390@vger.kernel.org, kvm@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] vfio: ccw: only free cp on final interrupt
Date: Mon, 11 Mar 2019 06:35:16 -0400 [thread overview]
Message-ID: <04fe1f86-b7e2-5492-9e3f-48aeb52410e4@linux.ibm.com> (raw)
In-Reply-To: <20190311102025.23941-1-cohuck@redhat.com>
On 03/11/2019 06:20 AM, Cornelia Huck wrote:
> When we get an interrupt for a channel program, it is not
> necessarily the final interrupt; for example, the issuing
> guest may request an intermediate interrupt by specifying
> the program-controlled-interrupt flag on a ccw.
>
> We must not switch the state to idle if the interrupt is not
> yet final; even more importantly, we must not free the translated
> channel program if the interrupt is not yet final, or the host
> can crash during cp rewind.
>
> Fixes: e5f84dbaea59 ("vfio: ccw: return I/O results asynchronously")
> Cc: stable@vger.kernel.org # v4.12+
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
> ---
>
> Previously part of "vfio-ccw: rework ssch state handling". Please review,
> I plan to send a pull req asap.
>
> ---
> drivers/s390/cio/vfio_ccw_drv.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 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;
> }
>
>
prev parent reply other threads:[~2019-03-11 10:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 10:20 [PATCH] vfio: ccw: only free cp on final interrupt Cornelia Huck
2019-03-11 10:35 ` Eric Farman [this message]
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=04fe1f86-b7e2-5492-9e3f-48aeb52410e4@linux.ibm.com \
--to=farman@linux.ibm.com \
--cc=alifm@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pasic@linux.ibm.com \
--cc=stable@vger.kernel.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