[PATCH 3/3] Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags resync

2024-07-18 Thread Brian Inglis
Linux 6.10 changed the content of cpufeatures.h to require explicit
quoted flag names for output in comments, instead of requiring a null
quoted string "" at the start of comments to suppress flag name output.
As a result, some flags (not all for output) were renamed and others moved:

- change dts to ds; move intel_ppin down; swap ibpd and ibrs;
- change some flag names and descriptions that are not output.

Signed-off-by: Brian Inglis 
---
 winsup/cygwin/fhandler/proc.cc | 35 +-
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
index e85ed4ff06ed..8c7a4ab06a51 100644
--- a/winsup/cygwin/fhandler/proc.cc
+++ b/winsup/cygwin/fhandler/proc.cc
@@ -1021,14 +1021,14 @@ format_proc_cpuinfo (void *, char *&destbuf)
   ftcprint (features1,  9, "apic"); /* APIC enabled */
   ftcprint (features1, 11, "sep");  /* sysenter/sysexit */
   ftcprint (features1, 12, "mtrr"); /* memory type range registers */
-  ftcprint (features1, 13, "pge");  /* page global extension */
+  ftcprint (features1, 13, "pge");  /* page global enable */
   ftcprint (features1, 14, "mca");  /* machine check architecture */
   ftcprint (features1, 15, "cmov"); /* conditional move */
   ftcprint (features1, 16, "pat");  /* page attribute table */
   ftcprint (features1, 17, "pse36");/* 36 bit page size extensions */
   ftcprint (features1, 18, "pn");   /* processor serial number */
   ftcprint (features1, 19, "clflush"); /* clflush instruction */
-  ftcprint (features1, 21, "dts");  /* debug store */
+  ftcprint (features1, 21, "ds");  /* debug store */
   ftcprint (features1, 22, "acpi"); /* ACPI via MSR */
   ftcprint (features1, 23, "mmx");  /* multimedia extensions */
   ftcprint (features1, 24, "fxsr"); /* fxsave/fxrstor */
@@ -1326,13 +1326,6 @@ format_proc_cpuinfo (void *, char *&destbuf)
 
  ftcprint (features1,  3, "epb");  /* energy perf bias */
}
-  /* cpuid 0x0007:1 ebx */
-  if (maxf >= 0x0007)
-   {
- cpuid (&unused, &features1, &unused, &unused, 0x0007, 1);
-
- ftcprint (features1,  0, "intel_ppin"); /* Prot Proc Id No */
-   }
   /* cpuid 0x0010 ebx */
   if (maxf >= 0x0010)
{
@@ -1360,6 +1353,13 @@ format_proc_cpuinfo (void *, char *&destbuf)
 
 /*   ftcprint (features1, 11, "pti");*//* Page Table Isolation reqd with 
Meltdown */
 
+  /* cpuid 0x0007:1 ebx */
+  if (maxf >= 0x0007)
+   {
+ cpuid (&unused, &features1, &unused, &unused, 0x0007, 1);
+
+ ftcprint (features1,  0, "intel_ppin"); /* Prot Proc Id No */
+   }
   /* cpuid 0x0010:2 ecx */
   if (maxf >= 0x0010)
{
@@ -1406,8 +1406,8 @@ format_proc_cpuinfo (void *, char *&destbuf)
 /*   ftcprint (features1,  4, "rdpru");*//* user level rd proc reg */
 /*   ftcprint (features1,  6, "mba");  *//* memory BW alloc */
 /*   ftcprint (features1,  9, "wbnoinvd"); *//* wbnoinvd instruction */
- ftcprint (features1, 12, "ibpb"); /* ind br pred barrier */
  ftcprint (features1, 14, "ibrs"); /* ind br restricted spec */
+ ftcprint (features1, 12, "ibpb"); /* ind br pred barrier */
  ftcprint (features1, 15, "stibp");/* 1 thread ind br pred */
  ftcprint (features1, 16, "ibrs_enhanced"); /* ibrs_enhanced IBRS 
always on */
 /*   ftcprint (features1, 17, "stibp_always_on"); */ /* stibp always on */
@@ -1442,14 +1442,14 @@ format_proc_cpuinfo (void *, char *&destbuf)
  ftcprint (features1,  3, "bmi1"); /* bit manip ext group 1 */
  ftcprint (features1,  4, "hle");  /* hardware lock elision */
  ftcprint (features1,  5, "avx2"); /* AVX ext instructions */
-/*   ftcprint (features1,  6, "fpdx"); */  /* "" FP data ptr upd on 
exc */
+/*   ftcprint (features1,  6, "fdp_excptn_only"); *//* FP data ptr upd on 
exc */
  ftcprint (features1,  7, "smep"); /* super mode exec prot */
  ftcprint (features1,  8, "bmi2"); /* bit manip ext group 2 */
  ftcprint (features1,  9, "erms"); /* enh rep movsb/stosb */
  ftcprint (features1, 10, "invpcid");  /* inv proc context id */
  ftcprint (features1, 11, "rtm");  /* restricted txnal mem */
  ftcprint (features1, 12, "cqm");  /* cache QoS monitoring */
-/*   ftcprint (features1, 13, "fpcsdsz"); */   /* "" zero FP cs/ds */
+/*   ftcprint (features1, 13, "zero_fcs_fds");*//* zero FP CS/DS */
  ftcprint (features1, 14, "mpx");  /* mem prot ext */
  ftcprint (features1, 15, "rdt_a");/* rsrc dir tech alloc */
  ftcprint (features1, 16, "avx512f");  /* vec foundation */
@@ -1541,11 +1541,11 @@ format_proc_cpuinfo (void *, char *&destbuf)
  ftcprin

[PATCH 0/3] Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 changes

2024-07-18 Thread Brian Inglis
Linux 6.10 "Baby Opossum Posse" added cpuinfo feature flags for output. 

Linux cpuinfo follows output for each processor with a blank line,
so we output newlines to get a blank line.

Linux 6.10 changed the content of cpufeatures.h to require explicit
quoted flag names for output in comments, instead of requiring a null
quoted string "" at the start of comments to suppress flag name output.
As a result, some flags (not all for output) were renamed and others moved.

Brian Inglis (3):
  Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags added
  Cygwin: fhandler/proc.cc(format_proc_cpuinfo): add newlines
  Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags resync

 winsup/cygwin/fhandler/proc.cc | 50 --
 1 file changed, 30 insertions(+), 20 deletions(-)

-- 
2.45.1



[PATCH 2/3] Cygwin: fhandler/proc.cc(format_proc_cpuinfo): add newlines

2024-07-18 Thread Brian Inglis
Linux cpuinfo follows output for each processor with a blank line,
so we output newlines to get a blank line:
- newline after power management feature flags if printed;
- newline to give blank line after each processor output.

Reported-by: Achim Gratz 
https://cygwin.com/pipermail/cygwin/2024-July/256223.html
Signed-off-by: Brian Inglis 
---
 winsup/cygwin/fhandler/proc.cc | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
index d8ab522a8235..e85ed4ff06ed 100644
--- a/winsup/cygwin/fhandler/proc.cc
+++ b/winsup/cygwin/fhandler/proc.cc
@@ -1752,16 +1752,17 @@ format_proc_cpuinfo (void *, char *&destbuf)
  ftcprint (features1, 12, "acc_power");/* core power reporting */
 /*   ftcprint (features1, 13, "connstby"); */  /* connected standby */
 /*   ftcprint (features1, 14, "rapl"); */  /* running average power 
limit */
+
+ print ("\n");
}
 
+  print ("\n");
+
   if (orig_affinity_mask != 0)
SetThreadGroupAffinity (GetCurrentThread (), &orig_group_affinity,
NULL);
-  print ("\n");
 }
 
