From: Alexander Holler <holler@ahsoftware.de>
To: Joerg Roedel <joro@8bytes.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: AMD-IOMMU and problem with __init(data)?
Date: Wed, 23 Sep 2015 21:04:31 +0200 [thread overview]
Message-ID: <5602F7BF.4020009@ahsoftware.de> (raw)
In-Reply-To: <5602CA2B.5000106@ahsoftware.de>
[-- Attachment #1: Type: text/plain, Size: 779 bytes --]
Am 23.09.2015 um 17:50 schrieb Alexander Holler:
> Am 23.09.2015 um 13:43 schrieb Joerg Roedel:
>>> If it's necessary, I could try put together a small patch which
>>> kills a system (reproducible here).
>>
>> That would help too, please also send me your .config and I'll try to
>> reproduce the issue here.
>
> Will do. Later.
Done. Patch(es) and config attached. Note, while reducing the patch,
I've noted that when I change
struct _annotated_initcall {
initcall_t initcall;
unsigned driver_id;
unsigned *dependencies;
struct device_driver *driver;
};
to
struct _annotated_initcall {
initcall_t initcall;
unsigned driver_id;
};
it does not crash. That's what the second patch does. So in order to
crash a system, just use patch 0001.
Regards,
Alexander Holler
[-- Attachment #2: 0001-CRASH-on-AMD-with-CONFIG_AMD_IOMMU.patch --]
[-- Type: text/x-patch, Size: 2313 bytes --]
>From d94e5568925d7cb8a3fc628606e8fcf1374ea177 Mon Sep 17 00:00:00 2001
From: Alexander Holler <holler@ahsoftware.de>
Date: Wed, 23 Sep 2015 19:43:51 +0200
Subject: [PATCH 1/2] CRASH on AMD with CONFIG_AMD_IOMMU
---
include/asm-generic/vmlinux.lds.h | 6 ++++++
init/main.c | 30 +++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 8bd374d..13f9189 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -660,6 +660,11 @@
INIT_CALLS_LEVEL(7) \
VMLINUX_SYMBOL(__initcall_end) = .;
+#define ANNOTATED_INITCALLS \
+ VMLINUX_SYMBOL(__annotated_initcall_start) = .; \
+ *(.annotated_initcall.init) \
+ VMLINUX_SYMBOL(__annotated_initcall_end) = .;
+
#define CON_INITCALL \
VMLINUX_SYMBOL(__con_initcall_start) = .; \
*(.con_initcall.init) \
@@ -816,6 +821,7 @@
INIT_DATA \
INIT_SETUP(initsetup_align) \
INIT_CALLS \
+ ANNOTATED_INITCALLS \
CON_INITCALL \
SECURITY_INITCALL \
INIT_RAM_FS \
diff --git a/init/main.c b/init/main.c
index 5650655..1498f9b 100644
--- a/init/main.c
+++ b/init/main.c
@@ -859,12 +859,40 @@ static void __init do_initcall_level(int level)
do_one_initcall(*fn);
}
+struct _annotated_initcall {
+ initcall_t initcall;
+ unsigned driver_id;
+ unsigned *dependencies;
+ struct device_driver *driver;
+};
+extern struct _annotated_initcall __annotated_initcall_start[];
+
+#define annotated_initcall(fn, id) \
+ static struct _annotated_initcall __annotated_initcall_##fn __used \
+ __attribute__((__section__(".annotated_initcall.init"))) = \
+ { .initcall = fn, .driver_id = id }
+
+
+static int __init foo(void)
+{
+ return 0;
+}
+
+annotated_initcall(foo, 23);
+
static void __init do_initcalls(void)
{
int level;
+ struct _annotated_initcall *ac;
- for (level = 0; level < ARRAY_SIZE(initcall_levels) - 1; level++)
+ for (level = 0; level < ARRAY_SIZE(initcall_levels) - 3; level++)
do_initcall_level(level);
+
+ ac = __annotated_initcall_start;
+ pr_info("ac %p ID %u\n", ac, ac->driver_id);
+ BUG_ON(ac->driver_id != 23);
+ do_initcall_level(level++);
+ do_initcall_level(level);
}
/*
--
2.1.0
[-- Attachment #3: 0002-NO-crash.patch --]
[-- Type: text/x-patch, Size: 632 bytes --]
>From 17c9b286710931947c63ef49bba69f679ecdc400 Mon Sep 17 00:00:00 2001
From: Alexander Holler <holler@ahsoftware.de>
Date: Wed, 23 Sep 2015 20:39:28 +0200
Subject: [PATCH 2/2] NO crash
---
init/main.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/init/main.c b/init/main.c
index 1498f9b..4c1f041 100644
--- a/init/main.c
+++ b/init/main.c
@@ -862,8 +862,6 @@ static void __init do_initcall_level(int level)
struct _annotated_initcall {
initcall_t initcall;
unsigned driver_id;
- unsigned *dependencies;
- struct device_driver *driver;
};
extern struct _annotated_initcall __annotated_initcall_start[];
--
2.1.0
[-- Attachment #4: crash_amd_iommu.config.bz2 --]
[-- Type: application/x-bzip, Size: 23799 bytes --]
next prev parent reply other threads:[~2015-09-23 19:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 10:22 AMD-IOMMU and problem with __init(data)? Alexander Holler
2015-09-23 11:43 ` Joerg Roedel
2015-09-23 15:50 ` Alexander Holler
2015-09-23 19:04 ` Alexander Holler [this message]
2015-09-26 8:18 ` Alexander Holler
2015-09-29 15:06 ` Joerg Roedel
2015-09-29 17:17 ` Alexander Holler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5602F7BF.4020009@ahsoftware.de \
--to=holler@ahsoftware.de \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox