From: Marc Zyngier <marc.zyngier@arm.com>
To: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org, Jason Cooper <jason@lakedaemon.net>,
Thomas Gleixner <tglx@linutronix.de>,
Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH 35/38] irqchip: mips-gic: Use pcpu_masks to avoid reading GIC_SH_MASK*
Date: Fri, 18 Aug 2017 18:25:06 +0100 [thread overview]
Message-ID: <f44d57df-1071-94f6-75cf-83f5175abf50@arm.com> (raw)
In-Reply-To: <34162033.30QQ0eu7r0@np-p-burton>
On 18/08/17 18:11, Paul Burton wrote:
> Hi Marc,
>
> On Friday, 18 August 2017 08:44:15 PDT Marc Zyngier wrote:
>> On 13/08/17 05:36, Paul Burton wrote:
>>> This patch avoids the need to read the GIC_SH_MASK* registers when
>>> decoding shared interrupts by setting & clearing the interrupt's bit in
>>> the appropriate CPU's pcpu_masks entry when masking or unmasking the
>>> interrupt.
>>>
>>> This effectively means that whilst an interrupt is masked we clear its
>>> bit in all pcpu_masks, which causes gic_handle_shared_int() to ignore it
>>> on all CPUs without needing to check GIC_SH_MASK*.
>>>
>>> In essence, we add a little overhead to masking or unmasking interrupts
>>> but in return reduce the overhead of the far more common task of
>>> decoding interrupts.
>>>
>>> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
>>> Cc: Jason Cooper <jason@lakedaemon.net>
>>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>>> Cc: Ralf Baechle <ralf@linux-mips.org>
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>> Cc: linux-mips@linux-mips.org
>>> ---
>>>
>>> drivers/irqchip/irq-mips-gic.c | 49
>>> ++++++++++++++++++++++++------------------ 1 file changed, 28
>>> insertions(+), 21 deletions(-)
>>>
>>> diff --git a/drivers/irqchip/irq-mips-gic.c
>>> b/drivers/irqchip/irq-mips-gic.c index 00153231376a..7a42f0b3822f 100644
>>> --- a/drivers/irqchip/irq-mips-gic.c
>>> +++ b/drivers/irqchip/irq-mips-gic.c
>>> @@ -55,6 +55,19 @@ static struct irq_chip gic_level_irq_controller,
>>> gic_edge_irq_controller;>
>>> DECLARE_BITMAP(ipi_resrv, GIC_MAX_INTRS);
>>> DECLARE_BITMAP(ipi_available, GIC_MAX_INTRS);
>>>
>>> +static void gic_setup_pcpu_mask(unsigned int intr, unsigned int cpu)
>>> +{
>>> + unsigned int i;
>>> +
>>> + /* Clear the interrupt's bit in all pcpu_masks */
>>> + for_each_possible_cpu(i)
>>> + clear_bit(intr, per_cpu_ptr(pcpu_masks, i));
>>
>> This iterates from 0 to nr_cpu_ids-1...
>>
>>> +
>>> + /* Set the interrupt's bit in the appropriate CPU's mask */
>>> + if (cpu < NR_CPUS)
>>
>> and here you're using NR_CPUS. I'm a bit worried that you're not quite
>> using the same thing (nr_cpu_ids <= NR_CPUS).
>
> I think that would be fine - if nr_cpu_ids is less than NR_CPUS then all we
> risk is leaving bits set in the mask for CPUs that aren't in cpu_possible_mask
> (which is where nr_cpu_ids comes from). Since those CPUs don't exist & thus
> can't take interrupts they'll never check the bits in their mask.
>
> The NR_CPUS check here is basically just to allow the interrupt to be set in
> none of the masks when called by gic_mask_irq() - NR_CPUS is just some
> constant value that we know will never be the ID of a CPU that an interrupt's
> affinity is set to.
>
> Perhaps it'd be clearer to instead split gic_setup_pcpu_mask() into 2
> functions - one to just clear all the masks, and one to set the interrupt's
> bit in the appropriate one? Possibly just inline that second one. That way we
> wouldn't be using NR_CPUS at all here which might be clearer. How does that
> sound?
That'd probably be best, even if that's a couple extra lines here and
there. This NR_CPUS is just confusing.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2017-08-18 17:25 UTC|newest]
Thread overview: 111+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-13 4:36 [PATCH 00/38] irqchip: mips-gic: Cleanup & optimisation Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 01/38] irqchip: mips-gic: SYNC after enabling GIC region Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 02/38] MIPS: GIC: Introduce asm/mips-gic.h with accessor functions Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-18 11:10 ` Marc Zyngier
2017-08-18 16:43 ` Paul Burton
2017-08-18 16:43 ` Paul Burton
2017-08-13 4:36 ` [PATCH 03/38] clocksource: mips-gic-timer: Use new GIC " Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 04/38] irqchip: mips-gic: Remove counter access functions Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 05/38] MIPS: CPS: Read GIC_VL_IDENT directly, not via irqchip driver Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 06/38] irqchip: mips-gic: Remove gic_read_local_vp_id() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 07/38] lib/iomap_copy.c: Add __ioread64_copy Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 08/38] irqchip: mips-gic: Simplify shared interrupt pending/mask reads Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 09/38] irqchip: mips-gic: Simplify gic_local_irq_domain_map() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 10/38] irqchip: mips-gic: Drop gic_(re)set_mask() functions Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 11/38] irqchip: mips-gic: Remove gic_set_polarity() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 12/38] irqchip: mips-gic: Remove gic_set_trigger() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 13/38] irqchip: mips-gic: Remove gic_set_dual_edge() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 14/38] irqchip: mips-gic: Remove gic_map_to_pin() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 15/38] irqchip: mips-gic: Remove gic_map_to_vpe() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 16/38] irqchip: mips-gic: Convert remaining shared reg access to new accessors Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 17/38] irqchip: mips-gic: Convert local int mask " Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 18/38] irqchip: mips-gic: Convert remaining local reg " Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 19/38] MIPS: GIC: Move GIC_LOCAL_INT_* to asm/mips-gic.h Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 20/38] irqchip: mips-gic: Remove GIC_CPU_INT* macros Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 21/38] irqchip: mips-gic: Move various definitions to the driver Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 22/38] MIPS: VDSO: Drop gic_get_usm_range() usage Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-18 11:38 ` Marc Zyngier
2017-08-18 16:47 ` Paul Burton
2017-08-18 16:47 ` Paul Burton
2017-08-18 16:52 ` Marc Zyngier
2017-08-13 4:36 ` [PATCH 23/38] irqchip: mips-gic: Remove gic_get_usm_range() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 24/38] irqchip: mips-gic: Remove __gic_irq_dispatch() forward declaration Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 25/38] irqchip: mips-gic: Remove gic_init() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 26/38] MIPS: Use mips_gic_present() in place of gic_present Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 27/38] irqchip: mips-gic: Remove gic_present Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 28/38] irqchip: mips-gic: Move gic_get_c0_*_int() to asm/mips-gic.h Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 29/38] MIPS: VDSO: Avoid use of linux/irqchip/mips-gic.h Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 30/38] MIPS: Remove unnecessary inclusions " Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 31/38] irqchip: mips-gic: Remove linux/irqchip/mips-gic.h Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 32/38] irqchip: mips-gic: Inline __gic_init() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 33/38] irqchip: mips-gic: Inline gic_basic_init() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 34/38] irqchip: mips-gic: Make pcpu_masks a per-cpu variable Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-18 15:37 ` Marc Zyngier
2017-08-18 17:02 ` Paul Burton
2017-08-18 17:02 ` Paul Burton
2017-08-18 17:18 ` Marc Zyngier
2017-08-13 4:36 ` [PATCH 35/38] irqchip: mips-gic: Use pcpu_masks to avoid reading GIC_SH_MASK* Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-18 15:44 ` Marc Zyngier
2017-08-18 17:11 ` Paul Burton
2017-08-18 17:11 ` Paul Burton
2017-08-18 17:25 ` Marc Zyngier [this message]
2017-08-18 21:02 ` [PATCH v2 " Paul Burton
2017-08-18 21:02 ` Paul Burton
2017-08-13 4:36 ` [PATCH 36/38] irqchip: mips-gic: Clean up mti,reserved-cpu-vectors handling Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 4:36 ` [PATCH 37/38] irqchip: mips-gic: Use cpumask_first_and() in gic_set_affinity() Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-13 9:08 ` Sergei Shtylyov
2017-08-14 16:18 ` Paul Burton
2017-08-14 16:18 ` Paul Burton
2017-08-14 16:48 ` Sergei Shtylyov
2017-08-18 21:04 ` [PATCH v2 " Paul Burton
2017-08-18 21:04 ` Paul Burton
2017-08-13 4:36 ` [PATCH 38/38] irqchip: mips-gic: Let the core set struct irq_common_data affinity Paul Burton
2017-08-13 4:36 ` Paul Burton
2017-08-15 10:13 ` [PATCH 00/38] irqchip: mips-gic: Cleanup & optimisation Marc Zyngier
2017-08-15 16:16 ` Paul Burton
2017-08-15 16:16 ` Paul Burton
2017-08-15 16:49 ` Marc Zyngier
2017-08-18 17:28 ` Marc Zyngier
2017-08-18 17:44 ` Paul Burton
2017-08-18 17:44 ` Paul Burton
2017-08-18 17:49 ` Marc Zyngier
2017-08-18 21:09 ` Paul Burton
2017-08-18 21:09 ` Paul Burton
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=f44d57df-1071-94f6-75cf-83f5175abf50@arm.com \
--to=marc.zyngier@arm.com \
--cc=jason@lakedaemon.net \
--cc=linux-mips@linux-mips.org \
--cc=paul.burton@imgtec.com \
--cc=ralf@linux-mips.org \
--cc=tglx@linutronix.de \
/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