linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: vladimir.murzin@arm.com (Vladimir Murzin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/4] Update cpu feature extraction
Date: Fri, 29 Jan 2016 10:36:27 +0000	[thread overview]
Message-ID: <56AB40AB.8070302@arm.com> (raw)
In-Reply-To: <20160128170141.GM10826@n2100.arm.linux.org.uk>

On 28/01/16 17:01, Russell King - ARM Linux wrote:
> On Thu, Jan 28, 2016 at 11:13:10AM +0000, Vladimir Murzin wrote:
>> On 26/01/16 09:23, Vladimir Murzin wrote:
>>> Hi,
>>>
>>> This has been started as a fix in cpu feature extractor, but Suzuki suggested
>>> syncing-up the whole cpu feature handling with the recent updates on arm64
>>> side [1,2].
>>>
>>> I've kept fixes separately, so they can go as the are in case there is concern
>>> on updating cpu feature handling.
>>>
>>> [1] http://comments.gmane.org/gmane.linux.ports.arm.kernel/455568
>>> [2] https://lkml.org/lkml/2015/11/18/570
>>>
>>
>> Russell, is it OK for patch tracker?
> 
> I'd really like to hear that someone has validated these changes or at
> least someone in ARM Ltd such as Will or Catalin has reviewed them; I
> remember the subject of whether certain fields are signed or unsigned
> being almost a personal opinion - we used to treat all fields as
> unsigned, but that was declared to be wrong, so we then went to treating
> them all as signed fields... See:
> 
> commit b8c9592b4a6c93211c8163888a97880d608503b5
> Author: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Date:   Thu Mar 19 19:03:25 2015 +0100
> 
>     ARM: 8318/1: treat CPU feature register fields as signed quantities
> 
>     The various CPU feature registers consist of 4-bit blocks that
>     represent signed quantities, whose positive values represent
>     incremental features, and whose negative values are reserved.
> 
>     To improve forward compatibility, update the feature detection
>     code to take possible future higher values into account, but
>     ignore negative values.
> 
>     Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>     Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> 
> For instance:
> 
> -       sync_prim = ((read_cpuid_ext(CPUID_EXT_ISAR3) >> 8) & 0xf0) |
> -                   ((read_cpuid_ext(CPUID_EXT_ISAR4) >> 20) & 0x0f);
> -       if (sync_prim >= 0x13)
> +       if (cpuid_feature_extract(CPUID_EXT_ISAR3, 12) > 1 ||
> +           (cpuid_feature_extract(CPUID_EXT_ISAR3, 12) == 1 &&
> +            cpuid_feature_extract(CPUID_EXT_ISAR3, 20) >= 3))
>                 elf_hwcap &= ~HWCAP_SWP;
> 
> (let's ignore the ISAR4 vs ISAR3 problem).  What if ISAR4 20:23 have
> bit 23 set?  In the original code, that would be treated as being ">= 3"
> but in the new code, that's less than zero, so would fail the test.
> 
> I think we had much the same questions back in March 2015 when this was
> last discussed, when I raised the issue of there being a documentation
> bug in that the documentation doesn't make it clear how reserved 4-bit
> CPU ID fields should be intepreted.
> 
> What I'd like to see is some kind of positive concensus on this (and
> a doc update); what I don't want to do is to apply these patches and
> then get another round of patches converting some of them back to
> signed tests, and then later another set of patches doing the reverse,
> because that seems to be what's now happening.
> 

It is fair point. Since this topic is quite fuzzy and discussion can
take some time I'd be happy if only fixes (the first two patches) can
find their way to mainline independent of the rest of the series.

Is it OK for patches 1/4 and 2/4 to go in patch tracker?

Thanks
Vladimir

  parent reply	other threads:[~2016-01-29 10:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26  9:23 [PATCH 0/4] Update cpu feature extraction Vladimir Murzin
2016-01-26  9:23 ` [PATCH 1/4] ARM: fix demoting HWCAP_SWP Vladimir Murzin
2016-01-27  9:34   ` Ard Biesheuvel
2016-01-26  9:23 ` [PATCH 2/4] ARM: fix cpu feature extracting helper Vladimir Murzin
2016-01-27  9:35   ` Ard Biesheuvel
2016-01-26  9:23 ` [PATCH 3/4] ARM: introduce cpu feature helper for unsigned values Vladimir Murzin
2016-01-26  9:23 ` [PATCH 4/4] ARM: use proper helper while extracting cpu features Vladimir Murzin
2016-01-27  9:44   ` Ard Biesheuvel
2016-01-28 11:13 ` [PATCH 0/4] Update cpu feature extraction Vladimir Murzin
2016-01-28 17:01   ` Russell King - ARM Linux
2016-01-28 17:14     ` Ard Biesheuvel
2016-01-29 10:36     ` Vladimir Murzin [this message]
2016-04-19 11:39       ` Vladimir Murzin

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=56AB40AB.8070302@arm.com \
    --to=vladimir.murzin@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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).