-  print ("\n");
-
   destbuf = (char *) crealloc_abort (destbuf, bufptr - buf);
   memcpy (destbuf, buf, bufptr - buf);
   return bufptr - buf;
-- 
2.45.1



[PATCH 1/3] Cygwin: fhandler/proc.cc(format_proc_cpuinfo): Linux 6.10 flags added

2024-07-18 Thread Brian Inglis
0x800a EDX 18 x2avic virtual x2apic
0x8022 EAX  2 amd_lbr_pmc_freeze AMD last br rec and perf mon ctrs freeze

Signed-off-by: Brian Inglis 
---
 winsup/cygwin/fhandler/proc.cc | 8 
 1 file changed, 8 insertions(+)

diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
index baf0cae1e8f9..d8ab522a8235 100644
--- a/winsup/cygwin/fhandler/proc.cc
+++ b/winsup/cygwin/fhandler/proc.cc
@@ -1593,6 +1593,7 @@ format_proc_cpuinfo (void *, char *&destbuf)
  ftcprint (features1, 13, "avic"); /* virt int control */
  ftcprint (features1, 15, "v_vmsave_vmload");  /* virt vmsave vmload */
  ftcprint (features1, 16, "vgif"); /* virt glb int flag */
+ ftcprint (features1, 18, "x2avic");   /* virt x2apic */
  ftcprint (features1, 20, "v_spec_ctrl");  /* virt spec ctrl 
support */
  ftcprint (features1, 25, "vnmi"); /* virt NMI */
 /*   ftcprint (features1, 28, "svme_addr_chk");  *//* secure vmexit addr 
check */
@@ -1687,6 +1688,13 @@ format_proc_cpuinfo (void *, char *&destbuf)
 /*   ftcprint (features2, 16, "vte");*//* virtual transparent 
encryption */
}
 
+  /* cpuid 0x8022 eax */
+  if (is_amd && maxe >= 0x8022)
+   {
+ cpuid (&features1, &unused, &unused, &unused, 0x8022);
+ ftcprint (features1,  2, "amd_lbr_pmc_freeze ");/* AMD LBR & PMC 
Freeze */
+   }
+
   print ("\n");
 
   bufptr += __small_sprintf (bufptr, "bogomips\t: %d.00\n",
-- 
2.45.1