From nobody@nwww.freebsd.org  Sun May  5 14:02:46 2002
Return-Path: <nobody@nwww.freebsd.org>
Received: from nwww.freebsd.org (nwww.FreeBSD.org [216.136.204.117])
	by hub.freebsd.org (Postfix) with ESMTP id 4ABA237B400
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  5 May 2002 14:02:46 -0700 (PDT)
Received: from nwww.freebsd.org (localhost [127.0.0.1])
	by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g45L46hG080978
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 5 May 2002 14:04:06 -0700 (PDT)
	(envelope-from nobody@nwww.freebsd.org)
Received: (from nobody@localhost)
	by nwww.freebsd.org (8.12.2/8.12.2/Submit) id g45L46lq080977;
	Sun, 5 May 2002 14:04:06 -0700 (PDT)
Message-Id: <200205052104.g45L46lq080977@nwww.freebsd.org>
Date: Sun, 5 May 2002 14:04:06 -0700 (PDT)
From: Piet Honkoop <piet.honkoop@softcontrol.nl>
To: freebsd-gnats-submit@FreeBSD.org
Subject: netsmb/smb_subr.c needs opt_global.h in SMP environment
X-Send-Pr-Version: www-1.0

>Number:         37775
>Category:       kern
>Synopsis:       [smbfs] netsmb/smb_subr.c needs opt_global.h in SMP environment
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 05 14:10:01 PDT 2002
>Closed-Date:    Tue Aug 30 10:09:05 GMT 2005
>Last-Modified:  Tue Aug 30 10:09:05 GMT 2005
>Originator:     Piet Honkoop
>Release:        4.6-PRERELEASE
>Organization:
Wirehub! Internet
>Environment:
FreeBSD mefisto.wirehub.nl 4.6-PRERELEASE FreeBSD 4.6-PRERELEASE #13: Sun May  5 13:02:49 CEST 2002     root@mefisto.wirehub.nl:/usr/obj/usr/src/sys/mefisto  i386
>Description:
     netsmb/smb_subr.c tests for SMP environment as set by kernel options (line 373). As opt_global.h is not included, the produced module will not load on a SMP system. Error: 
error: module compiled without SMP support
>How-To-Repeat:
kernel config: options SMP
and use a box with > 1 CPU :)
>Fix:
#include "opt_global.h" 
(my only problem is that I don't know enough of the kernel include structure to do that without a hard path; /usr/obj/src/sys/<kernelname> should be in the includepaths, I presume?
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->bp 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Mon May 6 01:17:59 PDT 2002 
Responsible-Changed-Why:  
Boris, this PR looks relatively easy to fix. We just need to 
include opt_global.h in smb_subr.h somewhere. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37775 
State-Changed-From-To: open->feedback 
State-Changed-By: dwmalone 
State-Changed-When: Mon May 6 11:23:05 PDT 2002 
State-Changed-Why:  
Boris suggests that this is a more general problem and that the 
best thing to do is compile smbfs into the kernel. (See the 
PR audit trail for his full message). 


Responsible-Changed-From-To: bp->freebsd-bugs 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Mon May 6 11:23:05 PDT 2002 
Responsible-Changed-Why:  
Boris suggests that this is a more general problem and that the 
best thing to do is compile smbfs into the kernel. (See the 
PR audit trail for his full message). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37775 

From: Peter Pentchev <roam@ringlet.net>
To: Piet Honkoop <piet@wirehub.net>
Cc: dwmalone@FreeBSD.org, bp@FreeBSD.org, bug-followup@FreeBSD.org
Subject: Re: misc/37775: netsmb/smb_subr.c needs opt_global.h in SMP environment
Date: Tue, 7 May 2002 15:10:51 +0300

 On Tue, May 07, 2002 at 12:56:46AM +0200, Piet Honkoop wrote:
 > On Mon, 6 May 2002 dwmalone@FreeBSD.org wrote:
 > 
 > > Synopsis: netsmb/smb_subr.c needs opt_global.h in SMP environment
 > >
 > > State-Changed-From-To: open->feedback
 > > State-Changed-By: dwmalone
 > > State-Changed-When: Mon May 6 11:23:05 PDT 2002
 > > State-Changed-Why:
 > > Boris suggests that this is a more general problem and that the
 > > best thing to do is compile smbfs into the kernel. (See the
 > > PR audit trail for his full message).
 > >
 > 
 > Can imagine that because compiling into the kernel does produce a working
 > situation. Looking further into the situation, the logic seems to be that
 > the kernel compilation process uses (together with a hurdle of other
 > options):  -D_KERNEL -include opt_global.h
 > whereas modules only use:  -D_KERNEL
 > which would explain why opt_global.h is not included in the module.
 > Does this mean there is an omission in kmod.mk? (grep -r through /usr/sys
 > does bring you somewhere...)
 
 Not really, at least IMHO; as far as I can understand, opt_global.h
 is generated by config(8) as part of the parsing of the kernel config
 file.  Modules are built independently, not tied in with any config file;
 thus, a module should not depend on, or use at all, any files, header
 or otherwise, generated as part of the config(8) run.
 
 As a matter of fact, I believe that modules are even built in separate
 directories, so opt_global.h is not even in the CWD, and the error
 generated by adding '-include opt_global.h' to CFLAGS would serve
 no useful purpose at all :)
 
 The correct way to build a module with SMP support would be something like:
 
 # cd /usr/src/sys/modules/netsmb
 # make cleandir && make cleandir
 # make CFLAGS=-DSMP depend
 # make CFLAGS=-DSMP all install
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 Thit sentence is not self-referential because "thit" is not a word.

