linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Pierre Morel <pmorel@linux.vnet.ibm.com>
Cc: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>,
	pasic@linux.vnet.ibm.com, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 01/10] vfio: ccw: Moving state change out of IRQ context
Date: Tue, 24 Apr 2018 13:55:33 +0200	[thread overview]
Message-ID: <20180424135533.2e9d03dc.cohuck@redhat.com> (raw)
In-Reply-To: <f6253047-e364-c240-c4c5-cf186ca75a7d@linux.vnet.ibm.com>

On Tue, 24 Apr 2018 13:49:14 +0200
Pierre Morel <pmorel@linux.vnet.ibm.com> wrote:

> On 24/04/2018 11:59, Cornelia Huck wrote:
> > On Tue, 24 Apr 2018 10:40:56 +0200
> > Pierre Morel <pmorel@linux.vnet.ibm.com> wrote:
> >  
> >> On 24/04/2018 08:54, Dong Jia Shi wrote:  
> >>> * Pierre Morel <pmorel@linux.vnet.ibm.com> [2018-04-19 16:48:04 +0200]:
> >>>
> >>> [...]
> >>>     
> >>>> @@ -94,9 +83,15 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work)
> >>>>    static void vfio_ccw_sch_irq(struct subchannel *sch)
> >>>>    {
> >>>>    	struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
> >>>> +	struct irb *irb = this_cpu_ptr(&cio_irb);
> >>>>
> >>>>    	inc_irq_stat(IRQIO_CIO);
> >>>> -	vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_INTERRUPT);
> >>>> +	memcpy(&private->irb, irb, sizeof(*irb));
> >>>> +
> >>>> +	WARN_ON(work_pending(&private->io_work));  
> >>> Hmm, why do we need this?  
> >> The current design insure that we have not two concurrent SSCH requests.
> >> How ever I want here to track spurious interrupt.
> >> If we implement cancel, halt or clear requests, we also may trigger (AFAIU)
> >> a second interrupts depending on races between instructions, controller
> >> and device.  
> > You won't get an interrupt for a successful cancel. If you do a
> > halt/clear, you will make the subchannel halt/clear pending in addition
> > to start pending and you'll only get one interrupt (if the I/O has
> > progressed far enough, you won't be able to issue a hsch). The
> > interesting case is:
> > - guest does a ssch, we do a ssch on the device
> > - the guest does a csch before it got the interrupt for the ssch
> > - before we do the csch on the device, the subchannel is already status
> >    pending with completion of the ssch
> > - after we issue the csch, we get a second interrupt (for the csch)  
> 
> We agree.
> 
> >
> > I think we should present two interrupts to the guest in that case.
> > Races between issuing ssch/hsch/csch and the subchannel becoming status
> > pending happen on real hardware as well, we're just more likely to see
> > them with the vfio layer in between.  
> 
> Yes, agreed too.
> 
> >
> > (I'm currently trying to recall what we're doing with unsolicited
> > interrupts. These are fun wrt deferred cc 1; I'm not sure if there are
> > cases where we want to present a deferred cc to the guest.)  
> 
> This patch does not change the current functionalities, only 
> consolidates the FSM.
> The current way to handle unsolicited interrupts is to report them to 
> the guest
> along with the deferred code AFAIU.

My question was more along the line of "do we actually want to
_generate_ a deferred cc1 or unsolicited interrupt, based upon what we
do in our state machine". My guess is no, regardless of the changes you
do in this series.

> 
> >
> > Also, doing a second ssch before we got final state for the first one
> > is perfectly valid. Linux just does not do it, so I'm not sure if we
> > should invest too much time there.  
> 
> I agree too, it would just make things unnecessary complicated.

