All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pass-through: adjust pIRQ migration
@ 2018-09-10 13:59 Jan Beulich
  2018-09-13  5:56 ` Tian, Kevin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jan Beulich @ 2018-09-10 13:59 UTC (permalink / raw)
  To: xen-devel
  Cc: Kevin Tian, Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall

For one it is quite pointless to iterate over all pIRQ-s the domain has
when just one is being adjusted. Introduce hvm_migrate_pirq().

Additionally it is bogus to migrate the pIRQ to a vCPU different from
the one the event is supposed to be posted to - if anything, it might be
worth considering not to migrate the pIRQ at all in the posting case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -462,10 +462,9 @@ void hvm_migrate_timers(struct vcpu *v)
     pt_migrate(v);
 }
 
-static int hvm_migrate_pirq(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
-                            void *arg)
+void hvm_migrate_pirq(struct hvm_pirq_dpci *pirq_dpci, const struct vcpu *v)
 {
-    struct vcpu *v = arg;
+    ASSERT(iommu_enabled && hvm_domain_irq(v->domain)->dpci);
 
     if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) &&
          /* Needn't migrate pirq if this pirq is delivered to guest directly.*/
@@ -476,11 +475,17 @@ static int hvm_migrate_pirq(struct domai
             pirq_spin_lock_irq_desc(dpci_pirq(pirq_dpci), NULL);
 
         if ( !desc )
-            return 0;
+            return;
         ASSERT(MSI_IRQ(desc - irq_desc));
         irq_set_affinity(desc, cpumask_of(v->processor));
         spin_unlock_irq(&desc->lock);
     }
+}
+
+static int migrate_pirq(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
+                        void *arg)
+{
+    hvm_migrate_pirq(pirq_dpci, arg);
 
     return 0;
 }
@@ -493,7 +498,7 @@ void hvm_migrate_pirqs(struct vcpu *v)
        return;
 
     spin_lock(&d->event_lock);
-    pt_pirq_iterate(d, hvm_migrate_pirq, v);
+    pt_pirq_iterate(d, migrate_pirq, v);
     spin_unlock(&d->event_lock);
 }
 
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -434,8 +434,8 @@ int pt_irq_create_bind(
             if ( vcpu )
                 pirq_dpci->gmsi.posted = true;
         }
-        if ( dest_vcpu_id >= 0 )
-            hvm_migrate_pirqs(d->vcpu[dest_vcpu_id]);
+        if ( vcpu && iommu_enabled )
+            hvm_migrate_pirq(pirq_dpci, vcpu);
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -288,6 +288,7 @@ bool hvm_set_guest_bndcfgs(struct vcpu *
 bool hvm_check_cpuid_faulting(struct vcpu *v);
 void hvm_migrate_timers(struct vcpu *v);
 void hvm_do_resume(struct vcpu *v);
+void hvm_migrate_pirq(struct hvm_pirq_dpci *pirq_dpci, const struct vcpu *v);
 void hvm_migrate_pirqs(struct vcpu *v);
 
 void hvm_inject_event(const struct x86_event *event);





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] pass-through: adjust pIRQ migration
  2018-09-10 13:59 [PATCH] pass-through: adjust pIRQ migration Jan Beulich
@ 2018-09-13  5:56 ` Tian, Kevin
  2018-09-13  8:52   ` Jan Beulich
  2018-09-13 16:44 ` Wei Liu
  2018-11-09 11:44 ` Andrew Cooper
  2 siblings, 1 reply; 7+ messages in thread
From: Tian, Kevin @ 2018-09-13  5:56 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall

> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Monday, September 10, 2018 9:59 PM
> 
> For one it is quite pointless to iterate over all pIRQ-s the domain has
> when just one is being adjusted. Introduce hvm_migrate_pirq().

it's migrate_pirq being introduced here.

> 
> Additionally it is bogus to migrate the pIRQ to a vCPU different from
> the one the event is supposed to be posted to - if anything, it might be
> worth considering not to migrate the pIRQ at all in the posting case.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] pass-through: adjust pIRQ migration
  2018-09-13  5:56 ` Tian, Kevin
@ 2018-09-13  8:52   ` Jan Beulich
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Beulich @ 2018-09-13  8:52 UTC (permalink / raw)
  To: Kevin Tian
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

>>> On 13.09.18 at 07:56, <kevin.tian@intel.com> wrote:
>>  From: Jan Beulich [mailto:JBeulich@suse.com]
>> Sent: Monday, September 10, 2018 9:59 PM
>> 
>> For one it is quite pointless to iterate over all pIRQ-s the domain has
>> when just one is being adjusted. Introduce hvm_migrate_pirq().
> 
> it's migrate_pirq being introduced here.

Well, yes and no: As a static function, it should have been named
migrate_pirq() already before. The statement above is about this
becoming an externally accessible function. I'll add "externally
accessible" to the description.

>> Additionally it is bogus to migrate the pIRQ to a vCPU different from
>> the one the event is supposed to be posted to - if anything, it might be
>> worth considering not to migrate the pIRQ at all in the posting case.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>

Thanks.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] pass-through: adjust pIRQ migration
  2018-09-10 13:59 [PATCH] pass-through: adjust pIRQ migration Jan Beulich
  2018-09-13  5:56 ` Tian, Kevin