From: Piet Honkoop <piet@wirehub.net>
To: Peter Pentchev <roam@ringlet.net>
Cc: dwmalone@FreeBSD.org, <bp@FreeBSD.org>,
	<bug-followup@FreeBSD.org>
Subject: Re: misc/37775: netsmb/smb_subr.c needs opt_global.h in SMP environment
Date: Tue, 7 May 2002 15:09:51 +0100 (T)

 On Tue, 7 May 2002, Peter Pentchev wrote:
 
 > On Tue, May 07, 2002 at 12:56:46AM +0200, Piet Honkoop wrote:
 > > On Mon, 6 May 2002 dwmalone@FreeBSD.org wrote:
 > >
 > > > Synopsis: netsmb/smb_subr.c needs opt_global.h in SMP environment
 > > >
 > > > State-Changed-From-To: open->feedback
 > > > State-Changed-By: dwmalone
 > > > State-Changed-When: Mon May 6 11:23:05 PDT 2002
 > > > State-Changed-Why:
 > > > Boris suggests that this is a more general problem and that the
 > > > best thing to do is compile smbfs into the kernel. (See the
 > > > PR audit trail for his full message).
 > > >
 > >
 > > Can imagine that because compiling into the kernel does produce a working
 > > situation. Looking further into the situation, the logic seems to be that
 > > the kernel compilation process uses (together with a hurdle of other
 > > options):  -D_KERNEL -include opt_global.h
 > > whereas modules only use:  -D_KERNEL
 > > which would explain why opt_global.h is not included in the module.
 > > Does this mean there is an omission in kmod.mk? (grep -r through /usr/sys
 > > does bring you somewhere...)
 >
 > Not really, at least IMHO; as far as I can understand, opt_global.h
 > is generated by config(8) as part of the parsing of the kernel config
 > file.  Modules are built independently, not tied in with any config file;
 > thus, a module should not depend on, or use at all, any files, header
 > or otherwise, generated as part of the config(8) run.
 >
 
 I agree a module should be built independently. But if the module code
 depends on a *choice* the sysop makes in his/her kernel config file then
 the module should also access the generated .h files from that config
 file. Or the dependency should be removed.
 
 > As a matter of fact, I believe that modules are even built in separate
 > directories, so opt_global.h is not even in the CWD, and the error
 > generated by adding '-include opt_global.h' to CFLAGS would serve
 > no useful purpose at all :)
 >
 > The correct way to build a module with SMP support would be something like:
 >
 
 Agreed. But as it is now, there is a significant difference in building
 the module as
 
 options smbfs
 
 or as a separate module. And the way I understand the module system, they
 should be equivalent. Right?
 
 Ciao,
 
 Piet
 
 > # cd /usr/src/sys/modules/netsmb
 > # make cleandir && make cleandir
 > # make CFLAGS=-DSMP depend
 > # make CFLAGS=-DSMP all install
 >
 > G'luck,
 > Peter
 >
 >
 
 -- 
 =========================================================================
 Wirehub! Internet BV                                  tel. +31 10 2448344
 Westzeedijk 487					      fax. +31 10 2448300
 3024 EL Rotterdam				   http://www.wirehub.net
 
 

From: Boris Popov <bp@butya.kz>
To: Piet Honkoop <piet@wirehub.net>
Cc: Peter Pentchev <roam@ringlet.net>, dwmalone@FreeBSD.org,
	bug-followup@FreeBSD.org
Subject: Re: misc/37775: netsmb/smb_subr.c needs opt_global.h in SMP environment
Date: Tue, 7 May 2002 21:52:19 +0700 (ALMST)

 On Tue, 7 May 2002, Piet Honkoop wrote:
 
 > I agree a module should be built independently. But if the module code
 > depends on a *choice* the sysop makes in his/her kernel config file then
 > the module should also access the generated .h files from that config
 > file. Or the dependency should be removed.
 
 	This is an ongoing work in -current carried by Peter Wemm. New
 mechanism will use single configuration files for kernel and modules.
 
 > Agreed. But as it is now, there is a significant difference in building
 > the module as
 > 
 > options smbfs
 > 
 > or as a separate module. And the way I understand the module system, they
 > should be equivalent. Right?
 
 	In the ideal world - yes :) But for now locking things have
 conditional compilation for SMP and UP case. Makefile for smbfs addresses
 this problem at some extent:
 
 > > # cd /usr/src/sys/modules/netsmb
 > > # make cleandir && make cleandir
 > > # make CFLAGS=-DSMP depend
 > > # make CFLAGS=-DSMP all install
 
 	Mostly correct, but I'm abuse this feature even in the more
 dangerous way by defining SMPKERNEL=yes in the make.conf file and
 modifying kmod.mk like this:
 
 .if defined(SMPKERNEL)
 CFLAGS += -DSMP -DAPIC_IO
 .endif
 
 	:)
 
 -- 
 Boris Popov
 http://rbp.euro.ru
 
State-Changed-From-To: feedback->closed 
State-Changed-By: matteo 
State-Changed-When: Tue Aug 30 10:08:46 GMT 2005 
State-Changed-Why:  
Feedback timeout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37775 
>Unformatted:
