From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
<linux-kernel@vger.kernel.org>
Cc: <stable@vger.kernel.org>,
Markos Chandras <markos.chandras@imgtec.com>,
<linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [4.1,013/123] MIPS: c-r4k: Fix cache flushing for MT cores
Date: Mon, 10 Aug 2015 11:36:34 -0700 [thread overview]
Message-ID: <55C8EF32.5010807@imgtec.com> (raw)
In-Reply-To: <20150808220718.304261727@linuxfoundation.org>
On 08/08/2015 03:08 PM, gregkh@linuxfoundation.org wrote:
> 4.1-stable review patch. If anyone has any objections, please let me know.
>
>
Yes, I have objection. Please look into excepts from my mail exchange
with Markos:
> On 06/25/2015 03:59 AM, Markos Chandras wrote:
>
>> @@ -51,9 +51,8 @@ static inline void r4k_on_each_cpu(void (*func) (void *info), void *info)
>> {
>> preempt_disable();
>>
>> -#ifndef CONFIG_MIPS_MT_SMP
>> - smp_call_function(func, info, 1);
>> -#endif
>> + if (config_enabled(CONFIG_SMP))
>> + smp_call_function_many(&cpu_foreign_map, func, info, 1);
>> func(info);
>> preempt_enable();
>> }
>
> You can NOT do this because r4k_on_each_cpu() is still used for
> non-MIPS/IMG processors for SAFE INDEX cache flushes -
> cpu_has_safe_index_cacheops (it is not safe in CM/CM2/CM3 environment).
>
>
> And a little explanation and history:
>
> The function r4k_on_each_cpu() can NOT be used simultaneously for
> index cacheops and address cacheops because both have a different
> rules in applying in other cores and that is different in inter-core
> HW blocks of various vendors. CM propogates address cacheops from
> core-to-core (no IPI calls are needed) but another vendors may do not
> - this is indicated by CONFIG_MIPS_MT_SMP (and a dropped now
> CONFIG_MIPS_MT_SMTC).
>
> Unfortunately, before 2.6.35.9 this function was used for index
> cacheops too in any kernel and that is WRONG, at least for CM-based
> systems.
> So, I splitted index and address cacheops and wrote a functions
> r4k_indexop_on_each_cpu and put it in use in at least in dlm-2.6.35.9
> and it finally made a way to dev-linux-mti-3.6. This is a famous patch
> named:
>
> MIPS: Cache flush functions are reworked.
>
> This patch is a preparation for EVA support in kernel.
>
> However, it also fixes a bug then index cacheop was not ran
> on multiple CPUs with unsafe index cacheops (flush_cache_vmap,
> flush_icache_range, flush_cache_range, __flush_cache_all).
>
> Additionally, it optimizes a usage of index and address cacheops for
> address range flushes depending from address range size.
>
> Because of that reasons it is a separate patch from EVA support.
>
> Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
> Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
> (cherry picked from commit 6b05dd71da1136fbad0ce642790c4c99343f05e7)
>
(history is skipped)
Note: the replacement of
if (config_enabled(CONFIG_SMP))
to
if (!mips_cm_present())
doesn't solve a problem - in CM-based environment the index cache ops
MUST be delivered to other core via IPI.
- Leonid.
WARNING: multiple messages have this Message-ID (diff)
From: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org,
Markos Chandras <markos.chandras@imgtec.com>,
linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [4.1,013/123] MIPS: c-r4k: Fix cache flushing for MT cores
Date: Mon, 10 Aug 2015 11:36:34 -0700 [thread overview]
Message-ID: <55C8EF32.5010807@imgtec.com> (raw)
Message-ID: <20150810183634.HOFj2_abIpaOUsDSbxZZW-WB03Ff1dzvJcnhQEPdioE@z> (raw)
In-Reply-To: <20150808220718.304261727@linuxfoundation.org>
On 08/08/2015 03:08 PM, gregkh@linuxfoundation.org wrote:
> 4.1-stable review patch. If anyone has any objections, please let me know.
>
>
Yes, I have objection. Please look into excepts from my mail exchange
with Markos:
> On 06/25/2015 03:59 AM, Markos Chandras wrote:
>
>> @@ -51,9 +51,8 @@ static inline void r4k_on_each_cpu(void (*func) (void *info), void *info)
>> {
>> preempt_disable();
>>
>> -#ifndef CONFIG_MIPS_MT_SMP
>> - smp_call_function(func, info, 1);
>> -#endif
>> + if (config_enabled(CONFIG_SMP))
>> + smp_call_function_many(&cpu_foreign_map, func, info, 1);
>> func(info);
>> preempt_enable();
>> }
>
> You can NOT do this because r4k_on_each_cpu() is still used for
> non-MIPS/IMG processors for SAFE INDEX cache flushes -
> cpu_has_safe_index_cacheops (it is not safe in CM/CM2/CM3 environment).
>
>
> And a little explanation and history:
>
> The function r4k_on_each_cpu() can NOT be used simultaneously for
> index cacheops and address cacheops because both have a different
> rules in applying in other cores and that is different in inter-core
> HW blocks of various vendors. CM propogates address cacheops from
> core-to-core (no IPI calls are needed) but another vendors may do not
> - this is indicated by CONFIG_MIPS_MT_SMP (and a dropped now
> CONFIG_MIPS_MT_SMTC).
>
> Unfortunately, before 2.6.35.9 this function was used for index
> cacheops too in any kernel and that is WRONG, at least for CM-based
> systems.
> So, I splitted index and address cacheops and wrote a functions
> r4k_indexop_on_each_cpu and put it in use in at least in dlm-2.6.35.9
> and it finally made a way to dev-linux-mti-3.6. This is a famous patch
> named:
>
> MIPS: Cache flush functions are reworked.
>
> This patch is a preparation for EVA support in kernel.
>
> However, it also fixes a bug then index cacheop was not ran
> on multiple CPUs with unsafe index cacheops (flush_cache_vmap,
> flush_icache_range, flush_cache_range, __flush_cache_all).
>
> Additionally, it optimizes a usage of index and address cacheops for
> address range flushes depending from address range size.
>
> Because of that reasons it is a separate patch from EVA support.
>
> Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
> Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
> (cherry picked from commit 6b05dd71da1136fbad0ce642790c4c99343f05e7)
>
(history is skipped)
Note: the replacement of
if (config_enabled(CONFIG_SMP))
to
if (!mips_cm_present())
doesn't solve a problem - in CM-based environment the index cache ops
MUST be delivered to other core via IPI.
- Leonid.
next prev parent reply other threads:[~2015-08-10 18:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150808220717.771230091@linuxfoundation.org>
2015-08-08 22:08 ` [PATCH 4.1 012/123] MIPS: Fix erroneous JR emulation for MIPS R6 Greg Kroah-Hartman
2015-08-08 22:08 ` [PATCH 4.1 013/123] MIPS: c-r4k: Fix cache flushing for MT cores Greg Kroah-Hartman
2015-08-10 18:36 ` Leonid Yegoshin [this message]
2015-08-10 18:36 ` [4.1,013/123] " Leonid Yegoshin
2015-08-10 18:49 ` gregkh
2015-08-10 19:12 ` Leonid Yegoshin
2015-08-10 19:12 ` Leonid Yegoshin
2015-08-10 19:17 ` Markos Chandras
2015-08-10 19:17 ` Markos Chandras
2015-08-10 19:19 ` gregkh
2015-08-10 19:22 ` Leonid Yegoshin
2015-08-10 19:22 ` Leonid Yegoshin
2015-08-08 22:08 ` [PATCH 4.1 014/123] MIPS: Require O32 FP64 support for MIPS64 with O32 compat Greg Kroah-Hartman
2015-08-08 22:08 ` [PATCH 4.1 015/123] MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU Greg Kroah-Hartman
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=55C8EF32.5010807@imgtec.com \
--to=leonid.yegoshin@imgtec.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=markos.chandras@imgtec.com \
--cc=ralf@linux-mips.org \
--cc=stable@vger.kernel.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