qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: Pierre Morel <pmorel@linux.ibm.com>,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, qemu-devel@nongnu.org,
	qemu-s390x@nongnu.org, Dong Jia Shi <bjsdjshi@linux.ibm.com>
Subject: Re: [Qemu-devel] [qemu-s390x] [PATCH RFC 2/2] vfio-ccw: support for halt/clear subchannel
Date: Fri, 8 Jun 2018 22:40:39 +0200	[thread overview]
Message-ID: <0c1e1b26-0c6a-fdc2-0c1a-2e2d58c2cb73@linux.ibm.com> (raw)
In-Reply-To: <20180607183407.1ea5ab89.cohuck@redhat.com>



On 06/07/2018 06:34 PM, Cornelia Huck wrote:
> On Thu, 7 Jun 2018 18:17:57 +0200
> Halil Pasic <pasic@linux.ibm.com> wrote:
> 
>> On 06/07/2018 11:54 AM, Cornelia Huck wrote:
>>> Hm, I think we need to be more precise as to what scsw we're talking
>>> about. Bad ascii art time:
>>>
>>> --------------
>>> |   scsw(g)  |  ssch
>>> --------------   |
>>>                    |                                       guest
[..]

>> (5) AFAIK this is how the current implementation works. We don't wait
>> for the I/O interrupt on the host to present a cc to the guest for it's
>> ssch.
> 
> But the vfio code does wait, no? We just signal the interrupt via
> eventfd as well.
> 

We have sorted this out in the other thread.

>>
>>>
>>> If the guest now does a hsch, it would trap in the same way as the ssch
>>> before. When qemu gets control, it adds the halt bit in scsw(q) (which
>>> is in accordance with the architecture).
>>
>> (7) Again it's when is fctl set according to the architecture...
> 
> Same comment as above. If we do a hsch for a subchannel with the start
> function set, we'll set cc 0.
> 
>>
>>> My proposal is to do the same
>>> copying to scsw(r) again, which would mean we get a request with both
>>> the halt and the start bit set.
>>
>> (8) IMHO when receiving the 'request' we are and should be in instruction
>> context -- opposed to basic io function context. So we should not set fctl
>> before we know what will our guest cc be. But since scsw(r) is not a real
>> scsw it is just strange.
> 
> I think what we are doing is really 'performing the start function' -
> it's just not asynchronous in the current implementation. 

The code is written as if, especially in QEMU. But this was in my current
understanding a bad decision. The why is the following. It makes reasoning
both about architectural correctness and the code a lot trickier compared
to the interpretation of the guest instruction finishes after the host
instruction finishes (unless we can prove we don't need any) approach.


> So we already know that ssch will return with cc 0.
> 

I will use your example, and another example to explain what I mean
by tricky.

One can probably argue that setting cc 0 even if the host device
responds to the host ssch with cc 3 because the device is not any more
on the given subchannel or simply just disabled. It is probably true
that the guest would not have any means to prove that we were 'lying'
to it.

But AFAIR this is not how the current implementation works. The pwrite
in qemu basically depends on the cc of the host ssch. So if the host
ssch completes with cc 3 the vfio-ccw kernel module map ist to pwrite
reporting -ENODEV and vfio_ccw_handle_request makes sure that the
guest instruction completes with cc 3 by mapping it to return code
IOINST_CC_NOT_OPERATIONAL.

I mentioned xsch in the other thread. I don't think we can tell if
cc 0 or cc 2. In my reading xsch in simple words xsch completes with
cc 2 and does nothing else if the channel subsystem already started talking
to the cu/device. If in time it makes sure we don't start talking to the
device, and clear away stuff. So if we don't consider cc of the xsch
to be issued by the host the only safe bet seems to be cc 2. But that's
effectively getting around implementing the desired functionality of
xsch and still staying architecturally correct. Which however might
be good enough for vfio-ccw. But I think I demonstrated it's kinda
tricky business.

I prefer to avoid tricky if there is no good reason not to.

[..]

> 
> Thanks for reading!
> 

Your welcome. The discussion is kind of taking place all over the
place. I'm actively trying to find the best place to answer, and avoid
overtalking topics -- but it does not seem to work. Please bear with me.

Regards,
Halil
  
[..]

  reply	other threads:[~2018-06-08 20:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 15:48 [Qemu-devel] [PATCH RFC 0/2] vfio-ccw: support for {halt, clear} subchannel Cornelia Huck
2018-05-09 15:48 ` [Qemu-devel] [PATCH RFC 1/2] s390/cio: export hsch to modules Cornelia Huck
2018-05-11  9:36   ` Pierre Morel
2018-05-09 15:48 ` [Qemu-devel] [PATCH RFC 2/2] vfio-ccw: support for halt/clear subchannel Cornelia Huck
2018-05-11  9:33   ` Pierre Morel
2018-05-15 16:10     ` Cornelia Huck
2018-05-16 13:32       ` Pierre Morel
2018-05-22 12:52         ` Cornelia Huck
2018-05-22 15:10           ` Pierre Morel
2018-06-05 13:14             ` Cornelia Huck
2018-06-05 15:23               ` Pierre Morel
2018-06-05 15:36                 ` Cornelia Huck
2018-06-06 12:21                 ` Cornelia Huck
2018-06-06 14:15                   ` Pierre Morel
2018-06-07  9:54                     ` Cornelia Huck
2018-06-07 16:17                       ` [Qemu-devel] [qemu-s390x] " Halil Pasic
2018-06-07 16:34                         ` Cornelia Huck
2018-06-08 20:40                           ` Halil Pasic [this message]
2018-06-11 11:12                             ` Cornelia Huck
2018-06-11 16:00                             ` Cornelia Huck
2018-06-07 16:37                       ` [Qemu-devel] " Pierre Morel
2018-06-08 12:20                         ` Cornelia Huck
2018-06-08 13:13                           ` Halil Pasic
2018-06-08 14:45                             ` Cornelia Huck
2018-06-08 15:51                               ` Pierre Morel
2018-06-12  9:59                                 ` Cornelia Huck
2018-06-12 13:56                                   ` Pierre Morel
2018-06-12 14:08                                     ` Halil Pasic
2018-06-12 15:25                                       ` Cornelia Huck
2018-06-08 21:10                               ` Halil Pasic

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=0c1e1b26-0c6a-fdc2-0c1a-2e2d58c2cb73@linux.ibm.com \
    --to=pasic@linux.ibm.com \
    --cc=bjsdjshi@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --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).