Re: [PATCH v3] scripts: get_feat.pl: make complete table more coincise

From: Mauro Carvalho Chehab
Date: Fri Dec 04 2020 - 04:52:52 EST


Em Fri, 4 Dec 2020 10:35:44 +0100
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> escreveu:

> Currently, there are too many white spaces at the tables,
> and the information is very sparsed on it.
>
> Make the format a lot more compact.
>
> Suggested-by: Jonathan Corbet <corbet@xxxxxxx>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>

...

> + my @lines;
> + my $line = "";
> + foreach my $arch (sort {
> + ($arch_table{$a} cmp $arch_table{$b}) or
> + ("\L$a" cmp "\L$b")
> + } keys %arch_table) {

Actually, I have one doubt myself with the above sort.

Right now, it places things on this order:

Not Compatible: ...
TODO: ...
ok: ...

I'm wondering if it would it be better to place them at the reverse order,
e. g.:

ok: ...
TODO: ...
Not Compatible: ...

In other words, to output it like:

+---------------------+-------------------------------------------------------------------------+------------------------------------------------------------+
|Feature |Kconfig / Description |Status per architecture |
+=====================+=========================================================================+============================================================+
|batch-unmap-tlb-flush|``ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH`` |- **ok**: x86 |
| | |- **TODO**: alpha, arc, arm, arm64, csky, hexagon, ia64 |
| |arch supports deferral of TLB flush until multiple pages are unmapped | mips, nds32, parisc, powerpc, riscv, s390, sh, sparc |
| | | xtensa |
| | |- **Not compatible**: c6x, h8300, m68k, microblaze, nios2 |
| | | openrisc, um |
+---------------------+-------------------------------------------------------------------------+------------------------------------------------------------+
|ELF-ASLR |``ARCH_HAS_ELF_RANDOMIZE`` |- **ok**: arm, arm64, mips, parisc, powerpc, s390, x86 |
| | |- **TODO**: alpha, arc, c6x, csky, h8300, hexagon, ia64 |
| |arch randomizes the stack, heap and binary images of ELF binaries | m68k, microblaze, nds32, nios2, openrisc, riscv, sh |
| | | sparc, um, xtensa |
+---------------------+-------------------------------------------------------------------------+------------------------------------------------------------+
|huge-vmap |``HAVE_ARCH_HUGE_VMAP`` |- **ok**: arm64, powerpc, x86 |
| | |- **TODO**: alpha, arc, arm, c6x, csky, h8300, hexagon |
| |arch supports the ioremap_pud_enabled() and ioremap_pmd_enabled() VM APIs| ia64, m68k, microblaze, mips, nds32, nios2, openrisc |
| | | parisc, riscv, s390, sh, sparc, um, xtensa |
+---------------------+-------------------------------------------------------------------------+------------------------------------------------------------+
|ioremap_prot |``HAVE_IOREMAP_PROT`` |- **ok**: arc, mips, powerpc, s390, sh, x86 |
| | |- **TODO**: alpha, arm, arm64, c6x, csky, h8300, hexagon |
| |arch has ioremap_prot() | ia64, m68k, microblaze, nds32, nios2, openrisc, parisc |
| | | riscv, sparc, um, xtensa |
+---------------------+-------------------------------------------------------------------------+------------------------------------------------------------+
|PG_uncached |``ARCH_USES_PG_UNCACHED`` |- **ok**: ia64, x86 |
| | |- **TODO**: alpha, arc, arm, arm64, c6x, csky, h8300 |
| |arch supports the PG_uncached page flag | hexagon, m68k, microblaze, mips, nds32, nios2, openrisc |
| | | parisc, powerpc, riscv, s390, sh, sparc, um, xtensa |
+---------------------+-------------------------------------------------------------------------+------------------------------------------------------------+
|pte_special |``ARCH_HAS_PTE_SPECIAL`` |- **ok**: arc, arm, arm64, mips, powerpc, riscv, s390, sh |
| | | sparc, x86 |
| |arch supports the pte_special()/pte_mkspecial() VM APIs |- **TODO**: alpha, c6x, csky, h8300, hexagon, ia64, m68k |
| | | microblaze, nds32, nios2, openrisc, parisc, um, xtensa |
+---------------------+-------------------------------------------------------------------------+------------------------------------------------------------+
|THP |``HAVE_ARCH_TRANSPARENT_HUGEPAGE`` |- **ok**: arc, arm, arm64, mips, powerpc, s390, sparc, x86 |
| | |- **TODO**: alpha, ia64, nds32, parisc, riscv |
| |arch supports transparent hugepages |- **Not compatible**: c6x, csky, h8300, hexagon, m68k |
| | | microblaze, nios2, openrisc, sh, um, xtensa |
+---------------------+-------------------------------------------------------------------------+------------------------------------------------------------+

Changing the order is one line patch (see enclosed).

If you think that reverting the order looks better, feel
free to apply the enclosed patch, or fold it with the
previous one.

Thanks,
Mauro

[PATCH] script: get_feat: change the group by order

Right now, arch compatibility is grouped by status at the
alphabetical order from A to Z, and then from a to z, e. g:.

---
TODO
ok

Revert the order, in order to print first the OK results,
then TODO, and, finally, the not compatible ones.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>

diff --git a/scripts/get_feat.pl b/scripts/get_feat.pl
index 10bf23fbc9c5..3f73c8534059 100755
--- a/scripts/get_feat.pl
+++ b/scripts/get_feat.pl
@@ -397,7 +397,7 @@ sub output_matrix {
my @lines;
my $line = "";
foreach my $arch (sort {
- ($arch_table{$a} cmp $arch_table{$b}) or
+ ($arch_table{$b} cmp $arch_table{$a}) or
("\L$a" cmp "\L$b")
} keys %arch_table) {