linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Anton Blanchard <anton@samba.org>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] powerpc: Reduce footprint of xics_ipi_struct
Date: Mon, 01 Feb 2010 16:18:30 +1100	[thread overview]
Message-ID: <1265001510.8287.30.camel@pasglop> (raw)
In-Reply-To: <20100112105805.GJ12666@kryten>

On Tue, 2010-01-12 at 21:58 +1100, Anton Blanchard wrote:

> Index: linux-cpumask/arch/powerpc/include/asm/hardirq.h
> ===================================================================
> --- linux-cpumask.orig/arch/powerpc/include/asm/hardirq.h	2010-01-12 12:36:47.174226189 +1100
> +++ linux-cpumask/arch/powerpc/include/asm/hardirq.h	2010-01-12 12:36:47.432976459 +1100
> @@ -6,6 +6,9 @@
>  
>  typedef struct {
>  	unsigned int __softirq_pending;
> +#if defined(CONFIG_XICS) && defined(CONFIG_SMP)
> +	unsigned long xics_ipi;
> +#endif
>  } ____cacheline_aligned irq_cpustat_t;

This is still a gross abuse of irq_cpustat_t ... Can't we do
a separate DECLARE_PER_CPU_SHARED_ALIGNED(unsigned long, xics_ipi)
inside xics.c instead ?

Cheers,
Ben.

>  DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
> Index: linux-cpumask/arch/powerpc/platforms/pseries/xics.c
> ===================================================================
> --- linux-cpumask.orig/arch/powerpc/platforms/pseries/xics.c	2010-01-12 12:36:46.905477650 +1100
> +++ linux-cpumask/arch/powerpc/platforms/pseries/xics.c	2010-01-12 12:40:54.782975198 +1100
> @@ -514,15 +514,12 @@ static void __init xics_init_host(void)
>  /*
>   * XICS only has a single IPI, so encode the messages per CPU
>   */
> -struct xics_ipi_struct {
> -        unsigned long value;
> -	} ____cacheline_aligned;
> -
> -static struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
>  
>  static inline void smp_xics_do_message(int cpu, int msg)
>  {
> -	set_bit(msg, &xics_ipi_message[cpu].value);
> +	unsigned long *tgt = &(per_cpu(irq_stat, cpu).xics_ipi);
> +
> +	set_bit(msg, tgt);
>  	mb();
>  	if (firmware_has_feature(FW_FEATURE_LPAR))
>  		lpar_qirr_info(cpu, IPI_PRIORITY);
> @@ -548,25 +545,23 @@ void smp_xics_message_pass(int target, i
>  
>  static irqreturn_t xics_ipi_dispatch(int cpu)
>  {
> +	unsigned long *tgt = &(per_cpu(irq_stat, cpu).xics_ipi);
> +
>  	WARN_ON(cpu_is_offline(cpu));
>  
>  	mb();	/* order mmio clearing qirr */
> -	while (xics_ipi_message[cpu].value) {
> -		if (test_and_clear_bit(PPC_MSG_CALL_FUNCTION,
> -				       &xics_ipi_message[cpu].value)) {
> +	while (*tgt) {
> +		if (test_and_clear_bit(PPC_MSG_CALL_FUNCTION, tgt)) {
>  			smp_message_recv(PPC_MSG_CALL_FUNCTION);
>  		}
> -		if (test_and_clear_bit(PPC_MSG_RESCHEDULE,
> -				       &xics_ipi_message[cpu].value)) {
> +		if (test_and_clear_bit(PPC_MSG_RESCHEDULE, tgt)) {
>  			smp_message_recv(PPC_MSG_RESCHEDULE);
>  		}
> -		if (test_and_clear_bit(PPC_MSG_CALL_FUNC_SINGLE,
> -				       &xics_ipi_message[cpu].value)) {
> +		if (test_and_clear_bit(PPC_MSG_CALL_FUNC_SINGLE, tgt)) {
>  			smp_message_recv(PPC_MSG_CALL_FUNC_SINGLE);
>  		}
>  #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
> -		if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK,
> -				       &xics_ipi_message[cpu].value)) {
> +		if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK, tgt)) {
>  			smp_message_recv(PPC_MSG_DEBUGGER_BREAK);
>  		}
>  #endif

  reply	other threads:[~2010-02-01  5:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-12 10:56 [PATCH] powerpc: Reduce footprint of irq_stat Anton Blanchard
2010-01-12 10:58 ` [PATCH] powerpc: Reduce footprint of xics_ipi_struct Anton Blanchard
2010-02-01  5:18   ` Benjamin Herrenschmidt [this message]
2010-02-01  6:26     ` Anton Blanchard
2010-02-01  5:21 ` [PATCH] powerpc: Reduce footprint of irq_stat Benjamin Herrenschmidt
2010-02-01  5:44   ` Anton Blanchard

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=1265001510.8287.30.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@ozlabs.org \
    /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;
as well as URLs for NNTP newsgroup(s).