Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Matt Redfearn <matt.redfearn@imgtec.com>
To: James Hogan <james.hogan@imgtec.com>, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>, <linux-mips@linux-mips.org>
Subject: Re: [PATCH] MIPS: smp.c: Fix uninitialised temp_foreign_map
Date: Fri, 4 Mar 2016 13:43:37 +0000	[thread overview]
Message-ID: <56D99109.2050306@imgtec.com> (raw)
In-Reply-To: <1457086251-6477-1-git-send-email-james.hogan@imgtec.com>

Hi James,

On 04/03/16 10:10, James Hogan wrote:
> When calculate_cpu_foreign_map() recalculates the cpu_foreign_map
> cpumask it uses the local variable temp_foreign_map without initialising
> it to zero. Since the calculation only ever sets bits in this cpumask
> any existing bits at that memory location will remain set and find their
> way into cpu_foreign_map too. This could potentially lead to cache
> operations suboptimally doing smp calls to multiple VPEs in the same
> core, even though the VPEs share primary caches.
>
> Therefore initialise temp_foreign_map using cpumask_clear() before use.
>
> Fixes: cccf34e9411c ("MIPS: c-r4k: Fix cache flushing for MT cores")

cccf34e9411c was CC'd to stable 3.15+, should this fix do the same?

Thanks,
Matt


> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Paul Burton <paul.burton@imgtec.com>
> Cc: linux-mips@linux-mips.org
> ---
>   arch/mips/kernel/smp.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
> index bd4385a8e6e8..2b521e07b860 100644
> --- a/arch/mips/kernel/smp.c
> +++ b/arch/mips/kernel/smp.c
> @@ -121,6 +121,7 @@ static inline void calculate_cpu_foreign_map(void)
>   	cpumask_t temp_foreign_map;
>   
>   	/* Re-calculate the mask */
> +	cpumask_clear(&temp_foreign_map);
>   	for_each_online_cpu(i) {
>   		core_present = 0;
>   		for_each_cpu(k, &temp_foreign_map)

WARNING: multiple messages have this Message-ID (diff)
From: Matt Redfearn <matt.redfearn@imgtec.com>
To: James Hogan <james.hogan@imgtec.com>, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>, linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: smp.c: Fix uninitialised temp_foreign_map
Date: Fri, 4 Mar 2016 13:43:37 +0000	[thread overview]
Message-ID: <56D99109.2050306@imgtec.com> (raw)
Message-ID: <20160304134337.DJN8JDnaztPi4FPOTJi2gIIP6LadDrkm9-MXcPt1FoI@z> (raw)
In-Reply-To: <1457086251-6477-1-git-send-email-james.hogan@imgtec.com>

Hi James,

On 04/03/16 10:10, James Hogan wrote:
> When calculate_cpu_foreign_map() recalculates the cpu_foreign_map
> cpumask it uses the local variable temp_foreign_map without initialising
> it to zero. Since the calculation only ever sets bits in this cpumask
> any existing bits at that memory location will remain set and find their
> way into cpu_foreign_map too. This could potentially lead to cache
> operations suboptimally doing smp calls to multiple VPEs in the same
> core, even though the VPEs share primary caches.
>
> Therefore initialise temp_foreign_map using cpumask_clear() before use.
>
> Fixes: cccf34e9411c ("MIPS: c-r4k: Fix cache flushing for MT cores")

cccf34e9411c was CC'd to stable 3.15+, should this fix do the same?

Thanks,
Matt


> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Paul Burton <paul.burton@imgtec.com>
> Cc: linux-mips@linux-mips.org
> ---
>   arch/mips/kernel/smp.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
> index bd4385a8e6e8..2b521e07b860 100644
> --- a/arch/mips/kernel/smp.c
> +++ b/arch/mips/kernel/smp.c
> @@ -121,6 +121,7 @@ static inline void calculate_cpu_foreign_map(void)
>   	cpumask_t temp_foreign_map;
>   
>   	/* Re-calculate the mask */
> +	cpumask_clear(&temp_foreign_map);
>   	for_each_online_cpu(i) {
>   		core_present = 0;
>   		for_each_cpu(k, &temp_foreign_map)

  parent reply	other threads:[~2016-03-04 13:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04 10:10 [PATCH] MIPS: smp.c: Fix uninitialised temp_foreign_map James Hogan
2016-03-04 10:10 ` James Hogan
2016-03-04 13:43 ` Matt Redfearn [this message]
2016-03-04 13:43   ` Matt Redfearn
2016-03-04 13:50   ` James Hogan
2016-03-04 13:50     ` James Hogan
  -- strict thread matches above, loose matches on Subject: below --
2016-03-14  6:12 miles.chen
2016-03-14  6:12 ` miles.chen
2016-03-14  7:28 ` Ralf Baechle

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=56D99109.2050306@imgtec.com \
    --to=matt.redfearn@imgtec.com \
    --cc=james.hogan@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=paul.burton@imgtec.com \
    --cc=ralf@linux-mips.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