All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Christoffer Dall" <cdall@cs.columbia.edu>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>,
	"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: linux-next: manual merge of the kvm-arm tree with Linus' tree
Date: Wed, 8 Apr 2015 09:15:13 +0100	[thread overview]
Message-ID: <20150408091513.4e676301@why.wild-wind.fr.eu.org> (raw)
In-Reply-To: <552403BF.8090008@redhat.com>

On Tue, 7 Apr 2015 17:20:15 +0100
Paolo Bonzini <pbonzini@redhat.com> wrote:

Hi Paolo,

> On 18/03/2015 08:55, Christoffer Dall wrote:
> > Hi Stephen,
> > 
> > On Wed, Mar 18, 2015 at 02:41:11PM +1100, Stephen Rothwell wrote:
> >> Hi all,
> >>
> >> Today's linux-next merge of the kvm-arm tree got a conflict in
> >> virt/kvm/arm/vgic.c between commit ae705930fca6 ("arm/arm64: KVM: Keep
> >> elrsr/aisr in sync with software model") from Linus' tree and commit
> >> 71760950bf3d ("arm/arm64: KVM: add a common vgic_queue_irq_to_lr fn")
> >> from the kvm-arm tree.
> >>
> >> I fixed it up (I think - see below) and can carry the fix as necessary
> >> (no action is required).
> >>
> >> -- 
> >> Cheers,
> >> Stephen Rothwell                    sfr@canb.auug.org.au
> >>
> >> diff --cc virt/kvm/arm/vgic.c
> >> index c9f60f524588,ffd937ca5141..000000000000
> >> --- a/virt/kvm/arm/vgic.c
> >> +++ b/virt/kvm/arm/vgic.c
> >> @@@ -982,9 -1092,7 +1098,8 @@@ bool vgic_queue_irq(struct kvm_vcpu *vc
> >>   		if (vlr.source == sgi_source_id) {
> >>   			kvm_debug("LR%d piggyback for IRQ%d\n", lr, vlr.irq);
> >>   			BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
> >> - 			vlr.state |= LR_STATE_PENDING;
> >> - 			vgic_set_lr(vcpu, lr, vlr);
> >> + 			vgic_queue_irq_to_lr(vcpu, irq, lr, vlr);
> >>  +			vgic_sync_lr_elrsr(vcpu, lr, vlr);
> >>   			return true;
> >>   		}
> >>   	}
> >> @@@ -1001,12 -1109,8 +1116,9 @@@
> >>   
> >>   	vlr.irq = irq;
> >>   	vlr.source = sgi_source_id;
> >> - 	vlr.state = LR_STATE_PENDING;
> >> - 	if (!vgic_irq_is_edge(vcpu, irq))
> >> - 		vlr.state |= LR_EOI_INT;
> >> - 
> >> - 	vgic_set_lr(vcpu, lr, vlr);
> >> + 	vlr.state = 0;
> >> + 	vgic_queue_irq_to_lr(vcpu, irq, lr, vlr);
> >>  +	vgic_sync_lr_elrsr(vcpu, lr, vlr);
> >>   
> >>   	return true;
> >>   }
> > 
> > Looks great, thanks!
> > -Christoffer
> 
> Got the same conflict when pulling from the kvm-arm tree, I used
> a different resolution though:
> 
> diff --cc virt/kvm/arm/vgic.c
> index c9f60f524588,b70174e74868..8d550ff14700
> --- a/virt/kvm/arm/vgic.c
> +++ b/virt/kvm/arm/vgic.c
> @@@ -955,6 -1095,25 +1101,26 @@@ static void vgic_retire_disabled_irqs(s
>   	}
>   }
>   
> + static void vgic_queue_irq_to_lr(struct kvm_vcpu *vcpu, int irq,
> + 				 int lr_nr, struct vgic_lr vlr)
> + {
> + 	if (vgic_irq_is_active(vcpu, irq)) {
> + 		vlr.state |= LR_STATE_ACTIVE;
> + 		kvm_debug("Set active, clear distributor: 0x%x\n", vlr.state);
> + 		vgic_irq_clear_active(vcpu, irq);
> + 		vgic_update_state(vcpu->kvm);
> + 	} else if (vgic_dist_irq_is_pending(vcpu, irq)) {
> + 		vlr.state |= LR_STATE_PENDING;
> + 		kvm_debug("Set pending: 0x%x\n", vlr.state);
> + 	}
> + 
> + 	if (!vgic_irq_is_edge(vcpu, irq))
> + 		vlr.state |= LR_EOI_INT;
> + 
> + 	vgic_set_lr(vcpu, lr_nr, vlr);
> ++	vgic_sync_lr_elrsr(vcpu, lr_nr, vlr);
> + }
> + 
>   /*
>    * Queue an interrupt to a CPU virtual interface. Return true on success,
>    * or false if it wasn't possible to queue it.
> @@@ -982,9 -1141,7 +1148,7 @@@ bool vgic_queue_irq(struct kvm_vcpu *vc
>                 if (vlr.source == sgi_source_id) {
>                         kvm_debug("LR%d piggyback for IRQ%d\n", lr, vlr.irq);
>                         BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
> -                       vlr.state |= LR_STATE_PENDING;
> -                       vgic_set_lr(vcpu, lr, vlr);
> -                       vgic_sync_lr_elrsr(vcpu, lr, vlr);
> +                       vgic_queue_irq_to_lr(vcpu, irq, lr, vlr);
>                         return true;
>                 }
>         }
> @@@ -1001,12 -1158,8 +1165,8 @@@
>   
>         vlr.irq = irq;
>         vlr.source = sgi_source_id;
> -       vlr.state = LR_STATE_PENDING;
> -       if (!vgic_irq_is_edge(vcpu, irq))
> -               vlr.state |= LR_EOI_INT;
> - 
> -       vgic_set_lr(vcpu, lr, vlr);
> -       vgic_sync_lr_elrsr(vcpu, lr, vlr);
> +       vlr.state = 0;
> +       vgic_queue_irq_to_lr(vcpu, irq, lr, vlr);
>   
>         return true;
>   }
> 
> 
> Christoffer, this is the same logic as Stephen's resolution, but
> can you confirm that it makes sense "semantically" as well?

This looks like a sensible resolution to me. I've given it a spin, and
it seems to behave as expected.

Thanks,

	M.
-- 
Without deviation from the norm, progress is not possible.

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Christoffer Dall <cdall@cs.columbia.edu>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: linux-next: manual merge of the kvm-arm tree with Linus' tree
Date: Wed, 8 Apr 2015 09:15:13 +0100	[thread overview]
Message-ID: <20150408091513.4e676301@why.wild-wind.fr.eu.org> (raw)
In-Reply-To: <552403BF.8090008@redhat.com>

On Tue, 7 Apr 2015 17:20:15 +0100
Paolo Bonzini <pbonzini@redhat.com> wrote:

Hi Paolo,

> On 18/03/2015 08:55, Christoffer Dall wrote:
> > Hi Stephen,
> > 
> > On Wed, Mar 18, 2015 at 02:41:11PM +1100, Stephen Rothwell wrote:
> >> Hi all,
> >>
> >> Today's linux-next merge of the kvm-arm tree got a conflict in
> >> virt/kvm/arm/vgic.c between commit ae705930fca6 ("arm/arm64: KVM: Keep
> >> elrsr/aisr in sync with software model") from Linus' tree and commit
> >> 71760950bf3d ("arm/arm64: KVM: add a common vgic_queue_irq_to_lr fn")
> >> from the kvm-arm tree.
> >>
> >> I fixed it up (I think - see below) and can carry the fix as necessary
> >> (no action is required).
> >>
> >> -- 
> >> Cheers,
> >> Stephen Rothwell                    sfr@canb.auug.org.au
> >>
> >> diff --cc virt/kvm/arm/vgic.c
> >> index c9f60f524588,ffd937ca5141..000000000000
> >> --- a/virt/kvm/arm/vgic.c
> >> +++ b/virt/kvm/arm/vgic.c
> >> @@@ -982,9 -1092,7 +1098,8 @@@ bool vgic_queue_irq(struct kvm_vcpu *vc
> >>   		if (vlr.source == sgi_source_id) {
> >>   			kvm_debug("LR%d piggyback for IRQ%d\n", lr, vlr.irq);
> >>   			BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
> >> - 			vlr.state |= LR_STATE_PENDING;
> >> - 			vgic_set_lr(vcpu, lr, vlr);
> >> + 			vgic_queue_irq_to_lr(vcpu, irq, lr, vlr);
> >>  +			vgic_sync_lr_elrsr(vcpu, lr, vlr);
> >>   			return true;
> >>   		}
> >>   	}
> >> @@@ -1001,12 -1109,8 +1116,9 @@@
> >>   
> >>   	vlr.irq = irq;
> >>   	vlr.source = sgi_source_id;
> >> - 	vlr.state = LR_STATE_PENDING;
> >> - 	if (!vgic_irq_is_edge(vcpu, irq))
> >> - 		vlr.state |= LR_EOI_INT;
> >> - 
> >> - 	vgic_set_lr(vcpu, lr, vlr);
> >> + 	vlr.state = 0;
> >> + 	vgic_queue_irq_to_lr(vcpu, irq, lr, vlr);
> >>  +	vgic_sync_lr_elrsr(vcpu, lr, vlr);
> >>   
> >>   	return true;
> >>   }
> > 
> > Looks great, thanks!
> > -Christoffer
> 
> Got the same conflict when pulling from the kvm-arm tree, I used
> a different resolution though:
> 
> diff --cc virt/kvm/arm/vgic.c
> index c9f60f524588,b70174e74868..8d550ff14700
> --- a/virt/kvm/arm/vgic.c
> +++ b/virt/kvm/arm/vgic.c
> @@@ -955,6 -1095,25 +1101,26 @@@ static void vgic_retire_disabled_irqs(s
>   	}
>   }
>   
> + static void vgic_queue_irq_to_lr(struct kvm_vcpu *vcpu, int irq,
> + 				 int lr_nr, struct vgic_lr vlr)
> + {
> + 	if (vgic_irq_is_active(vcpu, irq)) {
> + 		vlr.state |= LR_STATE_ACTIVE;
> + 		kvm_debug("Set active, clear distributor: 0x%x\n", vlr.state);
> + 		vgic_irq_clear_active(vcpu, irq);
> + 		vgic_update_state(vcpu->kvm);
> + 	} else if (vgic_dist_irq_is_pending(vcpu, irq)) {
> + 		vlr.state |= LR_STATE_PENDING;
> + 		kvm_debug("Set pending: 0x%x\n", vlr.state);
> + 	}
> + 
> + 	if (!vgic_irq_is_edge(vcpu, irq))
> + 		vlr.state |= LR_EOI_INT;
> + 
> + 	vgic_set_lr(vcpu, lr_nr, vlr);
> ++	vgic_sync_lr_elrsr(vcpu, lr_nr, vlr);
> + }
> + 
>   /*
>    * Queue an interrupt to a CPU virtual interface. Return true on success,
>    * or false if it wasn't possible to queue it.
> @@@ -982,9 -1141,7 +1148,7 @@@ bool vgic_queue_irq(struct kvm_vcpu *vc
>                 if (vlr.source == sgi_source_id) {
>                         kvm_debug("LR%d piggyback for IRQ%d\n", lr, vlr.irq);
>                         BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
> -                       vlr.state |= LR_STATE_PENDING;
> -                       vgic_set_lr(vcpu, lr, vlr);
> -                       vgic_sync_lr_elrsr(vcpu, lr, vlr);
> +                       vgic_queue_irq_to_lr(vcpu, irq, lr, vlr);
>                         return true;
>                 }
>         }
> @@@ -1001,12 -1158,8 +1165,8 @@@
>   
>         vlr.irq = irq;
>         vlr.source = sgi_source_id;
> -       vlr.state = LR_STATE_PENDING;
> -       if (!vgic_irq_is_edge(vcpu, irq))
> -               vlr.state |= LR_EOI_INT;
> - 
> -       vgic_set_lr(vcpu, lr, vlr);
> -       vgic_sync_lr_elrsr(vcpu, lr, vlr);
> +       vlr.state = 0;
> +       vgic_queue_irq_to_lr(vcpu, irq, lr, vlr);
>   
>         return true;
>   }
> 
> 
> Christoffer, this is the same logic as Stephen's resolution, but
> can you confirm that it makes sense "semantically" as well?

This looks like a sensible resolution to me. I've given it a spin, and
it seems to behave as expected.

Thanks,

	M.
-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2015-04-08  8:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  3:41 linux-next: manual merge of the kvm-arm tree with Linus' tree Stephen Rothwell
2015-03-18  7:55 ` Christoffer Dall
2015-04-07 16:20   ` Paolo Bonzini
2015-04-08  8:15     ` Marc Zyngier [this message]
2015-04-08  8:15       ` Marc Zyngier
2015-04-08 10:57       ` Christoffer Dall
2015-04-16 19:10     ` Christoffer Dall
2015-04-16 19:39       ` Paolo Bonzini
2015-04-16 20:16         ` Christoffer Dall
  -- strict thread matches above, loose matches on Subject: below --
2018-01-03  2:38 Stephen Rothwell
2018-01-03  9:50 ` Christoffer Dall
2017-11-06  2:56 Stephen Rothwell
2017-11-06  2:52 Stephen Rothwell
2017-04-10  4:02 Stephen Rothwell
2017-04-10  8:02 ` Christoffer Dall
2014-10-17  1:47 Stephen Rothwell
2014-07-31  6:30 Stephen Rothwell
2014-07-31 12:10 ` Marc Zyngier
2014-07-31 12:10   ` Marc Zyngier
     [not found] ` <CAEDV+gJ1oSPzgZMO=kdFDNPnzy-EOHGuLxHqTB8KO6d_8yPrxQ@mail.gmail.com>
2014-07-31 12:15   ` Marc Zyngier
2014-07-31 12:15     ` Marc Zyngier
2014-07-31 14:23     ` Christoffer Dall
2014-07-31 14:30       ` Marc Zyngier
2014-07-31 14:30         ` Marc Zyngier
2014-08-01  5:21       ` Stephen Rothwell
2014-07-31 12:17   ` Stephen Rothwell
2014-07-31 12:41     ` Stephen Rothwell

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=20150408091513.4e676301@why.wild-wind.fr.eu.org \
    --to=marc.zyngier@arm.com \
    --cc=alex.bennee@linaro.org \
    --cc=cdall@cs.columbia.edu \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sfr@canb.auug.org.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.