I'm a big fan of just throwing everything at the hardware and let it
sort out any races etc. We just need to be sure we don't mix up
interrupts :)

  reply	other threads:[~2018-04-24 11:55 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 14:48 [PATCH 00/10] vfio: ccw: Refactoring the VFIO CCW state machine Pierre Morel
2018-04-19 14:48 ` [PATCH 01/10] vfio: ccw: Moving state change out of IRQ context Pierre Morel
     [not found]   ` <20180424065442.GV12194@bjsdjshi@linux.vnet.ibm.com>
2018-04-24  8:40     ` Pierre Morel
2018-04-24  9:59       ` Cornelia Huck
2018-04-24 11:49         ` Pierre Morel
2018-04-24 11:55           ` Cornelia Huck [this message]
2018-04-24 13:07             ` Pierre Morel
2018-04-24 16:42         ` Halil Pasic
2018-04-25  6:57           ` Cornelia Huck
2018-04-25 11:06             ` Halil Pasic
2018-04-30 13:56               ` Cornelia Huck
2018-04-19 14:48 ` [PATCH 02/10] vfio: ccw: Transform FSM functions to return state Pierre Morel
     [not found]   ` <20180424072550.GW12194@bjsdjshi@linux.vnet.ibm.com>
2018-04-24  8:22     ` Pierre Morel
2018-04-30 13:58       ` Cornelia Huck
2018-04-19 14:48 ` [PATCH 03/10] vfio: ccw: new SCH_EVENT event Pierre Morel
2018-04-25  8:25   ` Cornelia Huck
2018-04-25 13:54     ` Pierre Morel
     [not found]   ` <20180426065954.GP5428@bjsdjshi@linux.vnet.ibm.com>
2018-04-30 15:28     ` Cornelia Huck
2018-05-04  8:25       ` Pierre Morel
2018-04-19 14:48 ` [PATCH 04/10] vfio: ccw: replace IO_REQ event with SSCH_REQ event Pierre Morel
2018-04-25  8:41   ` Cornelia Huck
     [not found]     ` <24f638e4-2f7e-00e1-1efb-ff3fe524bca0@linux.vnet.ibm.com>
2018-04-30 15:30       ` Cornelia Huck
2018-05-03 12:06         ` Pierre Morel
2018-05-22 15:38           ` Cornelia Huck
2018-05-23  8:19             ` Pierre Morel
     [not found]   ` <20180426073053.GZ12194@bjsdjshi@linux.vnet.ibm.com>
     [not found]     ` <20180426074806.GB12194@bjsdjshi@linux.vnet.ibm.com>
2018-04-30 15:33       ` Cornelia Huck
     [not found]         ` <20180502074622.GV5428@bjsdjshi@linux.vnet.ibm.com>
2018-05-02  8:22           ` Cornelia Huck
2018-05-03 14:26           ` Pierre Morel
     [not found]             ` <20180504011916.GA26081@bjsdjshi@linux.ibm.com>
2018-05-04 11:02               ` Pierre Morel
2018-05-22 15:41                 ` Cornelia Huck
2018-05-23  7:50                   ` Pierre Morel
2018-05-23  8:10                     ` Cornelia Huck
2018-04-19 14:48 ` [PATCH 05/10] vfio: ccw: Suppress unused event parameter Pierre Morel
     [not found]   ` <20180426073618.GA12194@bjsdjshi@linux.vnet.ibm.com>
2018-05-03 10:34     ` Pierre Morel
2018-04-19 14:48 ` [PATCH 06/10] vfio: ccw: Make FSM functions atomic Pierre Morel
2018-04-19 14:48 ` [PATCH 07/10] vfio: ccw: Introduce the INIT event Pierre Morel
2018-04-30 15:39   ` Cornelia Huck
2018-05-03 10:31     ` Pierre Morel
2018-04-19 14:48 ` [PATCH 08/10] vfio: ccw: Handling reset and shutdown with states Pierre Morel
2018-04-30 15:43   ` Cornelia Huck
2018-04-19 14:48 ` [PATCH 09/10] vfio: ccw: Suppressing the BOXED state Pierre Morel
2018-04-25  8:44   ` Cornelia Huck
2018-04-25 13:55     ` Pierre Morel
2018-04-30 15:47       ` Cornelia Huck
2018-05-03  9:02         ` Pierre Morel
2018-04-19 14:48 ` [PATCH 10/10] vfio: ccw: Let user wait when busy on IO Pierre Morel
2018-04-25  8:48   ` Cornelia Huck
2018-04-25 14:00     ` Pierre Morel

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=20180424135533.2e9d03dc.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=bjsdjshi@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pasic@linux.vnet.ibm.com \
    --cc=pmorel@linux.vnet.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;
as well as URLs for NNTP newsgroup(s).