public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, KVM <kvm@vger.kernel.org>,
	Alexander Graf <agraf@suse.de>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Jens Freimann <jfrei@linux.vnet.ibm.com>,
	linux-s390 <linux-s390@vger.kernel.org>
Subject: Re: [GIT PULL 10/11] KVM: s390: handle pending local interrupts via bitmap
Date: Mon, 1 Dec 2014 09:19:16 +0100	[thread overview]
Message-ID: <20141201081916.GA4074@osiris> (raw)
In-Reply-To: <1417181139-25623-11-git-send-email-borntraeger@de.ibm.com>

On Fri, Nov 28, 2014 at 02:25:38PM +0100, Christian Borntraeger wrote:
> +static int __must_check __deliver_mchk_floating(struct kvm_vcpu *vcpu,
> +					   struct kvm_s390_interrupt_info *inti)
> +{
> +	struct kvm_s390_mchk_info *mchk = &inti->mchk;
> +	int rc;
> +
> +	VCPU_EVENT(vcpu, 4, "interrupt: machine check mcic=%llx",
> +		   mchk->mcic);
> +	trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, KVM_S390_MCHK,
> +					 mchk->cr14, mchk->mcic);
> +
> +	rc  = kvm_s390_vcpu_store_status(vcpu, KVM_S390_STORE_STATUS_PREFIXED);
> +	rc |= put_guest_lc(vcpu, mchk->mcic,
> +			(u64 __user *) __LC_MCCK_CODE);
> +	rc |= put_guest_lc(vcpu, mchk->failing_storage_address,
> +			(u64 __user *) __LC_MCCK_FAIL_STOR_ADDR);
> +	rc |= write_guest_lc(vcpu, __LC_PSW_SAVE_AREA,
> +			     &mchk->fixed_logout, sizeof(mchk->fixed_logout));
> +	rc |= write_guest_lc(vcpu, __LC_MCK_OLD_PSW,
> +			     &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
> +	rc |= read_guest_lc(vcpu, __LC_MCK_NEW_PSW,
> +			    &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
> +	return rc;
> +}

FWIW, rc handling seems to be a bit fragile.
The usual return statement for such a pattern is
	return rc ? -EWHATEVER : 0;
so we don't get random or'ed return values.

> -static int __inject_prog_irq(struct kvm_vcpu *vcpu,
> -			     struct kvm_s390_interrupt_info *inti)
> +static int __inject_prog(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq)
>  {
>  	struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
>  
> -	list_add(&inti->list, &li->list);
> -	atomic_set(&li->active, 1);
> +	li->irq.pgm = irq->u.pgm;
> +	__set_bit(IRQ_PEND_PROG, &li->pending_irqs);

        ^^^^^^^^^

> +static int __inject_pfault_init(struct kvm_vcpu *vcpu, struct kvm_s390_irq *irq)
>  {
>  	struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
>  
> -	inti->ext.ext_params2 = s390int->parm64;
> -	list_add_tail(&inti->list, &li->list);
> -	atomic_set(&li->active, 1);
> +	VCPU_EVENT(vcpu, 3, "inject: external irq params:%x, params2:%llx",
> +		   irq->u.ext.ext_params, irq->u.ext.ext_params2);
> +	trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_INT_PFAULT_INIT,
> +				   irq->u.ext.ext_params,
> +				   irq->u.ext.ext_params2, 2);
> +
> +	li->irq.ext = irq->u.ext;
> +	set_bit(IRQ_PEND_PFAULT_INIT, &li->pending_irqs);

        ^^^^^^^

You're using atomic and non-atomic bitops all over the place on the same
object(s). It would be very good to have some consistency here.
And as far as I remember the non-atomic variant is good enough anyway.

  reply	other threads:[~2014-12-01  8:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28 13:25 [GIT PULL 00/11] KVM: s390: Several changes for 3.19 (kvm/next) Christian Borntraeger
2014-11-28 13:25 ` [GIT PULL 01/11] KVM: s390: Small fixes for the PFMF handler Christian Borntraeger
2014-11-28 13:25 ` [GIT PULL 02/11] KVM: s390: Fix rewinding of the PSW pointing to an EXECUTE instruction Christian Borntraeger
2014-11-28 13:25 ` [GIT PULL 03/11] KVM: s390: trigger the right CPU exit for floating interrupts Christian Borntraeger
2014-11-28 13:25 ` [GIT PULL 04/11] KVM: S390: Create helper function get_guest_storage_key Christian Borntraeger
2014-11-28 13:25 ` [GIT PULL 05/11] KVM: s390: refactor interrupt injection code Christian Borntraeger
2014-11-28 17:16   ` Paolo Bonzini
2014-12-01  8:00     ` Christian Borntraeger
2014-12-01  8:22     ` Jens Freimann
2014-11-28 13:25 ` [GIT PULL 06/11] KVM: s390: external param not valid for cpu timer and ckc Christian Borntraeger
2014-11-28 13:25 ` [GIT PULL 07/11] KVM: s390: add defines for virtio and pfault interrupt code Christian Borntraeger
2014-11-28 13:25 ` [GIT PULL 08/11] KVM: s390: refactor interrupt delivery code Christian Borntraeger
2014-11-28 17:17   ` Paolo Bonzini
2014-11-28 13:25 ` [GIT PULL 09/11] KVM: s390: add bitmap for handling cpu-local interrupts Christian Borntraeger
2014-11-28 17:18   ` Paolo Bonzini
2014-11-29 21:05     ` Christian Borntraeger
2014-12-01 14:59       ` Jens Freimann
2014-12-01  8:18     ` Jens Freimann
2014-11-28 13:25 ` [GIT PULL 10/11] KVM: s390: handle pending local interrupts via bitmap Christian Borntraeger
2014-12-01  8:19   ` Heiko Carstens [this message]
2014-12-01  9:46     ` Jens Freimann
2014-11-28 13:25 ` [GIT PULL 11/11] KVM: s390: allow injecting all kinds of machine checks Christian Borntraeger
2014-11-28 17:20 ` [GIT PULL 00/11] KVM: s390: Several changes for 3.19 (kvm/next) 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=20141201081916.GA4074@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.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