NetBSD Problem Report #53130

From paul@whooppee.com  Mon Mar 26 06:33:06 2018
Return-Path: <paul@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CE55E7A10D
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 26 Mar 2018 06:33:06 +0000 (UTC)
Message-Id: <20180326063233.6DB2330F2C2@speedy.whooppee.com>
Date: Mon, 26 Mar 2018 14:32:33 +0800 (+08)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: Building modules for XEN API doesn't work
X-Send-Pr-Version: 3.95

>Number:         53130
>Category:       port-xen
>Synopsis:       Building modules for XEN API doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-xen-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 26 06:35:01 +0000 2018
>Closed-Date:    Sun Jul 05 02:09:27 +0000 2020
>Last-Modified:  Tue May 25 16:55:01 +0000 2021
>Originator:     Paul Goyette
>Release:        NetBSD 8.99.14
>Organization:
+------------------+--------------------------+----------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+
>Environment:


System: NetBSD speedy.whooppee.com 8.99.14 NetBSD 8.99.14 (SPEEDY 2018-03-20 11:25:00 UTC) #0: Wed Mar 21 10:38:29 UTC 2018 paul@speedy.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64
Architecture: x86_64
Machine: amd64
>Description:
The build infrastructure has code to build both "normal" and "xen" 
variants of kernel modules (for amd;  for i386, there's also "xen-pae").
However, it fails to define the macro XEN (in CPPFLAGS), so conditional
code does not get built correctly.

It is possible to modify the various files in src/share/mk (see Fix
section below) to define the needed macros.  However, code which attempts 
to #include header files from xen/ directory does not succeed, since
the build infrastructure does not create the requisite sym-link in the
module object directories.

>How-To-Repeat:
For an example of the problem, checkout a copy of the pgoyette-compat
branch (from March 26th) and try to 'build.sh modules'.  Both the
compat and compat_60 modules will fail trying to build the source file
src/sys/arch/x86/x86/compat_60_cpu_ucode.c

>Fix:
The following diff fixes part 1 of the problem, by defining the XEN and
PAE macros as appropriate.  However, I do not have a correct fix for
craeting the required sym-links in the object directories.


Index: modules/arch/x86/amd64-xen/bsd.amd64-xen.mk
===================================================================
RCS file: /cvsroot/src/sys/modules/arch/x86/amd64-xen/bsd.amd64-xen.mk,v
retrieving revision 1.1
diff -u -p -r1.1 bsd.amd64-xen.mk
--- modules/arch/x86/amd64-xen/bsd.amd64-xen.mk	11 Aug 2014 03:43:25 -0000	1.1
+++ modules/arch/x86/amd64-xen/bsd.amd64-xen.mk	26 Mar 2018 06:28:24 -0000
@@ -7,4 +7,6 @@ KMODULEARCHDIR:=	amd64-xen

 XEN=	1

+CPPFLAGS+=	-DXEN
+
 .endif # _BSD_AMD64_XEN_MK_
Index: modules/arch/x86/i386-xen/bsd.i386-xen.mk
===================================================================
RCS file: /cvsroot/src/sys/modules/arch/x86/i386-xen/bsd.i386-xen.mk,v
retrieving revision 1.1
diff -u -p -r1.1 bsd.i386-xen.mk
--- modules/arch/x86/i386-xen/bsd.i386-xen.mk	11 Aug 2014 03:43:26 -0000	1.1
+++ modules/arch/x86/i386-xen/bsd.i386-xen.mk	26 Mar 2018 06:28:24 -0000
@@ -7,4 +7,6 @@ KMODULEARCHDIR:=	i386-xen

 XEN=	1

+CPPFLAGS+=	-DXEN
+
 .endif # _BSD_I386_XEN_MK_
Index: modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk
===================================================================
RCS file: /cvsroot/src/sys/modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk,v
retrieving revision 1.1
diff -u -p -r1.1 bsd.i386pae-xen.mk
--- modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk	11 Aug 2014 03:43:26 -0000	1.1
+++ modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk	26 Mar 2018 06:28:24 -0000
@@ -8,4 +8,6 @@ KMODULEARCHDIR:=	i386pae-xen
 XEN=	1
 PAE=	1

+CPPFLAGS+=	-DPAE -DXEN
+
 .endif # _BSD_I386PAE_XEN_MK_



>Release-Note:

>Audit-Trail:
From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org
Subject: Re: kern/53130: Building modules for XEN API doesn't work
Date: Mon, 26 Mar 2018 17:30:05 +0800 (+08)

 > It is possible to modify the various files in src/share/mk (see Fix
 > section below) to define the needed macros.  However, code which attempts
 > to #include header files from xen/ directory does not succeed, since
 > the build infrastructure does not create the requisite sym-link in the
 > module object directories.

 Further modification of those three bsd.*.mk files with inclusion of a 
 new line

  	KLINKFILES+= xen

 results in the creation of the xen/ directory symlink.  However, code 
 still does not build correctly (specifically, compat_60_cpu_ucode.c). 
 It appears that #include directives are including different files in a 
 module build vs a kernel build, possibly due to the order in which the 
 -I command line options are specified.

From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53130 CVS commit: [pgoyette-compat] src/sys
Date: Mon, 26 Mar 2018 10:49:45 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Mon Mar 26 10:49:45 UTC 2018

 Modified Files:
 	src/sys/compat/common [pgoyette-compat]: Makefile compat_60_mod.c
 	src/sys/modules/arch/x86/amd64-xen [pgoyette-compat]: bsd.amd64-xen.mk
 	src/sys/modules/arch/x86/i386-xen [pgoyette-compat]: bsd.i386-xen.mk
 	src/sys/modules/arch/x86/i386pae-xen [pgoyette-compat]:
 	    bsd.i386pae-xen.mk
 	src/sys/modules/compat_60 [pgoyette-compat]: Makefile

 Log Message:
 For now, disable CPU_UCODE stuff since we can't build it properly
 with XEN.  Re-enable it after we get fix for PR kern/53130


 To generate a diff of this commit:
 cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sys/compat/common/Makefile
 cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/compat/common/compat_60_mod.c
 cvs rdiff -u -r1.1 -r1.1.28.1 \
     src/sys/modules/arch/x86/amd64-xen/bsd.amd64-xen.mk
 cvs rdiff -u -r1.1 -r1.1.28.1 \
     src/sys/modules/arch/x86/i386-xen/bsd.i386-xen.mk
 cvs rdiff -u -r1.1 -r1.1.28.1 \
     src/sys/modules/arch/x86/i386pae-xen/bsd.i386pae-xen.mk
 cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/modules/compat_60/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: kern-bug-people->port-xen-bug-people
Responsible-Changed-By: jdolecek@NetBSD.org
Responsible-Changed-When: Tue, 14 Aug 2018 17:51:32 +0000
Responsible-Changed-Why:
Moved to port-xen


Responsible-Changed-From-To: port-xen-bug-people->port-xen-maintainer
Responsible-Changed-By: jdolecek@NetBSD.org
Responsible-Changed-When: Tue, 28 Aug 2018 18:40:47 +0000
Responsible-Changed-Why:
Fixing to port-xen-maintainer


From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53130 CVS commit: src/doc
Date: Sun, 5 Jul 2020 02:04:25 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Sun Jul  5 02:04:25 UTC 2020

 Modified Files:
 	src/doc: TODO.modules

 Log Message:
 Note that the xen vs non-xen issue has been resolved by recent commit
 from Chuck Silvers.  (Also add xref to PR port-xen/53130 for history.)


 To generate a diff of this commit:
 cvs rdiff -u -r1.21 -r1.22 src/doc/TODO.modules

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Sun, 05 Jul 2020 02:09:27 +0000
State-Changed-Why:
iChuck Silvers removed the differences between xen and non-xen modules, so
this issue is moot.


From: "Paul Goyette" <pgoyette@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53130 CVS commit: src/sys/compat/common
Date: Tue, 25 May 2021 16:50:50 +0000

 Module Name:	src
 Committed By:	pgoyette
 Date:		Tue May 25 16:50:49 UTC 2021

 Modified Files:
 	src/sys/compat/common: Makefile

 Log Message:
 PR port-xen/53130 was fixed and closed some time ago, so now we can
 belatedly re-enable inclusion of the compat_60 x86 microcode code in
 the loadable module.  (It was already being included in the built-in
 version of the module.)


 To generate a diff of this commit:
 cvs rdiff -u -r1.65 -r1.66 src/sys/compat/common/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.