public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Collin Walling <walling@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	cohuck@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH v5 2/2] s390/kvm: diagnose 318 handling
Date: Tue, 2 Jul 2019 22:00:14 +0200	[thread overview]
Message-ID: <78617ca5-d822-ea4e-60ef-7a545b23ef15@de.ibm.com> (raw)
In-Reply-To: <ae6e3725-2d5e-3fc6-96bf-7875fb14d919@linux.ibm.com>



On 02.07.19 21:50, Collin Walling wrote:
> On 6/26/19 10:31 AM, David Hildenbrand wrote:
>> On 26.06.19 16:30, Collin Walling wrote:
>>> On 6/26/19 6:28 AM, Christian Borntraeger wrote:
>>>>
>>>>
>>>> On 26.06.19 11:45, David Hildenbrand wrote:
>>>>
>>>>>
>>>>> BTW. there is currently no mechanism to fake absence of diag318. Should
>>>>> we have one? (in contrast, for CMMA we have, which is also a CPU feature)
>>>>
>>>> Yes, we want to be able to disable diag318 via a CPU model feature. That actually
>>>> means that the kernel must not answer this if we disable it.
>>>>
>>> Correct. If the guest specifies diag318=off, then the instruction
>>> shouldn't be executed (it is fenced off in the kernel by checking the
>>> Read SCP Info bit).
>>
>> But the guest *could* execute it and not get an exception.
>>
> 
> IIUC, you're talking about the situation where QEMU supports diag318,
> but KVM does not. The worst case is the guest specifies diag318=on, and
> nothing will stop the guest from attempting to execute the instruction.
> 
> However, this is fenced in my QEMU patches. In (v5), I have this
> following snippet:
> 
> @@ -2323,6 +2345,13 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
>          KVM_S390_VM_CRYPTO_ENABLE_APIE)) {
>          set_bit(S390_FEAT_AP, model->features);
>      }
> +
> +    /* if KVM supports interception of diag318, then let's provide the bit */
> +    if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_MISC,
> +        KVM_S390_VM_MISC_DIAG318)) {
> +        set_bit(S390_FEAT_DIAG318, model->features);
> +    }
> +
>      /* strip of features that are not part of the maximum model */
>      bitmap_and(model->features, model->features, model->def->full_feat,
>                 S390_FEAT_MAX);
> 
> If the guest specifies diag318=on, and KVM does *not* support emulation,
> then the following message will be observed:
> 
> qemu-system-s390x: Some features requested in the CPU model are not
> available in the configuration: diag318
> 
> and the guest will fail to start. Does this suffice?

But what happens if the guest ignores read scp info and executes diag318 anyway.
It should get a specification exception, but it does not instead diag318 is
executed.


  reply	other threads:[~2019-07-03  0:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 15:03 [PATCH v5 0/2] Use DIAG318 to set Control Program Name & Version Codes Collin Walling
2019-06-25 15:03 ` [PATCH v5 1/2] s390/setup: diag318: refactor struct Collin Walling
2019-06-26 11:42   ` Cornelia Huck
2019-06-25 15:03 ` [PATCH v5 2/2] s390/kvm: diagnose 318 handling Collin Walling
2019-06-26  9:08   ` David Hildenbrand
2019-06-26 13:57     ` Collin Walling
2019-06-26  9:45   ` David Hildenbrand
2019-06-26 10:28     ` Christian Borntraeger
2019-06-26 14:30       ` Collin Walling
2019-06-26 14:31         ` David Hildenbrand
2019-07-02 19:50           ` Collin Walling
2019-07-02 20:00             ` Christian Borntraeger [this message]
2019-07-02 20:04               ` Collin Walling
2019-07-02 20:08                 ` Christian Borntraeger
2019-06-26 12:11   ` Cornelia Huck
2019-06-26 13:51     ` Collin Walling
2019-06-25 15:20 ` [PATCH v5 0/2] Use DIAG318 to set Control Program Name & Version Codes Collin Walling

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=78617ca5-d822-ea4e-60ef-7a545b23ef15@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=walling@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