xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [patch 15/26] x86: xen: Use the core irq stats function
       [not found] <20140223212703.511977310@linutronix.de>
@ 2014-02-23 21:40 ` Thomas Gleixner
  2014-02-24 14:20   ` David Vrabel
  2014-03-04 16:41   ` [tip:irq/core] x86: Xen: " tip-bot for Thomas Gleixner
  2014-02-23 21:40 ` [patch 18/26] xen: Use the proper irq functions Thomas Gleixner
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 15+ messages in thread
From: Thomas Gleixner @ 2014-02-23 21:40 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, Xen, Ingo Molnar, x86

[-- Attachment #1: x86-xen-use-core-irq-stats-function.patch --]
[-- Type: text/plain, Size: 730 bytes --]

Let the core do the irq_desc resolution.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
Cc: x86 <x86@kernel.org>
---
 arch/x86/xen/spinlock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: tip/arch/x86/xen/spinlock.c
===================================================================
--- tip.orig/arch/x86/xen/spinlock.c
+++ tip/arch/x86/xen/spinlock.c
@@ -183,7 +183,7 @@ __visible void xen_lock_spinning(struct
 
 	local_irq_save(flags);
 
-	kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
+	kstat_incr_irq_this_cpu(irq);
 out:
 	cpumask_clear_cpu(cpu, &waiting_cpus);
 	w->lock = NULL;

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

* [patch 18/26] xen: Use the proper irq functions
       [not found] <20140223212703.511977310@linutronix.de>
  2014-02-23 21:40 ` [patch 15/26] x86: xen: Use the core irq stats function Thomas Gleixner
@ 2014-02-23 21:40 ` Thomas Gleixner
  2014-02-24 14:24   ` David Vrabel
                     ` (2 more replies)
  2014-02-23 21:40 ` [patch 21/26] xen: Get rid of the last irq_desc abuse Thomas Gleixner
  2014-02-23 21:40 ` [patch 23/26] xen: Add proper irq accounting for HYPERCALL vector Thomas Gleixner
  3 siblings, 3 replies; 15+ messages in thread
From: Thomas Gleixner @ 2014-02-23 21:40 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, Xen, Ingo Molnar

[-- Attachment #1: xen-use-the-proper-functions.patch --]
[-- Type: text/plain, Size: 3237 bytes --]

I really can't understand why people keep adding irq_desc abuse. We
have enough proper interfaces. Delete another 14 lines of hackery.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
---
 drivers/xen/events/events_2l.c   |   15 ++++-----------
 drivers/xen/events/events_base.c |    7 ++-----
 drivers/xen/events/events_fifo.c |    8 ++------
 3 files changed, 8 insertions(+), 22 deletions(-)

Index: tip/drivers/xen/events/events_2l.c
===================================================================
--- tip.orig/drivers/xen/events/events_2l.c
+++ tip/drivers/xen/events/events_2l.c
@@ -166,7 +166,6 @@ static void evtchn_2l_handle_events(unsi
 	int start_word_idx, start_bit_idx;
 	int word_idx, bit_idx;
 	int i;
-	struct irq_desc *desc;
 	struct shared_info *s = HYPERVISOR_shared_info;
 	struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
 
@@ -176,11 +175,8 @@ static void evtchn_2l_handle_events(unsi
 		unsigned int evtchn = evtchn_from_irq(irq);
 		word_idx = evtchn / BITS_PER_LONG;
 		bit_idx = evtchn % BITS_PER_LONG;
-		if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx)) {
-			desc = irq_to_desc(irq);
-			if (desc)
-				generic_handle_irq_desc(irq, desc);
-		}
+		if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx))
+			generic_handle_irq(irq);
 	}
 
 	/*
@@ -245,11 +241,8 @@ static void evtchn_2l_handle_events(unsi
 			port = (word_idx * BITS_PER_EVTCHN_WORD) + bit_idx;
 			irq = get_evtchn_to_irq(port);
 
-			if (irq != -1) {
-				desc = irq_to_desc(irq);
-				if (desc)
-					generic_handle_irq_desc(irq, desc);
-			}
+			if (irq != -1)
+				generic_handle_irq(irq);
 
 			bit_idx = (bit_idx + 1) % BITS_PER_EVTCHN_WORD;
 
Index: tip/drivers/xen/events/events_base.c
===================================================================
--- tip.orig/drivers/xen/events/events_base.c
+++ tip/drivers/xen/events/events_base.c
@@ -336,9 +336,8 @@ static void bind_evtchn_to_cpu(unsigned
 
 	BUG_ON(irq == -1);
 #ifdef CONFIG_SMP
-	cpumask_copy(irq_to_desc(irq)->irq_data.affinity, cpumask_of(cpu));
+	cpumask_copy(irq_get_irq_data(irq)->affinity, cpumask_of(cpu));
 #endif
-
 	xen_evtchn_port_bind_to_cpu(info, cpu);
 
 	info->cpu = cpu;
@@ -373,10 +372,8 @@ static void xen_irq_init(unsigned irq)
 {
 	struct irq_info *info;
 #ifdef CONFIG_SMP
-	struct irq_desc *desc = irq_to_desc(irq);
-
 	/* By default all event channels notify CPU#0. */
