Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Aug 2018 14:04:51 +0000 (UTC)
From:      Leandro Lupori <luporl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337537 - in head/sys: kern netinet netinet6
Message-ID:  <201808091404.w79E4p5F052553@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luporl
Date: Thu Aug  9 14:04:51 2018
New Revision: 337537
URL: https://svnweb.freebsd.org/changeset/base/337537

Log:
  [ppc] Fix kernel panic when using BOOTP_NFSROOT
  
  On PowerPC (and possibly other architectures), that doesn't use
  EARLY_AP_STARTUP, the config task queue may be used initialized.
  This was observed while trying to mount the root fs from NFS, as
  reported here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230168.
  
  This patch has 2 main changes:
  1- Perform a basic initialization of qgroup_config, similar to
  what is done in taskqgroup_adjust, but simpler.
  This makes qgroup_config ready to be used during NFS root mount.
  
  2- When EARLY_AP_STARTUP is not used, call inm_init() and
  in6m_init() right before SI_SUB_ROOT_CONF, because bootp needs
  to send multicast packages to request an IP.
  
  PR:		Bug 230168
  Reported by:	sbruno
  Reviewed by:	jhibbits, mmacy, sbruno
  Approved by:	jhibbits
  Differential Revision:	D16633

Modified:
  head/sys/kern/subr_gtaskqueue.c
  head/sys/netinet/in_mcast.c
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/kern/subr_gtaskqueue.c
==============================================================================
--- head/sys/kern/subr_gtaskqueue.c	Thu Aug  9 12:46:30 2018	(r337536)
+++ head/sys/kern/subr_gtaskqueue.c	Thu Aug  9 14:04:51 2018	(r337537)
@@ -857,6 +857,24 @@ taskqgroup_bind(struct taskqgroup *qgroup)
 	}
 }
 
+static void
+taskqgroup_config_init(void *arg)
+{
+	struct taskqgroup *qgroup = qgroup_config;
+	LIST_HEAD(, grouptask) gtask_head = LIST_HEAD_INITIALIZER(NULL);
+
+	LIST_SWAP(&gtask_head, &qgroup->tqg_queue[0].tgc_tasks,
+	    grouptask, gt_list);
+	qgroup->tqg_queue[0].tgc_cnt = 0;
+	taskqgroup_cpu_create(qgroup, 0, 0);
+
+	qgroup->tqg_cnt = 1;
+	qgroup->tqg_stride = 1;
+}
+
+SYSINIT(taskqgroup_config_init, SI_SUB_TASKQ, SI_ORDER_SECOND,
+	taskqgroup_config_init, NULL);
+
 static int
 _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride)
 {

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Thu Aug  9 12:46:30 2018	(r337536)
+++ head/sys/netinet/in_mcast.c	Thu Aug  9 14:04:51 2018	(r337537)
@@ -231,8 +231,13 @@ static void inm_init(void)
 	taskqgroup_config_gtask_init(NULL, &free_gtask, inm_release_task, "inm release task");
 }
 
+#ifdef EARLY_AP_STARTUP
 SYSINIT(inm_init, SI_SUB_SMP + 1, SI_ORDER_FIRST,
 	inm_init, NULL);
+#else
+SYSINIT(inm_init, SI_SUB_ROOT_CONF - 1, SI_ORDER_FIRST,
+	inm_init, NULL);
+#endif
 
 
 void

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Thu Aug  9 12:46:30 2018	(r337536)
+++ head/sys/netinet6/in6_mcast.c	Thu Aug  9 14:04:51 2018	(r337537)
@@ -562,8 +562,13 @@ static void in6m_init(void)
 	taskqgroup_config_gtask_init(NULL, &free_gtask, in6m_release_task, "in6m release task");
 }
 
+#ifdef EARLY_AP_STARTUP
 SYSINIT(in6m_init, SI_SUB_SMP + 1, SI_ORDER_FIRST,
 	in6m_init, NULL);
+#else
+SYSINIT(in6m_init, SI_SUB_ROOT_CONF - 1, SI_ORDER_SECOND,
+	in6m_init, NULL);
+#endif
 
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808091404.w79E4p5F052553>