tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: amd64 profiling kernel build failure
Hi,
On 2016/01/08 16:00, David Holland wrote:
> On Fri, Jan 08, 2016 at 06:50:02AM +0000, David Holland wrote:
> > > --- a/sys/kern/subr_prof.c
> > > +++ b/sys/kern/subr_prof.c
> > > @@ -48,6 +48,10 @@ __KERNEL_RCSID(0, "$NetBSD: subr_prof.c,v 1.47 2014/07/10 21:13:52 christos Exp
> > > #include <sys/malloc.h>
> > > #include <sys/gmon.h>
> > >
> > > +#ifdef MULTIPROCESSOR
> > > +__cpu_simple_lock_t __mcount_lock;
> > > +#endif
> > > +
> >
> > This should be in an MD file. Not sure offhand which one.
>
> Also, the i386 profile.h needs the same change as the amd64 one, so
> the md file should probably be one in arch/x86/x86.
I update the patch. I define "__mcount_lock" in the new file
sys/arch/x86/x86/profile.c. Here is the patch.
====================
diff --git a/sys/arch/amd64/include/profile.h b/sys/arch/amd64/include/profile.h
index f760594..24ea606 100644
--- a/sys/arch/amd64/include/profile.h
+++ b/sys/arch/amd64/include/profile.h
@@ -85,7 +85,7 @@ __asm(" .globl __mcount \n" \
#ifdef _KERNEL
#ifdef MULTIPROCESSOR
-__cpu_simple_lock_t __mcount_lock;
+extern __cpu_simple_lock_t __mcount_lock;
static inline void
MCOUNT_ENTER_MP(void)
diff --git a/sys/arch/i386/include/profile.h b/sys/arch/i386/include/profile.h
index d49e95a..7ac9b4f 100644
--- a/sys/arch/i386/include/profile.h
+++ b/sys/arch/i386/include/profile.h
@@ -84,7 +84,7 @@ mcount(void) \
#ifdef _KERNEL
#ifdef MULTIPROCESSOR
-__cpu_simple_lock_t __mcount_lock;
+extern __cpu_simple_lock_t __mcount_lock;
static inline void
MCOUNT_ENTER_MP(void)
diff --git a/sys/arch/x86/conf/files.x86 b/sys/arch/x86/conf/files.x86
index 2edb65f..4911c35 100644
--- a/sys/arch/x86/conf/files.x86
+++ b/sys/arch/x86/conf/files.x86
@@ -28,6 +28,8 @@ device cpu: cpufeaturebus
attach cpu at cpubus
file arch/x86/x86/cpu.c cpu
+file arch/x86/x86/profile.c
+
device acpicpu: acpi
attach acpicpu at cpufeaturebus
file dev/acpi/acpi_cpu.c acpicpu
diff --git a/sys/arch/x86/x86/profile.c b/sys/arch/x86/x86/profile.c
new file mode 100644
index 0000000..9d554fb
--- /dev/null
+++ b/sys/arch/x86/x86/profile.c
@@ -0,0 +1,38 @@
+/* $NetBSD$ */
+
+/*
+ * Copyright (c) 2016 Internet Initiative Japan Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+
+#include "opt_multiprocessor.h"
+
+#include <machine/lock.h>
+
+#ifdef MULTIPROCESSOR
+__cpu_simple_lock_t __mcount_lock;
+#endif
====================
Could you comment this patch? Any comments are welcome.
Thanks,
--
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.
Device Engineering Section,
Core Product Development Department,
Product Division,
Technology Unit
Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>
Home |
Main Index |
Thread Index |
Old Index