-	cpumask_copy(desc->irq_data.affinity, cpumask_of(0));
+	cpumask_copy(irq_get_irq_data(irq)->affinity, cpumask_of(0));
 #endif
 
 	info = kzalloc(sizeof(*info), GFP_KERNEL);
Index: tip/drivers/xen/events/events_fifo.c
===================================================================
--- tip.orig/drivers/xen/events/events_fifo.c
+++ tip/drivers/xen/events/events_fifo.c
@@ -235,14 +235,10 @@ static uint32_t clear_linked(volatile ev
 static void handle_irq_for_port(unsigned port)
 {
 	int irq;
-	struct irq_desc *desc;
 
 	irq = get_evtchn_to_irq(port);
-	if (irq != -1) {
-		desc = irq_to_desc(irq);
-		if (desc)
-			generic_handle_irq_desc(irq, desc);
-	}
+	if (irq != -1)
+		generic_handle_irq(irq);
 }
 
 static void consume_one_event(unsigned cpu,

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

* [patch 21/26] xen: Get rid of the last irq_desc abuse
       [not found] <20140223212703.511977310@linutronix.de>
  2014-02-23 21:40 ` [patch 15/26] x86: xen: Use the core irq stats function Thomas Gleixner
  2014-02-23 21:40 ` [patch 18/26] xen: Use the proper irq functions Thomas Gleixner
@ 2014-02-23 21:40 ` Thomas Gleixner
  2014-02-24 14:33   ` David Vrabel
                     ` (3 more replies)
  2014-02-23 21:40 ` [patch 23/26] xen: Add proper irq accounting for HYPERCALL vector Thomas Gleixner
  3 siblings, 4 replies; 15+ messages in thread
From: Thomas Gleixner @ 2014-02-23 21:40 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, Xen, Ingo Molnar

[-- Attachment #1: xen-get-rid-of-the-last-irq-to-desc-abuse.patch --]
[-- Type: text/plain, Size: 2311 bytes --]

I'd prefer to drop that completely but there seems to be some mystic
value to the error printout and the allocation check.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
---
 drivers/xen/events/events_base.c |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

Index: tip/drivers/xen/events/events_base.c
===================================================================
--- tip.orig/drivers/xen/events/events_base.c
+++ tip/drivers/xen/events/events_base.c
@@ -487,13 +487,6 @@ static void pirq_query_unmask(int irq)
 		info->u.pirq.flags |= PIRQ_NEEDS_EOI;
 }
 
-static bool probing_irq(int irq)
-{
-	struct irq_desc *desc = irq_to_desc(irq);
-
-	return desc && desc->action == NULL;
-}
-
 static void eoi_pirq(struct irq_data *data)
 {
 	int evtchn = evtchn_from_irq(data->irq);
@@ -517,7 +510,7 @@ static void mask_ack_pirq(struct irq_dat
 	eoi_pirq(data);
 }
 
-static unsigned int __startup_pirq(unsigned int irq)
+static unsigned int __startup_pirq(struct irq_data *data, unsigned int irq)
 {
 	struct evtchn_bind_pirq bind_pirq;
 	struct irq_info *info = info_for_irq(irq);
@@ -535,7 +528,7 @@ static unsigned int __startup_pirq(unsig
 					BIND_PIRQ__WILL_SHARE : 0;
 	rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq);
 	if (rc != 0) {
-		if (!probing_irq(irq))
+		if (!data || irqd_irq_has_action(data))
 			pr_info("Failed to obtain physical IRQ %d\n", irq);
 		return 0;
 	}
@@ -562,7 +555,7 @@ out:
 
 static unsigned int startup_pirq(struct irq_data *data)
 {
-	return __startup_pirq(data->irq);
+	return __startup_pirq(data, data->irq);
 }
 
 static void shutdown_pirq(struct irq_data *data)
@@ -769,15 +762,13 @@ error_irq:
 
 int xen_destroy_irq(int irq)
 {
-	struct irq_desc *desc;
 	struct physdev_unmap_pirq unmap_irq;
 	struct irq_info *info = info_for_irq(irq);
 	int rc = -ENOENT;
 
 	mutex_lock(&irq_mapping_update_lock);
 
-	desc = irq_to_desc(irq);
-	if (!desc)
+	if (!irq_is_allocated(irq))
 		goto out;
 
 	if (xen_initial_domain()) {
@@ -1432,7 +1423,7 @@ static void restore_pirqs(void)
 
 		printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq);
 
-		__startup_pirq(irq);
+		__startup_pirq(irq_get_irq_data(irq), irq);
 	}
 }

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

* [patch 23/26] xen: Add proper irq accounting for HYPERCALL vector
       [not found] <20140223212703.511977310@linutronix.de>
                   ` (2 preceding siblings ...)
  2014-02-23 21:40 ` [patch 21/26] xen: Get rid of the last irq_desc abuse Thomas Gleixner
@ 2014-02-23 21:40 ` Thomas Gleixner
  2014-02-24 14:48   ` David Vrabel
  2014-03-04 16:42   ` [tip:irq/core] " tip-bot for Thomas Gleixner
  3 siblings, 2 replies; 15+ messages in thread
From: Thomas Gleixner @ 2014-02-23 21:40 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, Xen, Ingo Molnar

[-- Attachment #1: xen-use-vector-accounting.patch --]
[-- Type: text/plain, Size: 597 bytes --]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
---
 drivers/xen/events/events_base.c |    1 +
 1 file changed, 1 insertion(+)

Index: tip/drivers/xen/events/events_base.c
===================================================================
--- tip.orig/drivers/xen/events/events_base.c
+++ tip/drivers/xen/events/events_base.c
@@ -1239,6 +1239,7 @@ void xen_evtchn_do_upcall(struct pt_regs
 #ifdef CONFIG_X86
 	exit_idle();
 #endif
+	inc_irq_stat(irq_hv_callback_count);
 
 	__xen_evtchn_do_upcall();

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

* Re: [patch 15/26] x86: xen: Use the core irq stats function
  2014-02-23 21:40 ` [patch 15/26] x86: xen: Use the core irq stats function Thomas Gleixner
@ 2014-02-24 14:20   ` David Vrabel
  2014-03-04 16:41   ` [tip:irq/core] x86: Xen: " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 15+ messages in thread
From: David Vrabel @ 2014-02-24 14:20 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Peter Zijlstra, Xen, Ingo Molnar, x86, LKML

On 23/02/14 21:40, Thomas Gleixner wrote:
> Let the core do the irq_desc resolution.
> 
> No functional change.

Reviewed-by: David Vrabel <david.vrabel@citrix.com>

David

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

* Re: [patch 18/26] xen: Use the proper irq functions
  2014-02-23 21:40 ` [patch 18/26] xen: Use the proper irq functions Thomas Gleixner
@ 2014-02-24 14:24   ` David Vrabel
       [not found]   ` <530B5624.8080309@citrix.com>
  2014-03-04 16:40   ` [tip:irq/core] " tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 15+ messages in thread
From: David Vrabel @ 2014-02-24 14:24 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Peter Zijlstra, Xen, Ingo Molnar, LKML

On 23/02/14 21:40, Thomas Gleixner wrote:
> I really can't understand why people keep adding irq_desc abuse. We
> have enough proper interfaces. Delete another 14 lines of hackery.

    generic_handler_irq() already tests for !desc so use this instead
    of generic_handle_irq_desc().  Use irq_get_irq_data() instead of
    desc->irq_data.

Otherwise,

Reviewed-by: David Vrabel <david.vrabel@citrix.com>

David

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

* Re: [patch 21/26] xen: Get rid of the last irq_desc abuse
  2014-02-23 21:40 ` [patch 21/26] xen: Get rid of the last irq_desc abuse Thomas Gleixner
@ 2014-02-24 14:33   ` David Vrabel
       [not found]   ` <530B5856.7080900@citrix.com>
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: David Vrabel @ 2014-02-24 14:33 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Peter Zijlstra, Xen, Ingo Molnar, LKML

On 23/02/14 21:40, Thomas Gleixner wrote:
> I'd prefer to drop that completely but there seems to be some mystic
> value to the error printout and the allocation check.

    Warn if any PIRQ cannot be bound to an event channel.  Remove an
    unnecessary test for !desc in xen_destroy_irq() since the only caller
    will only do so if the irq was previously allocated.

> --- tip.orig/drivers/xen/events/events_base.c
> +++ tip/drivers/xen/events/events_base.c
[...]
> @@ -535,7 +528,7 @@ static unsigned int __startup_pirq(unsig
>  					BIND_PIRQ__WILL_SHARE : 0;
>  	rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq);
>  	if (rc != 0) {
> -		if (!probing_irq(irq))
> +		if (!data || irqd_irq_has_action(data))
>  			pr_info("Failed to obtain physical IRQ %d\n", irq);

Remove this if and change the pr_info() to a pr_warn().

This hypercall never fails in practice, but it's still useful to have the
message in case on some systems it does.

>  		return 0;
>  	}
> @@ -769,15 +762,13 @@ error_irq:
>  
>  int xen_destroy_irq(int irq)
>  {
> -	struct irq_desc *desc;
>  	struct physdev_unmap_pirq unmap_irq;
>  	struct irq_info *info = info_for_irq(irq);
>  	int rc = -ENOENT;
>  
>  	mutex_lock(&irq_mapping_update_lock);
>  
> -	desc = irq_to_desc(irq);
> -	if (!desc)
> +	if (!irq_is_allocated(irq))
>  		goto out;

Remove this test.  The only caller of xen_destroy_irq() will only do
so if the irq was previously fully setup.

I think this means you don't need to introduce the irqd_irq_has_action()
and irq_is_allocated() helpers.

David

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

* Re: [patch 23/26] xen: Add proper irq accounting for HYPERCALL vector
  2014-02-23 21:40 ` [patch 23/26] xen: Add proper irq accounting for HYPERCALL vector Thomas Gleixner
@ 2014-02-24 14:48   ` David Vrabel
  2014-03-04 16:42   ` [tip:irq/core] " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 15+ messages in thread
From: David Vrabel @ 2014-02-24 14:48 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Peter Zijlstra, Xen, Ingo Molnar, LKML

On 23/02/14 21:40, Thomas Gleixner wrote:
> --- tip.orig/drivers/xen/events/events_base.c
> +++ tip/drivers/xen/events/events_base.c
> @@ -1239,6 +1239,7 @@ void xen_evtchn_do_upcall(struct pt_regs
>  #ifdef CONFIG_X86
>  	exit_idle();
>  #endif
> +	inc_irq_stat(irq_hv_callback_count);
>  
>  	__xen_evtchn_do_upcall();

Reviewed-by: David Vrabel <david.vrabel@citrix.com>

David

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

* Re: [patch 21/26] xen: Get rid of the last irq_desc abuse
       [not found]   ` <530B5856.7080900@citrix.com>
@ 2014-02-24 21:12     ` Thomas Gleixner
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Gleixner @ 2014-02-24 21:12 UTC (permalink / raw)
  To: David Vrabel; +Cc: Peter Zijlstra, Xen, Ingo Molnar, LKML

On Mon, 24 Feb 2014, David Vrabel wrote:
> On 23/02/14 21:40, Thomas Gleixner wrote:
> > I'd prefer to drop that completely but there seems to be some mystic
> > value to the error printout and the allocation check.
> 
>     Warn if any PIRQ cannot be bound to an event channel.  Remove an
>     unnecessary test for !desc in xen_destroy_irq() since the only caller
>     will only do so if the irq was previously allocated.
> 
> > --- tip.orig/drivers/xen/events/events_base.c
> > +++ tip/drivers/xen/events/events_base.c
> [...]
> > @@ -535,7 +528,7 @@ static unsigned int __startup_pirq(unsig
> >  					BIND_PIRQ__WILL_SHARE : 0;
> >  	rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq);
> >  	if (rc != 0) {
> > -		if (!probing_irq(irq))
> > +		if (!data || irqd_irq_has_action(data))
> >  			pr_info("Failed to obtain physical IRQ %d\n", irq);
> 
> Remove this if and change the pr_info() to a pr_warn().
> 
> This hypercall never fails in practice, but it's still useful to have the
> message in case on some systems it does.

Sure, I understood the value of the printk, but I failed to see the
reason for probing_irq(). Will change it.
 
> >  		return 0;
> >  	}
> > @@ -769,15 +762,13 @@ error_irq:
> >  
> >  int xen_destroy_irq(int irq)
> >  {
> > -	struct irq_desc *desc;
> >  	struct physdev_unmap_pirq unmap_irq;
> >  	struct irq_info *info = info_for_irq(irq);
> >  	int rc = -ENOENT;
> >  
> >  	mutex_lock(&irq_mapping_update_lock);
> >  
> > -	desc = irq_to_desc(irq);
> > -	if (!desc)
> > +	if (!irq_is_allocated(irq))
> >  		goto out;
> 
> Remove this test.  The only caller of xen_destroy_irq() will only do
> so if the irq was previously fully setup.

I was not sure about that, but thanks for confirming.
 
> I think this means you don't need to introduce the irqd_irq_has_action()
> and irq_is_allocated() helpers.

I just invented them in case xen really needs those tests.

Thanks,

	tglx

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

* Re: [patch 18/26] xen: Use the proper irq functions
       [not found]   ` <530B5624.8080309@citrix.com>
@ 2014-02-24 21:13     ` Thomas Gleixner
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Gleixner @ 2014-02-24 21:13 UTC (permalink / raw)
  To: David Vrabel; +Cc: Peter Zijlstra, Xen, Ingo Molnar, LKML

On Mon, 24 Feb 2014, David Vrabel wrote:

> On 23/02/14 21:40, Thomas Gleixner wrote:
> > I really can't understand why people keep adding irq_desc abuse. We
> > have enough proper interfaces. Delete another 14 lines of hackery.
> 
>     generic_handler_irq() already tests for !desc so use this instead
>     of generic_handle_irq_desc().  Use irq_get_irq_data() instead of
>     desc->irq_data.

Fair enough. I was not really in the mood to come up with proper
changelogs :)

> Otherwise,
> 
> Reviewed-by: David Vrabel <david.vrabel@citrix.com>
> 
> David
> 

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

* [tip:irq/core] xen: Use the proper irq functions
  2014-02-23 21:40 ` [patch 18/26] xen: Use the proper irq functions Thomas Gleixner
  2014-02-24 14:24   ` David Vrabel
       [not found]   ` <530B5624.8080309@citrix.com>
@ 2014-03-04 16:40   ` tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Thomas Gleixner @ 2014-03-04 16:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, linux-kernel, david.vrabel, hpa, xen-devel, tglx, mingo

Commit-ID:  589d03e93f6cd595f68891e48f0804f2c8f38aae
Gitweb:     http://git.kernel.org/tip/589d03e93f6cd595f68891e48f0804f2c8f38aae
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 23 Feb 2014 21:40:18 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 4 Mar 2014 17:37:52 +0100

xen: Use the proper irq functions

generic_handler_irq() already tests for !desc so use this instead of
generic_handle_irq_desc().

Use irq_get_irq_data() instead of desc->irq_data.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
Link: http://lkml.kernel.org/r/20140223212738.222412125@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/xen/events/events_2l.c   | 15 ++++-----------
 drivers/xen/events/events_base.c |  7 ++-----
 drivers/xen/events/events_fifo.c |  8 ++------
 3 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c
index d7ff917..5db43fc 100644
--- a/drivers/xen/events/events_2l.c
+++ b/drivers/xen/events/events_2l.c
@@ -166,7 +166,6 @@ static void evtchn_2l_handle_events(unsigned cpu)
 	int start_word_idx, start_bit_idx;
 	int word_idx, bit_idx;
 	int i;
-	struct irq_desc *desc;
 	struct shared_info *s = HYPERVISOR_shared_info;
 	struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
 
@@ -176,11 +175,8 @@ static void evtchn_2l_handle_events(unsigned cpu)
 		unsigned int evtchn = evtchn_from_irq(irq);
 		word_idx = evtchn / BITS_PER_LONG;
 		bit_idx = evtchn % BITS_PER_LONG;
-		if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx)) {
-			desc = irq_to_desc(irq);
-			if (desc)
-				generic_handle_irq_desc(irq, desc);
-		}
+		if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx))
+			generic_handle_irq(irq);
 	}
 
 	/*
@@ -245,11 +241,8 @@ static void evtchn_2l_handle_events(unsigned cpu)
 			port = (word_idx * BITS_PER_EVTCHN_WORD) + bit_idx;
 			irq = get_evtchn_to_irq(port);
 
-			if (irq != -1) {
-				desc = irq_to_desc(irq);
-				if (desc)
-					generic_handle_irq_desc(irq, desc);
-			}
+			if (irq != -1)
+				generic_handle_irq(irq);
 
 			bit_idx = (bit_idx + 1) % BITS_PER_EVTCHN_WORD;
 
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index f4a9e33..7fea02c 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -336,9 +336,8 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
 
 	BUG_ON(irq == -1);
 #ifdef CONFIG_SMP
-	cpumask_copy(irq_to_desc(irq)->irq_data.affinity, cpumask_of(cpu));
+	cpumask_copy(irq_get_irq_data(irq)->affinity, cpumask_of(cpu));
 #endif
-
 	xen_evtchn_port_bind_to_cpu(info, cpu);
 
 	info->cpu = cpu;
@@ -373,10 +372,8 @@ static void xen_irq_init(unsigned irq)
 {
 	struct irq_info *info;
 #ifdef CONFIG_SMP
-	struct irq_desc *desc = irq_to_desc(irq);
-
 	/* By default all event channels notify CPU#0. */
