lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e575f15-4efc-7bf7-e266-d01aca094bbc@loongson.cn>
Date:   Wed, 15 Apr 2020 09:48:30 +0800
From:   Tiezhu Yang <yangtiezhu@...ngson.cn>
To:     Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc:     Florian Fainelli <f.fainelli@...il.com>,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
        Xuefeng Li <lixuefeng@...ngson.cn>
Subject: Re: [PATCH v2] MIPS: Limit check_bugs32() to affected platform

On 04/15/2020 01:32 AM, Thomas Bogendoerfer wrote:
> On Sat, Apr 11, 2020 at 10:32:02AM +0800, Tiezhu Yang wrote:
>> On 04/11/2020 12:25 AM, Florian Fainelli wrote:
>>> On 4/9/2020 8:20 PM, Tiezhu Yang wrote:
>>>> In the current code, check_bugs32() only handles MIPS32 CPU type CPU_34K,
>>>> it is better to build and call it on the affected platform.
>>>>
>>>> Move check_bugs32() to the new added 34k-bugs32.c to indicate the fact that
>>>> the code is specific to the 34k CPU, and also add CONFIG_CPU_34K_BUGS32 to
>>>> control whether or not check the bugs.
>>>>
>>>> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
>>> This is not a whole lot of code, so moving this to a separate
>>> translation unit seems a bit heavy handed, also file renames, albeit
>>> tracked properly by git are always a challenge when doing back ports.
>> Hi Florian,
>>
>> There exists the following three ways to do it, I'm fine either way,
>> maybe the first way looks better. Let us wait for the MIPS maintainer
>> to say what he prefer.
>>
>> Hi Thomas,
>>
>> What is your opinion?
> I don't see a reason for doing that at all. The 34K workaround is only
> compiled in if CONFIG_SYS_HAS_CPU_MIPS32_R2 is defined.

Hi Thomas,

Thanks for your reply. My initial thought is to build and call check_bugs32() only for 34K CPU,
because it is useless for other CPU types.

Do you mean to use the following modification?

diff --git a/arch/mips/include/asm/bugs.h b/arch/mips/include/asm/bugs.h
index d72dc6e..743604f 100644
--- a/arch/mips/include/asm/bugs.h
+++ b/arch/mips/include/asm/bugs.h
@@ -35,7 +35,9 @@ static inline void check_bugs(void)
          unsigned int cpu = smp_processor_id();

          cpu_data[cpu].udelay_val = loops_per_jiffy;
-       check_bugs32();
+
+       if (IS_ENABLED(CONFIG_CPU_MIPS32_R2))
+               check_bugs32();

          if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
                  check_bugs64();
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 6ab6b03..383500b 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -461,7 +461,8 @@ static inline void cpu_set_mt_per_tc_perf(struct
cpuinfo_mips *c)
                  c->options |= MIPS_CPU_MT_PER_TC_PERF_COUNTERS;
   }

-static inline void check_errata(void)
+#ifdef CONFIG_CPU_MIPS32_R2
+static inline void check_errata32(void)
   {
          struct cpuinfo_mips *c = &current_cpu_data;

@@ -482,8 +483,9 @@ static inline void check_errata(void)

   void __init check_bugs32(void)
   {
-       check_errata();
+       check_errata32();
   }
+#endif /* CONFIG_CPU_MIPS32_R2 */

   /*
    * Probe whether cpu has config register by trying to play with


Thanks,

Tiezhu Yang


>
> Thomas.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