NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/60968: NetBSD/amd64 does not initialize PAT on secondary CPUs



The following reply was made to PR kern/60968; it has been noted by GNATS.

From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/60968: NetBSD/amd64 does not initialize PAT on secondary
 CPUs
Date: Sun, 22 Nov 2026 17:26:50 +0100

 This looks correct and still applies to -current.
 
 I would suggest to commit a slightly modified patch that also removes the
 superflous call in cpu_attach and adds a comment explaining why we get
 away with a single static "pat available" flag in the pmap.
 
 Martin
 
 Index: cpu.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/x86/x86/cpu.c,v
 retrieving revision 1.214
 diff -u -p -r1.214 cpu.c
 --- cpu.c	2 May 2025 07:08:11 -0000	1.214
 +++ cpu.c	22 Nov 2026 16:19:01 -0000
 @@ -528,8 +528,6 @@ cpu_attach(device_t parent, device_t sel
  		panic("unknown processor type??\n");
  	}
  
 -	pat_init(ci);
 -
  	if (!pmf_device_register1(self, cpu_suspend, cpu_resume, cpu_shutdown))
  		aprint_error_dev(self, "couldn't establish power handler\n");
  
 @@ -947,6 +945,7 @@ cpu_hatch(void *v)
  #if NHYPERV > 0
  	hyperv_init_cpu(ci);
  #endif
 +	pat_init(ci);
  
  	ci->ci_data.cpu_cc_freq = cpu_info_primary.ci_data.cpu_cc_freq;
  	/* cpu_get_tsc_freq(ci); */
 Index: pmap.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/x86/x86/pmap.c,v
 retrieving revision 1.429
 diff -u -p -r1.429 pmap.c
 --- pmap.c	14 Sep 2026 17:59:04 -0000	1.429
 +++ pmap.c	22 Nov 2026 16:19:01 -0000
 @@ -328,6 +328,8 @@ struct evcnt pmap_ldt_evcnt;
  
  /*
   * PAT
 + * There are no known setups where some CPUs have the PAT feature
 + * while others do not, so a single global variable is OK.
   */
  static bool cpu_pat_enabled __read_mostly = false;
  
 



Home | Main Index | Thread Index | Old Index