@ 2018-09-13 16:44 ` Wei Liu
  2018-10-26 10:58   ` Ping: " Jan Beulich
  2018-11-09 11:44 ` Andrew Cooper
  2 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2018-09-13 16:44 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Kevin Tian, Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

On Mon, Sep 10, 2018 at 07:59:16AM -0600, Jan Beulich wrote:
> For one it is quite pointless to iterate over all pIRQ-s the domain has
> when just one is being adjusted. Introduce hvm_migrate_pirq().
> 
> Additionally it is bogus to migrate the pIRQ to a vCPU different from
> the one the event is supposed to be posted to - if anything, it might be
> worth considering not to migrate the pIRQ at all in the posting case.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Ping: [PATCH] pass-through: adjust pIRQ migration
  2018-09-13 16:44 ` Wei Liu
@ 2018-10-26 10:58   ` Jan Beulich
  2018-11-09 11:29     ` Ping#2: " Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2018-10-26 10:58 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Kevin Tian, Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall, xen-devel

>>> On 13.09.18 at 18:44, <wei.liu2@citrix.com> wrote:
> On Mon, Sep 10, 2018 at 07:59:16AM -0600, Jan Beulich wrote:
>> For one it is quite pointless to iterate over all pIRQ-s the domain has
>> when just one is being adjusted. Introduce hvm_migrate_pirq().
>> 
>> Additionally it is bogus to migrate the pIRQ to a vCPU different from
>> the one the event is supposed to be posted to - if anything, it might be
>> worth considering not to migrate the pIRQ at all in the posting case.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Wei Liu <wei.liu2@citrix.com>

Andrew,

can I get your ack (or otherwise) on the x86-specific part of this
change, please?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Ping#2: [PATCH] pass-through: adjust pIRQ migration
  2018-10-26 10:58   ` Ping: " Jan Beulich
@ 2018-11-09 11:29     ` Jan Beulich
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Beulich @ 2018-11-09 11:29 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Kevin Tian, Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall, xen-devel

>>> On 26.10.18 at 12:58, <JBeulich@suse.com> wrote:
>>>> On 13.09.18 at 18:44, <wei.liu2@citrix.com> wrote:
>> On Mon, Sep 10, 2018 at 07:59:16AM -0600, Jan Beulich wrote:
>>> For one it is quite pointless to iterate over all pIRQ-s the domain has
>>> when just one is being adjusted. Introduce hvm_migrate_pirq().
>>> 
>>> Additionally it is bogus to migrate the pIRQ to a vCPU different from
>>> the one the event is supposed to be posted to - if anything, it might be
>>> worth considering not to migrate the pIRQ at all in the posting case.
>>> 
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> 
>> Reviewed-by: Wei Liu <wei.liu2@citrix.com>
> 
> Andrew,
> 
> can I get your ack (or otherwise) on the x86-specific part of this
> change, please?

One more try. Unless I get a response within a week I'll commit based
on Kevin's and Wei's R-b.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] pass-through: adjust pIRQ migration
  2018-09-10 13:59 [PATCH] pass-through: adjust pIRQ migration Jan Beulich
  2018-09-13  5:56 ` Tian, Kevin
  2018-09-13 16:44 ` Wei Liu
@ 2018-11-09 11:44 ` Andrew Cooper
  2 siblings, 0 replies; 7+ messages in thread
From: Andrew Cooper @ 2018-11-09 11:44 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Kevin Tian, Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall

On 10/09/18 14:59, Jan Beulich wrote:
> For one it is quite pointless to iterate over all pIRQ-s the domain has
> when just one is being adjusted. Introduce hvm_migrate_pirq().
>
> Additionally it is bogus to migrate the pIRQ to a vCPU different from
> the one the event is supposed to be posted to - if anything, it might be
> worth considering not to migrate the pIRQ at all in the posting case.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-09 11:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10 13:59 [PATCH] pass-through: adjust pIRQ migration Jan Beulich
2018-09-13  5:56 ` Tian, Kevin
2018-09-13  8:52   ` Jan Beulich
2018-09-13 16:44 ` Wei Liu
2018-10-26 10:58   ` Ping: " Jan Beulich
2018-11-09 11:29     ` Ping#2: " Jan Beulich
2018-11-09 11:44 ` Andrew Cooper

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.