NetBSD Problem Report #53389
From www@NetBSD.org Fri Jun 22 03:40:21 2018
Return-Path: <www@NetBSD.org>
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 30A847A182
for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Jun 2018 03:40:21 +0000 (UTC)
Message-Id: <20180622034020.299A17A272@mollari.NetBSD.org>
Date: Fri, 22 Jun 2018 03:40:20 +0000 (UTC)
From: est@ceres.ne.jp
Reply-To: est@ceres.ne.jp
To: gnats-bugs@NetBSD.org
Subject: ataraid doesn't work without _MODULE
X-Send-Pr-Version: www-1.0
>Number: 53389
>Category: kern
>Synopsis: ataraid doesn't work without _MODULE
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pgoyette
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 22 03:45:00 +0000 2018
>Closed-Date: Sat Jun 23 13:04:47 +0000 2018
>Last-Modified: Sat Jun 23 13:04:47 +0000 2018
>Originator: Est Suzumenomiya
>Release: 8.0_RC1
>Organization:
>Environment:
NetBSD 8.0_RC1 NetBSD 8.0_RC1 (GENERIC) #5: Fri Jun 22 11:31:21 JST 2018 est@izumi.ceres.ne.jp:/private/build/20180622/amd64/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
ataraid (e.g. Intel MatrixRAID) doesn't configured, because config_cfattach_attach() never called by sys/dev/ata/ata_raid.c without _MODULE.
>How-To-Repeat:
Boot GENERIC kernel on PC with ATA RAID device.
>Fix:
--- sys/dev/ata/ata_raid.c.ORIG 2018-05-14 17:28:37.422105691 +0900
+++ sys/dev/ata/ata_raid.c 2018-06-15 18:01:25.820474782 +0900
@@ -161,6 +161,9 @@
.cf_unit = 0,
.cf_fstate = FSTATE_STAR,
};
+#ifndef _MODULE
+ int error;
+#endif
/*
* Only run once for each instantiation
@@ -172,6 +175,16 @@
if (TAILQ_EMPTY(&ataraid_array_info_list))
goto out;
+#ifndef _MODULE
+ error = config_cfattach_attach(ataraid_cd.cd_name, &ataraid_ca);
+ if (error) {
+ printf("%s: unable to register cfattach, error = %d\n",
+ ataraid_cd.cd_name, error);
+ (void) config_cfdriver_detach(&ataraid_cd);
+ goto out;
+ }
+#endif
+
if (config_attach_pseudo(&ataraid_cfdata) == NULL)
printf("%s: unable to attach an instance\n",
ataraid_cd.cd_name);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->pgoyette
Responsible-Changed-By: pgoyette@NetBSD.org
Responsible-Changed-When: Fri, 22 Jun 2018 07:06:42 +0000
Responsible-Changed-Why:
It's my bug
From: Paul Goyette <paul@whooppee.com>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org
Subject: Re: kern/53389: ataraid doesn't work without _MODULE
Date: Fri, 22 Jun 2018 15:05:42 +0800 (+08)
Can you please try the following patch _instead of_ your suggestion?
This patch calls config_cfattach_attach() in the ataraid_modcmd() code
whether or not it is built as a module, and avoids duplication of the
call. This version also handles the MODULE_FINI situation which can
occur if a built-in module is explicitly disabled via modctl(8).
Index: ata_raid.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ata/ata_raid.c,v
retrieving revision 1.39
diff -u -p -r1.39 ata_raid.c
--- ata_raid.c 27 Sep 2016 08:05:34 -0000 1.39
+++ ata_raid.c 22 Jun 2018 07:03:08 -0000
@@ -338,26 +338,27 @@ ataraid_modcmd(modcmd_t cmd, void *arg)
error = config_cfdriver_attach(&ataraid_cd);
if (error)
break;
+#endif
error = config_cfattach_attach(ataraid_cd.cd_name, &ataraid_ca);
if (error) {
+#ifdef _MODULE
config_cfdriver_detach(&ataraid_cd);
+#endif
aprint_error("%s: unable to register cfattach for \n"
"%s, error %d", __func__, ataraid_cd.cd_name,
error);
break;
}
-#endif
break;
case MODULE_CMD_FINI:
-#ifdef _MODULE
-
error = config_cfattach_detach(ataraid_cd.cd_name, &ataraid_ca);
if (error) {
aprint_error("%s: failed to detach %s cfattach, "
"error %d\n", __func__, ataraid_cd.cd_name, error);
break;
}
+#ifdef _MODULE
error = config_cfdriver_detach(&ataraid_cd);
if (error) {
(void)config_cfattach_attach(ataraid_cd.cd_name,
+------------------+--------------------------+----------------------------+
| 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 |
+------------------+--------------------------+----------------------------+
From: Est Suzumenomiya <est@ceres.ne.jp>
To: gnats-bugs@NetBSD.org, pgoyette@NetBSD.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Cc:
Subject: Re: kern/53389: ataraid doesn't work without _MODULE
Date: Fri, 22 Jun 2018 17:41:48 +0900
It seems to work fine, thank you.
On 2018/06/22 16:10, Paul Goyette wrote:
> The following reply was made to PR kern/53389; it has been noted by GNATS.
>
> From: Paul Goyette <paul@whooppee.com>
> To: gnats-bugs@NetBSD.org
> Cc: kern-bug-people@netbsd.org
> Subject: Re: kern/53389: ataraid doesn't work without _MODULE
> Date: Fri, 22 Jun 2018 15:05:42 +0800 (+08)
>
> Can you please try the following patch _instead of_ your suggestion?
>
> This patch calls config_cfattach_attach() in the ataraid_modcmd() code
> whether or not it is built as a module, and avoids duplication of the
> call. This version also handles the MODULE_FINI situation which can
> occur if a built-in module is explicitly disabled via modctl(8).
State-Changed-From-To: open->pending-pullups
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Fri, 22 Jun 2018 09:08:55 +0000
State-Changed-Why:
Ticket 8-894 submitted
State-Changed-From-To: pending-pullups->closed
State-Changed-By: pgoyette@NetBSD.org
State-Changed-When: Sat, 23 Jun 2018 13:04:47 +0000
State-Changed-Why:
Pullup 8-894 committed
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.