Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] arm64: cpucaps: Keep entries sorted
Date: Tue, 19 May 2026 11:22:57 +0100	[thread overview]
Message-ID: <86se7nwvem.wl-maz@kernel.org> (raw)
In-Reply-To: <20260519092243.7278-1-will@kernel.org>

On Tue, 19 May 2026 10:22:42 +0100,
Will Deacon <will@kernel.org> wrote:
> 
> The cpucaps list is supposed to be sorted, even though the awk script
> which processes it doesn't really care. Since this isn't enforced or
> relied upon and because the alphabet is hard, the list has gradually
> developed an ordering of its own.
> 
> Re-sort the file.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Reported-by: Marc Zyngier <maz@kernel.org>
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
> 
> Marc pointed out that HAS_BBML2_NOABORT was in the wrong place but, on
> closer inspection, there are a bunch of misplaced entries here. I
> honestly don't like the churn of re-sorting it, so an alternative is
> to live with it and remove the comment at the top asking people to keep
> it sorted it. Any preferences?

I'm not sold on the requirement for keeping this sorted, TBH. The
commit message says "to minimise conflicts", which I can understand as
it avoids people adding entries at the end all the time, but it is
obvious that we (especially myself) can't manage to do that.

If we want to keep this sorted for $reasons, let's actively enforce it
in the generation script:

diff --git a/arch/arm64/tools/gen-cpucaps.awk b/arch/arm64/tools/gen-cpucaps.awk
index 2f4f61a0af17e..2e06768ff432e 100755
--- a/arch/arm64/tools/gen-cpucaps.awk
+++ b/arch/arm64/tools/gen-cpucaps.awk
@@ -20,10 +20,14 @@ BEGIN {
 	print ""
 	print "/* Generated file - do not edit */"
 	cap_num = 0
+	previous = ""
 	print ""
 }
 
 /^[vA-Z0-9_]+$/ {
+	if (cap_num > 0 && previous > $0)
+		fatal("unsorted cap " $0)
+	previous = $0
 	printf("#define ARM64_%-40s\t%d\n", $0, cap_num++)
 	next
 }

although that results in a different sorting order (my awk-foo is limited).

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.


      parent reply	other threads:[~2026-05-19 10:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  9:22 [PATCH] arm64: cpucaps: Keep entries sorted Will Deacon
2026-05-19  9:53 ` Fuad Tabba
2026-05-19 10:22 ` Marc Zyngier [this message]

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=86se7nwvem.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=will@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