-	cpumask_copy(desc->irq_data.affinity, cpumask_of(0));
+	cpumask_copy(irq_get_irq_data(irq)->affinity, cpumask_of(0));
 #endif
 
 	info = kzalloc(sizeof(*info), GFP_KERNEL);
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index 1de2a19..96109a9 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -235,14 +235,10 @@ static uint32_t clear_linked(volatile event_word_t *word)
 static void handle_irq_for_port(unsigned port)
 {
 	int irq;
-	struct irq_desc *desc;
 
 	irq = get_evtchn_to_irq(port);
-	if (irq != -1) {
-		desc = irq_to_desc(irq);
-		if (desc)
-			generic_handle_irq_desc(irq, desc);
-	}
+	if (irq != -1)
+		generic_handle_irq(irq);
 }
 
 static void consume_one_event(unsigned cpu,

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

* [tip:irq/core] xen: Get rid of the last irq_desc abuse
  2014-02-23 21:40 ` [patch 21/26] xen: Get rid of the last irq_desc abuse Thomas Gleixner
  2014-02-24 14:33   ` David Vrabel
       [not found]   ` <530B5856.7080900@citrix.com>
@ 2014-03-04 16:41   ` tip-bot for Thomas Gleixner
       [not found]   ` <tip-02893afdd310fab8f41f6afbe5233c6609ec19ed@git.kernel.org>
  3 siblings, 0 replies; 15+ messages in thread
From: tip-bot for Thomas Gleixner @ 2014-03-04 16:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, linux-kernel, david.vrabel, hpa, xen-devel, tglx, mingo

Commit-ID:  02893afdd310fab8f41f6afbe5233c6609ec19ed
Gitweb:     http://git.kernel.org/tip/02893afdd310fab8f41f6afbe5233c6609ec19ed
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 23 Feb 2014 21:40:20 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 4 Mar 2014 17:37:53 +0100

xen: Get rid of the last irq_desc abuse

Warn if any PIRQ cannot be bound to an event channel. Remove the check
for irq_desc->action. This hypercall never fails in practice so we can
emit a warning unconditionally.

Remove a check for a valid irq desc. The only caller of
xen_destroy_irq() will only do so if the irq was previously fully
setup, which means the descriptor has been allocated as well.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
Cc: David Vrabel <david.vrabel@citrix.com>
Link: http://lkml.kernel.org/r/20140223212738.579581220@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/xen/events/events_base.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 7fea02c..5dd2ddf 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -487,13 +487,6 @@ static void pirq_query_unmask(int irq)
 		info->u.pirq.flags |= PIRQ_NEEDS_EOI;
 }
 
-static bool probing_irq(int irq)
-{
-	struct irq_desc *desc = irq_to_desc(irq);
-
-	return desc && desc->action == NULL;
-}
-
 static void eoi_pirq(struct irq_data *data)
 {
 	int evtchn = evtchn_from_irq(data->irq);
@@ -535,8 +528,7 @@ static unsigned int __startup_pirq(unsigned int irq)
 					BIND_PIRQ__WILL_SHARE : 0;
 	rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq);
 	if (rc != 0) {
-		if (!probing_irq(irq))
-			pr_info("Failed to obtain physical IRQ %d\n", irq);
+		pr_warn("Failed to obtain physical IRQ %d\n", irq);
 		return 0;
 	}
 	evtchn = bind_pirq.port;
@@ -769,17 +761,12 @@ error_irq:
 
 int xen_destroy_irq(int irq)
 {
-	struct irq_desc *desc;
 	struct physdev_unmap_pirq unmap_irq;
 	struct irq_info *info = info_for_irq(irq);
 	int rc = -ENOENT;
 
 	mutex_lock(&irq_mapping_update_lock);
 
-	desc = irq_to_desc(irq);
-	if (!desc)
-		goto out;
-
 	if (xen_initial_domain()) {
 		unmap_irq.pirq = info->u.pirq.pirq;
 		unmap_irq.domid = info->u.pirq.domid;

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

* [tip:irq/core] x86: Xen: Use the core irq stats function
  2014-02-23 21:40 ` [patch 15/26] x86: xen: Use the core irq stats function Thomas Gleixner
  2014-02-24 14:20   ` David Vrabel
@ 2014-03-04 16:41   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 15+ messages in thread
From: tip-bot for Thomas Gleixner @ 2014-03-04 16:41 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, x86, linux-kernel, david.vrabel, hpa, xen-devel, tglx,
	mingo

Commit-ID:  770144ea7beb3e0537277a96b104ba1daa965f76
Gitweb:     http://git.kernel.org/tip/770144ea7beb3e0537277a96b104ba1daa965f76
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 23 Feb 2014 21:40:16 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 4 Mar 2014 17:37:53 +0100

x86: Xen: Use the core irq stats function

Let the core do the irq_desc resolution.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
Cc: x86 <x86@kernel.org>
Link: http://lkml.kernel.org/r/20140223212737.869264085@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/xen/spinlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 581521c..4d3acc3 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -183,7 +183,7 @@ __visible void xen_lock_spinning(struct arch_spinlock *lock, __ticket_t want)
 
 	local_irq_save(flags);
 
-	kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
+	kstat_incr_irq_this_cpu(irq);
 out:
 	cpumask_clear_cpu(cpu, &waiting_cpus);
 	w->lock = NULL;

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

* [tip:irq/core] xen: Add proper irq accounting for HYPERCALL vector
  2014-02-23 21:40 ` [patch 23/26] xen: Add proper irq accounting for HYPERCALL vector Thomas Gleixner
  2014-02-24 14:48   ` David Vrabel
@ 2014-03-04 16:42   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 15+ messages in thread
From: tip-bot for Thomas Gleixner @ 2014-03-04 16:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, linux-kernel, david.vrabel, hpa, xen-devel, tglx, mingo

Commit-ID:  99c8b79d3c165f8e2a6247c14bfa1429e7efe51f
Gitweb:     http://git.kernel.org/tip/99c8b79d3c165f8e2a6247c14bfa1429e7efe51f
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 23 Feb 2014 21:40:21 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 4 Mar 2014 17:37:54 +0100

xen: Add proper irq accounting for HYPERCALL vector

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
Link: http://lkml.kernel.org/r/20140223212738.808648133@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/xen/events/events_base.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 5dd2ddf..8b91c256 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -1235,6 +1235,7 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
 #ifdef CONFIG_X86
 	exit_idle();
 #endif
+	inc_irq_stat(irq_hv_callback_count);
 
 	__xen_evtchn_do_upcall();

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

* Re: [tip:irq/core] xen: Get rid of the last irq_desc abuse
       [not found]   ` <tip-02893afdd310fab8f41f6afbe5233c6609ec19ed@git.kernel.org>
@ 2014-03-04 17:16     ` David Vrabel
  0 siblings, 0 replies; 15+ messages in thread
From: David Vrabel @ 2014-03-04 17:16 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, konrad.wilk, peterz, xen-devel, tglx,
	david.vrabel
  Cc: tip-bot for Thomas Gleixner, linux-tip-commits

On 04/03/14 16:41, tip-bot for Thomas Gleixner wrote:
> Commit-ID:  02893afdd310fab8f41f6afbe5233c6609ec19ed
> Gitweb:     http://git.kernel.org/tip/02893afdd310fab8f41f6afbe5233c6609ec19ed
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Sun, 23 Feb 2014 21:40:20 +0000
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Tue, 4 Mar 2014 17:37:53 +0100
> 
> xen: Get rid of the last irq_desc abuse
> 
> Warn if any PIRQ cannot be bound to an event channel. Remove the check
> for irq_desc->action. This hypercall never fails in practice so we can
> emit a warning unconditionally.
> 
> Remove a check for a valid irq desc. The only caller of
> xen_destroy_irq() will only do so if the irq was previously fully
> setup, which means the descriptor has been allocated as well.

Reviewed-by: David Vrabel <david.vrabel@citrix.com>

Thanks.

David

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

end of thread, other threads:[~2014-03-04 17:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20140223212703.511977310@linutronix.de>
2014-02-23 21:40 ` [patch 15/26] x86: xen: Use the core irq stats function Thomas Gleixner
2014-02-24 14:20   ` David Vrabel
2014-03-04 16:41   ` [tip:irq/core] x86: Xen: " tip-bot for Thomas Gleixner
2014-02-23 21:40 ` [patch 18/26] xen: Use the proper irq functions Thomas Gleixner
2014-02-24 14:24   ` David Vrabel
     [not found]   ` <530B5624.8080309@citrix.com>
2014-02-24 21:13     ` Thomas Gleixner
2014-03-04 16:40   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-02-23 21:40 ` [patch 21/26] xen: Get rid of the last irq_desc abuse Thomas Gleixner
2014-02-24 14:33   ` David Vrabel
     [not found]   ` <530B5856.7080900@citrix.com>
2014-02-24 21:12     ` Thomas Gleixner
2014-03-04 16:41   ` [tip:irq/core] " tip-bot for Thomas Gleixner
     [not found]   ` <tip-02893afdd310fab8f41f6afbe5233c6609ec19ed@git.kernel.org>
2014-03-04 17:16     ` David Vrabel
2014-02-23 21:40 ` [patch 23/26] xen: Add proper irq accounting for HYPERCALL vector Thomas Gleixner
2014-02-24 14:48   ` David Vrabel
2014-03-04 16:42   ` [tip:irq/core] " tip-bot for Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).