Subject: Re: port-amd64/33927: -current/amd64 kernel reboots early in boot
To: None <port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: netbsd-bugs
Date: 07/12/2006 22:45:01
The following reply was made to PR port-amd64/33927; it has been noted by GNATS.

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: Frank van der Linden <fvdl@NetBSD.org>
Cc: Nicolas Joly <njoly@pasteur.fr>, gnats-bugs@NetBSD.org,
	gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: port-amd64/33927: -current/amd64 kernel reboots early in boot 
 process
Date: Thu, 13 Jul 2006 00:42:00 +0200

 This is a multipart MIME message.
 
 --==_Exmh_18046359692640
 Content-Type: text/plain; charset=us-ascii
 
 
 fvdl@NetBSD.org said:
 > Ok, that narrows it down to changes that only affect the
 > MULTIPROCESSOR case.
 
 Didn't follow the thread from the beginning, but there was a change
 by me which unfortunately affects multiprocessor systems: I changed
 the kernel memory allocator to respect the execute permission bit.
 (This used to work all the time for alpha.)
 I don't understand all the details yet, but MP systems need some
 pieces of memory mapped with execute permission; see the appended
 patch.
 sorry for any breakage
 Matthias
 
 
 
 --==_Exmh_18046359692640
 Content-Type: text/plain ; name="amdmp.txt"; charset=us-ascii
 Content-Description: amdmp.txt
 Content-Disposition: attachment; filename="amdmp.txt"
 
 Index: sys/arch/amd64/amd64/cpu.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/amd64/amd64/cpu.c,v
 retrieving revision 1.10
 diff -u -p -r1.10 cpu.c
 --- sys/arch/amd64/amd64/cpu.c	7 Jun 2006 22:37:14 -0000	1.10
 +++ sys/arch/amd64/amd64/cpu.c	12 Jul 2006 19:18:54 -0000
 @@ -249,7 +249,8 @@ cpu_attach(parent, self, aux)
  	 * structure, otherwise use the primary's.
  	 */
  	if (caa->cpu_role == CPU_ROLE_AP) {
 -		ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK);
 +		ci = (struct cpu_info *)uvm_km_alloc(kernel_map, sizeof(*ci),
 +			0, UVM_KMF_WIRED | UVM_KMF_EXEC);
  		memset(ci, 0, sizeof(*ci));
  #if defined(MULTIPROCESSOR)
  		if (cpu_info[cpunum] != NULL)
 @@ -289,7 +290,8 @@ cpu_attach(parent, self, aux)
  	/*
  	 * Allocate UPAGES contiguous pages for the idle PCB and stack.
  	 */
 -	kstack = uvm_km_alloc(kernel_map, USPACE, 0, UVM_KMF_WIRED);
 +	kstack = uvm_km_alloc(kernel_map, USPACE, 0,
 +			      UVM_KMF_WIRED|UVM_KMF_EXEC);
  	if (kstack == 0) {
  		if (caa->cpu_role != CPU_ROLE_AP) {
  			panic("cpu_attach: unable to allocate idle stack for"
 
 --==_Exmh_18046359692640--