NetBSD Problem Report #58148

From www@netbsd.org  Sat Apr 13 08:39:37 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_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 348851A923A
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 13 Apr 2024 08:39:37 +0000 (UTC)
Message-Id: <20240413083935.708AD1A923B@mollari.NetBSD.org>
Date: Sat, 13 Apr 2024 08:39:35 +0000 (UTC)
From: vezhlys@gmail.com
Reply-To: vezhlys@gmail.com
To: gnats-bugs@NetBSD.org
Subject: viac7temp(4) module fails to load
X-Send-Pr-Version: www-1.0

>Number:         58148
>Category:       kern
>Synopsis:       viac7temp(4) module fails to load
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    andvar
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 13 08:40:00 +0000 2024
>Closed-Date:    Fri Apr 19 02:40:59 +0000 2024
>Last-Modified:  Fri Apr 19 02:40:59 +0000 2024
>Originator:     Andrius V
>Release:        NetBSD 8, 9, 10, current
>Organization:
>Environment:
>Description:
If viac7temp(4) module is not built-in and one attempts to load it using modules, it will fail:
WARNING: module error: `link_set_modules' section not present, error 2
WARNING: module error: cannot fetch info for `viac7temp', error 2

objdump -h viac7temp.kmod confirms that this section is missing.

The issue is present in all currently supported versions (8, 9, 10). I assume it was missed because it is built-in by default and nobody really tries to load it from modules.




>How-To-Repeat:
Build kernel without viac7temp driver and boot to it.
modload viac7temp
>Fix:
The patch below fixes an issue and module loads. I don't have currently a CPU which actually shows the temperature (getting 0), but it may be hardware or some different bug/issue, which I may address in the future.

Index: sys/arch/x86/x86/viac7temp.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/viac7temp.c,v
retrieving revision 1.9
diff -u -p -r1.9 viac7temp.c
--- sys/arch/x86/x86/viac7temp.c	7 Oct 2021 12:52:27 -0000	1.9
+++ sys/arch/x86/x86/viac7temp.c	12 Apr 2024 23:25:42 -0000
@@ -32,6 +32,7 @@ __KERNEL_RCSID(0, "$NetBSD: viac7temp.c,
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/kmem.h>
+#include <sys/module.h>
 #include <sys/xcall.h>

 #include <dev/sysmon/sysmonvar.h>
@@ -162,3 +163,32 @@ viac7temp_refresh_xcall(void *arg0, void
 	edata->value_cur += 273150000;
 	edata->state = ENVSYS_SVALID;
 }
+
+MODULE(MODULE_CLASS_DRIVER, viac7temp, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+viac7temp_modcmd(modcmd_t cmd, void *arg __unused)
+{
+	int error = 0;
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+#ifdef _MODULE
+		error = config_init_component(cfdriver_ioconf_viac7temp,
+		    cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	case MODULE_CMD_FINI:
+#ifdef _MODULE
+		error = config_fini_component(cfdriver_ioconf_viac7temp,
+		    cfattach_ioconf_viac7temp, cfdata_ioconf_viac7temp);
+#endif
+		return error;
+	default:
+		return ENOTTY;
+	}
+}

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->andvar
Responsible-Changed-By: andvar@NetBSD.org
Responsible-Changed-When: Sat, 13 Apr 2024 08:55:36 +0000
Responsible-Changed-Why:
take


From: "Andrius Varanavicius" <andvar@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58148 CVS commit: src/sys/arch/x86/x86
Date: Sat, 13 Apr 2024 09:12:09 +0000

 Module Name:	src
 Committed By:	andvar
 Date:		Sat Apr 13 09:12:09 UTC 2024

 Modified Files:
 	src/sys/arch/x86/x86: viac7temp.c

 Log Message:
 viac7temp(4): define module metadata using MODULE() macro and implement
 viac7temp_modcmd() to handle module load/unload events.

 Fixes PR kern/58148. Look OK by mrg@.

 XXX pullup-10, -9, -8


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.10 src/sys/arch/x86/x86/viac7temp.c

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

State-Changed-From-To: open->pending-pullups
State-Changed-By: andvar@NetBSD.org
State-Changed-When: Sat, 13 Apr 2024 09:35:46 +0000
State-Changed-Why:
[pullup-10 #662] [pullup-9 #1835] [pullup-8 #1959]

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58148 CVS commit: [netbsd-10] src/sys/arch/x86/x86
Date: Thu, 18 Apr 2024 16:39:08 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Apr 18 16:39:08 UTC 2024

 Modified Files:
 	src/sys/arch/x86/x86 [netbsd-10]: viac7temp.c

 Log Message:
 Pull up following revision(s) (requested by andvar in ticket #662):

 	sys/arch/x86/x86/viac7temp.c: revision 1.10

 viac7temp(4): define module metadata using MODULE() macro and implement
 viac7temp_modcmd() to handle module load/unload events.

 Fixes PR kern/58148. Look OK by mrg@.


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/x86/x86/viac7temp.c

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58148 CVS commit: [netbsd-9] src/sys/arch/x86/x86
Date: Thu, 18 Apr 2024 16:40:17 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Apr 18 16:40:17 UTC 2024

 Modified Files:
 	src/sys/arch/x86/x86 [netbsd-9]: viac7temp.c

 Log Message:
 Pull up following revision(s) (requested by andvar in ticket #1835):

 	sys/arch/x86/x86/viac7temp.c: revision 1.10

 viac7temp(4): define module metadata using MODULE() macro and implement
 viac7temp_modcmd() to handle module load/unload events.

 Fixes PR kern/58148. Look OK by mrg@.


 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.8.32.1 src/sys/arch/x86/x86/viac7temp.c

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58148 CVS commit: [netbsd-8] src/sys/arch/x86/x86
Date: Thu, 18 Apr 2024 16:44:21 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Apr 18 16:44:21 UTC 2024

 Modified Files:
 	src/sys/arch/x86/x86 [netbsd-8]: viac7temp.c

 Log Message:
 Pull up following revision(s) (requested by andvar in ticket #1959):

 	sys/arch/x86/x86/viac7temp.c: revision 1.10

 viac7temp(4): define module metadata using MODULE() macro and implement
 viac7temp_modcmd() to handle module load/unload events.

 Fixes PR kern/58148. Look OK by mrg@.


 To generate a diff of this commit:
 cvs rdiff -u -r1.8 -r1.8.20.1 src/sys/arch/x86/x86/viac7temp.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 19 Apr 2024 02:40:59 +0000
State-Changed-Why:
fixed and pulled up


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.