public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Gleb Natapov <gleb@kernel.org>, KVM <kvm@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Thomas Huth <thuth@linux.vnet.ibm.com>
Subject: Re: [GIT PULL 1/6] KVM: s390: Handle MVPG partial execution interception
Date: Wed, 30 Apr 2014 12:07:33 +0200	[thread overview]
Message-ID: <5360CB65.5040109@de.ibm.com> (raw)
In-Reply-To: <20140430080709.GA7723@osiris>

On 30/04/14 10:07, Heiko Carstens wrote:
> On Tue, Apr 29, 2014 at 03:36:43PM +0200, Christian Borntraeger wrote:
>> +static int handle_mvpg_pei(struct kvm_vcpu *vcpu)
>> +{
>> +	unsigned long hostaddr, srcaddr, dstaddr;
>> +	psw_t *psw = &vcpu->arch.sie_block->gpsw;
>> +	struct mm_struct *mm = current->mm;
>> +	int reg1, reg2, rc;
>> +
>> +	kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);
>> +	srcaddr = kvm_s390_real_to_abs(vcpu, vcpu->run->s.regs.gprs[reg2]);
>> +	dstaddr = kvm_s390_real_to_abs(vcpu, vcpu->run->s.regs.gprs[reg1]);
>> +
>> +	/* Make sure that the source is paged-in */
>> +	hostaddr = gmap_fault(srcaddr, vcpu->arch.gmap);
>> +	if (IS_ERR_VALUE(hostaddr))
>> +		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
> 
> FWIW (and nothing that should keep this code from going upstream),
> this is not entirely correct, since gmap_fault() may return -ENOMEM.
> So a host out-of-memory situation will incorrectly result in a guest
> addressing exception, which is most likely not what we want.
> 
Indeed, host out-of-memory situation will cause architectural non-compliance in some areas of KVM/s390.
The proper Linux way (returning -ENOMEM  (or EFAULT?) in the KVM_RUN ioctl) will cause qemu to print an error and abort(), which is also not ideal.
The s390 way, should probably be to inject an uncorrectable storage error machine check.

So the question is what is the right thing to  do for these cases?

Paolo, what is the x86 way of dealing with situations like this (here we fail to allocate a pud,pmd,pte or helper structure). Looks like you return
-ENOMEM to qemu. Is that true for all cases?

Christian




  parent reply	other threads:[~2014-04-30 10:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 13:36 [GIT PULL 0/6] KVM: s390: Fixes and single VCPU speedup Christian Borntraeger
2014-04-29 13:36 ` [GIT PULL 1/6] KVM: s390: Handle MVPG partial execution interception Christian Borntraeger
2014-04-30  8:07   ` Heiko Carstens
2014-04-30  8:53     ` Thomas Huth
2014-04-30 10:07     ` Christian Borntraeger [this message]
2014-04-29 13:36 ` [GIT PULL 2/6] KVM: s390: Add a function for checking the low-address protection Christian Borntraeger
2014-04-29 13:36 ` [GIT PULL 3/6] KVM: s390: Fixes for PFMF Christian Borntraeger
2014-04-29 13:36 ` [GIT PULL 4/6] KVM: s390: Add low-address protection to TEST BLOCK Christian Borntraeger
2014-04-29 13:36 ` [GIT PULL 5/6] KVM: s390: introduce kvm_s390_vcpu_{start,stop} Christian Borntraeger
2014-04-29 13:36 ` [GIT PULL 6/6] KVM: s390: enable IBS for single running VCPUs Christian Borntraeger
2014-04-30 10:30 ` [GIT PULL 0/6] KVM: s390: Fixes and single VCPU speedup Paolo Bonzini

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=5360CB65.5040109@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=gleb@kernel.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@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