* [PATCH v6 6/8] kernel/jump_label: abstract jump_entry member accessors
From: Ard Biesheuvel @ 2017-12-27 8:50 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227085033.22389-1-ard.biesheuvel@linaro.org>
In preparation of allowing architectures to use relative references
in jump_label entries [which can dramatically reduce the memory
footprint], introduce abstractions for references to the 'code' and
'key' members of struct jump_entry.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/arm/include/asm/jump_label.h | 27 ++++++++++++++
arch/arm64/include/asm/jump_label.h | 27 ++++++++++++++
arch/mips/include/asm/jump_label.h | 27 ++++++++++++++
arch/powerpc/include/asm/jump_label.h | 27 ++++++++++++++
arch/s390/include/asm/jump_label.h | 20 +++++++++++
arch/sparc/include/asm/jump_label.h | 27 ++++++++++++++
arch/tile/include/asm/jump_label.h | 27 ++++++++++++++
arch/x86/include/asm/jump_label.h | 27 ++++++++++++++
kernel/jump_label.c | 38 +++++++++-----------
9 files changed, 225 insertions(+), 22 deletions(-)
diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h
index e12d7d096fc0..7b05b404063a 100644
--- a/arch/arm/include/asm/jump_label.h
+++ b/arch/arm/include/asm/jump_label.h
@@ -45,5 +45,32 @@ struct jump_entry {
jump_label_t key;
};
+static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
+{
+ return entry->code;
+}
+
+static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
+{
+ return (struct static_key *)((unsigned long)entry->key & ~1UL);
+}
+
+static inline bool jump_entry_is_branch(const struct jump_entry *entry)
+{
+ return (unsigned long)entry->key & 1UL;
+}
+
+static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
+{
+ return entry->code == 0;
+}
+
+static inline void jump_entry_set_module_init(struct jump_entry *entry)
+{
+ entry->code = 0;
+}
+
+#define jump_label_swap NULL
+
#endif /* __ASSEMBLY__ */
#endif
diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h
index 1b5e0e843c3a..9d6e46355c89 100644
--- a/arch/arm64/include/asm/jump_label.h
+++ b/arch/arm64/include/asm/jump_label.h
@@ -62,5 +62,32 @@ struct jump_entry {
jump_label_t key;
};
+static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
+{
+ return entry->code;
+}
+
+static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
+{
+ return (struct static_key *)((unsigned long)entry->key & ~1UL);
+}
+
+static inline bool jump_entry_is_branch(const struct jump_entry *entry)
+{
+ return (unsigned long)entry->key & 1UL;
+}
+
+static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
+{
+ return entry->code == 0;
+}
+
+static inline void jump_entry_set_module_init(struct jump_entry *entry)
+{
+ entry->code = 0;
+}
+
+#define jump_label_swap NULL
+
#endif /* __ASSEMBLY__ */
#endif /* __ASM_JUMP_LABEL_H */
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h
index e77672539e8e..70df9293dc49 100644
--- a/arch/mips/include/asm/jump_label.h
+++ b/arch/mips/include/asm/jump_label.h
@@ -66,5 +66,32 @@ struct jump_entry {
jump_label_t key;
};
+static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
+{
+ return entry->code;
+}
+
+static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
+{
+ return (struct static_key *)((unsigned long)entry->key & ~1UL);
+}
+
+static inline bool jump_entry_is_branch(const struct jump_entry *entry)
+{
+ return (unsigned long)entry->key & 1UL;
+}
+
+static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
+{
+ return entry->code == 0;
+}
+
+static inline void jump_entry_set_module_init(struct jump_entry *entry)
+{
+ entry->code = 0;
+}
+
+#define jump_label_swap NULL
+
#endif /* __ASSEMBLY__ */
#endif /* _ASM_MIPS_JUMP_LABEL_H */
diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
index 9a287e0ac8b1..412b2699c9f6 100644
--- a/arch/powerpc/include/asm/jump_label.h
+++ b/arch/powerpc/include/asm/jump_label.h
@@ -59,6 +59,33 @@ struct jump_entry {
jump_label_t key;
};
+static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
+{
+ return entry->code;
+}
+
+static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
+{
+ return (struct static_key *)((unsigned long)entry->key & ~1UL);
+}
+
+static inline bool jump_entry_is_branch(const struct jump_entry *entry)
+{
+ return (unsigned long)entry->key & 1UL;
+}
+
+static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
+{
+ return entry->code == 0;
+}
+
+static inline void jump_entry_set_module_init(struct jump_entry *entry)
+{
+ entry->code = 0;
+}
+
+#define jump_label_swap NULL
+
#else
#define ARCH_STATIC_BRANCH(LABEL, KEY) \
1098: nop; \
diff --git a/arch/s390/include/asm/jump_label.h b/arch/s390/include/asm/jump_label.h
index 40f651292aa7..3d4a08e9514b 100644
--- a/arch/s390/include/asm/jump_label.h
+++ b/arch/s390/include/asm/jump_label.h
@@ -50,5 +50,25 @@ struct jump_entry {
jump_label_t key;
};
+static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
+{
+ return entry->code;
+}
+
+static inline jump_label_t jump_entry_key(const struct jump_entry *entry)
+{
+ return entry->key;
+}
+
+static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
+{
+ return entry->code == 0;
+}
+
+static inline void jump_entry_set_module_init(struct jump_entry *entry)
+{
+ entry->code = 0;
+}
+
#endif /* __ASSEMBLY__ */
#endif
diff --git a/arch/sparc/include/asm/jump_label.h b/arch/sparc/include/asm/jump_label.h
index 94eb529dcb77..18e893687f7c 100644
--- a/arch/sparc/include/asm/jump_label.h
+++ b/arch/sparc/include/asm/jump_label.h
@@ -48,5 +48,32 @@ struct jump_entry {
jump_label_t key;
};
+static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
+{
+ return entry->code;
+}
+
+static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
+{
+ return (struct static_key *)((unsigned long)entry->key & ~1UL);
+}
+
+static inline bool jump_entry_is_branch(const struct jump_entry *entry)
+{
+ return (unsigned long)entry->key & 1UL;
+}
+
+static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
+{
+ return entry->code == 0;
+}
+
+static inline void jump_entry_set_module_init(struct jump_entry *entry)
+{
+ entry->code = 0;
+}
+
+#define jump_label_swap NULL
+
#endif /* __ASSEMBLY__ */
#endif
diff --git a/arch/tile/include/asm/jump_label.h b/arch/tile/include/asm/jump_label.h
index cde7573f397b..86acaa6ff33d 100644
--- a/arch/tile/include/asm/jump_label.h
+++ b/arch/tile/include/asm/jump_label.h
@@ -55,4 +55,31 @@ struct jump_entry {
jump_label_t key;
};
+static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
+{
+ return entry->code;
+}
+
+static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
+{
+ return (struct static_key *)((unsigned long)entry->key & ~1UL);
+}
+
+static inline bool jump_entry_is_branch(const struct jump_entry *entry)
+{
+ return (unsigned long)entry->key & 1UL;
+}
+
+static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
+{
+ return entry->code == 0;
+}
+
+static inline void jump_entry_set_module_init(struct jump_entry *entry)
+{
+ entry->code = 0;
+}
+
+#define jump_label_swap NULL
+
#endif /* _ASM_TILE_JUMP_LABEL_H */
diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h
index 8c0de4282659..009ff2699d07 100644
--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -74,6 +74,33 @@ struct jump_entry {
jump_label_t key;
};
+static inline jump_label_t jump_entry_code(const struct jump_entry *entry)
+{
+ return entry->code;
+}
+
+static inline struct static_key *jump_entry_key(const struct jump_entry *entry)
+{
+ return (struct static_key *)((unsigned long)entry->key & ~1UL);
+}
+
+static inline bool jump_entry_is_branch(const struct jump_entry *entry)
+{
+ return (unsigned long)entry->key & 1UL;
+}
+
+static inline bool jump_entry_is_module_init(const struct jump_entry *entry)
+{
+ return entry->code == 0;
+}
+
+static inline void jump_entry_set_module_init(struct jump_entry *entry)
+{
+ entry->code = 0;
+}
+
+#define jump_label_swap NULL
+
#else /* __ASSEMBLY__ */
.macro STATIC_JUMP_IF_TRUE target, key, def
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 8594d24e4adc..4f44db58d981 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -37,10 +37,12 @@ static int jump_label_cmp(const void *a, const void *b)
const struct jump_entry *jea = a;
const struct jump_entry *jeb = b;
- if (jea->key < jeb->key)
+ if ((unsigned long)jump_entry_key(jea) <
+ (unsigned long)jump_entry_key(jeb))
return -1;
- if (jea->key > jeb->key)
+ if ((unsigned long)jump_entry_key(jea) >
+ (unsigned long)jump_entry_key(jeb))
return 1;
return 0;
@@ -53,7 +55,8 @@ jump_label_sort_entries(struct jump_entry *start, struct jump_entry *stop)
size = (((unsigned long)stop - (unsigned long)start)
/ sizeof(struct jump_entry));
- sort(start, size, sizeof(struct jump_entry), jump_label_cmp, NULL);
+ sort(start, size, sizeof(struct jump_entry), jump_label_cmp,
+ jump_label_swap);
}
static void jump_label_update(struct static_key *key);
@@ -254,8 +257,8 @@ EXPORT_SYMBOL_GPL(jump_label_rate_limit);
static int addr_conflict(struct jump_entry *entry, void *start, void *end)
{
- if (entry->code <= (unsigned long)end &&
- entry->code + JUMP_LABEL_NOP_SIZE > (unsigned long)start)
+ if (jump_entry_code(entry) <= (unsigned long)end &&
+ jump_entry_code(entry) + JUMP_LABEL_NOP_SIZE > (unsigned long)start)
return 1;
return 0;
@@ -314,16 +317,6 @@ static inline void static_key_set_linked(struct static_key *key)
key->type |= JUMP_TYPE_LINKED;
}
-static inline struct static_key *jump_entry_key(struct jump_entry *entry)
-{
- return (struct static_key *)((unsigned long)entry->key & ~1UL);
-}
-
-static bool jump_entry_branch(struct jump_entry *entry)
-{
- return (unsigned long)entry->key & 1UL;
-}
-
/***
* A 'struct static_key' uses a union such that it either points directly
* to a table of 'struct jump_entry' or to a linked list of modules which in
@@ -348,7 +341,7 @@ static enum jump_label_type jump_label_type(struct jump_entry *entry)
{
struct static_key *key = jump_entry_key(entry);
bool enabled = static_key_enabled(key);
- bool branch = jump_entry_branch(entry);
+ bool branch = jump_entry_is_branch(entry);
/* See the comment in linux/jump_label.h */
return enabled ^ branch;
@@ -364,7 +357,8 @@ static void __jump_label_update(struct static_key *key,
* kernel_text_address() verifies we are not in core kernel
* init code, see jump_label_invalidate_module_init().
*/
- if (entry->code && kernel_text_address(entry->code))
+ if (!jump_entry_is_module_init(entry) &&
+ kernel_text_address(jump_entry_code(entry)))
arch_jump_label_transform(entry, jump_label_type(entry));
}
}
@@ -417,7 +411,7 @@ static enum jump_label_type jump_label_init_type(struct jump_entry *entry)
{
struct static_key *key = jump_entry_key(entry);
bool type = static_key_type(key);
- bool branch = jump_entry_branch(entry);
+ bool branch = jump_entry_is_branch(entry);
/* See the comment in linux/jump_label.h */
return type ^ branch;
@@ -541,7 +535,7 @@ static int jump_label_add_module(struct module *mod)
continue;
key = iterk;
- if (within_module(iter->key, mod)) {
+ if (within_module((unsigned long)key, mod)) {
static_key_set_entries(key, iter);
continue;
}
@@ -591,7 +585,7 @@ static void jump_label_del_module(struct module *mod)
key = jump_entry_key(iter);
- if (within_module(iter->key, mod))
+ if (within_module((unsigned long)key, mod))
continue;
/* No memory during module load */
@@ -634,8 +628,8 @@ static void jump_label_invalidate_module_init(struct module *mod)
struct jump_entry *iter;
for (iter = iter_start; iter < iter_stop; iter++) {
- if (within_module_init(iter->code, mod))
- iter->code = 0;
+ if (within_module_init(jump_entry_code(iter), mod))
+ jump_entry_set_module_init(iter);
}
}
--
2.11.0
^ permalink raw reply related
* [PATCH v6 5/8] kernel: tracepoints: add support for relative references
From: Ard Biesheuvel @ 2017-12-27 8:50 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227085033.22389-1-ard.biesheuvel@linaro.org>
To avoid the need for relocating absolute references to tracepoint
structures at boot time when running relocatable kernels (which may
take a disproportionate amount of space), add the option to emit
these tables as relative references instead.
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
include/linux/tracepoint.h | 19 ++++++--
kernel/tracepoint.c | 50 +++++++++++---------
2 files changed, 42 insertions(+), 27 deletions(-)
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index a26ffbe09e71..d02bf1a695e8 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -228,6 +228,19 @@ extern void syscall_unregfunc(void);
return static_key_false(&__tracepoint_##name.key); \
}
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+#define __TRACEPOINT_ENTRY(name) \
+ asm(" .section \"__tracepoints_ptrs\", \"a\" \n" \
+ " .balign 4 \n" \
+ " .long " VMLINUX_SYMBOL_STR(__tracepoint_##name) " - .\n" \
+ " .previous \n")
+#else
+#define __TRACEPOINT_ENTRY(name) \
+ static struct tracepoint * const __tracepoint_ptr_##name __used \
+ __attribute__((section("__tracepoints_ptrs"))) = \
+ &__tracepoint_##name
+#endif
+
/*
* We have no guarantee that gcc and the linker won't up-align the tracepoint
* structures, so we create an array of pointers that will be used for iteration
@@ -237,11 +250,9 @@ extern void syscall_unregfunc(void);
static const char __tpstrtab_##name[] \
__attribute__((section("__tracepoints_strings"))) = #name; \
struct tracepoint __tracepoint_##name \
- __attribute__((section("__tracepoints"))) = \
+ __attribute__((section("__tracepoints"), used)) = \
{ __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\
- static struct tracepoint * const __tracepoint_ptr_##name __used \
- __attribute__((section("__tracepoints_ptrs"))) = \
- &__tracepoint_##name;
+ __TRACEPOINT_ENTRY(name);
#define DEFINE_TRACE(name) \
DEFINE_TRACE_FN(name, NULL, NULL);
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 685c50ae6300..05649fef106c 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -327,6 +327,28 @@ int tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data)
}
EXPORT_SYMBOL_GPL(tracepoint_probe_unregister);
+static void for_each_tracepoint_range(struct tracepoint * const *begin,
+ struct tracepoint * const *end,
+ void (*fct)(struct tracepoint *tp, void *priv),
+ void *priv)
+{
+ if (!begin)
+ return;
+
+ if (IS_ENABLED(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS)) {
+ const int *iter;
+
+ for (iter = (const int *)begin; iter < (const int *)end; iter++)
+ fct((struct tracepoint *)((unsigned long)iter + *iter),
+ priv);
+ } else {
+ struct tracepoint * const *iter;
+
+ for (iter = begin; iter < end; iter++)
+ fct(*iter, priv);
+ }
+}
+
#ifdef CONFIG_MODULES
bool trace_module_has_bad_taint(struct module *mod)
{
@@ -391,15 +413,9 @@ EXPORT_SYMBOL_GPL(unregister_tracepoint_module_notifier);
* Ensure the tracer unregistered the module's probes before the module
* teardown is performed. Prevents leaks of probe and data pointers.
*/
-static void tp_module_going_check_quiescent(struct tracepoint * const *begin,
- struct tracepoint * const *end)
+static void tp_module_going_check_quiescent(struct tracepoint *tp, void *priv)
{
- struct tracepoint * const *iter;
-
- if (!begin)
- return;
- for (iter = begin; iter < end; iter++)
- WARN_ON_ONCE((*iter)->funcs);
+ WARN_ON_ONCE(tp->funcs);
}
static int tracepoint_module_coming(struct module *mod)
@@ -450,8 +466,9 @@ static void tracepoint_module_going(struct module *mod)
* Called the going notifier before checking for
* quiescence.
*/
- tp_module_going_check_quiescent(mod->tracepoints_ptrs,
- mod->tracepoints_ptrs + mod->num_tracepoints);
+ for_each_tracepoint_range(mod->tracepoints_ptrs,
+ mod->tracepoints_ptrs + mod->num_tracepoints,
+ tp_module_going_check_quiescent, NULL);
break;
}
}
@@ -503,19 +520,6 @@ static __init int init_tracepoints(void)
__initcall(init_tracepoints);
#endif /* CONFIG_MODULES */
-static void for_each_tracepoint_range(struct tracepoint * const *begin,
- struct tracepoint * const *end,
- void (*fct)(struct tracepoint *tp, void *priv),
- void *priv)
-{
- struct tracepoint * const *iter;
-
- if (!begin)
- return;
- for (iter = begin; iter < end; iter++)
- fct(*iter, priv);
-}
-
/**
* for_each_kernel_tracepoint - iteration on all kernel tracepoints
* @fct: callback
--
2.11.0
^ permalink raw reply related
* [PATCH v6 4/8] PCI: Add support for relative addressing in quirk tables
From: Ard Biesheuvel @ 2017-12-27 8:50 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227085033.22389-1-ard.biesheuvel@linaro.org>
Allow the PCI quirk tables to be emitted in a way that avoids absolute
references to the hook functions. This reduces the size of the entries,
and, more importantly, makes them invariant under runtime relocation
(e.g., for KASLR)
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
drivers/pci/quirks.c | 13 ++++++++++---
include/linux/pci.h | 20 ++++++++++++++++++++
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 10684b17d0bd..b6d51b4d5ce1 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3556,9 +3556,16 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
f->vendor == (u16) PCI_ANY_ID) &&
(f->device == dev->device ||
f->device == (u16) PCI_ANY_ID)) {
- calltime = fixup_debug_start(dev, f->hook);
- f->hook(dev);
- fixup_debug_report(dev, calltime, f->hook);
+ void (*hook)(struct pci_dev *dev);
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ hook = (void *)((unsigned long)&f->hook_offset +
+ f->hook_offset);
+#else
+ hook = f->hook;
+#endif
+ calltime = fixup_debug_start(dev, hook);
+ hook(dev);
+ fixup_debug_report(dev, calltime, hook);
}
}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c170c9250c8b..e8c34afb5d4a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1792,7 +1792,11 @@ struct pci_fixup {
u16 device; /* You can use PCI_ANY_ID here of course */
u32 class; /* You can use PCI_ANY_ID here too */
unsigned int class_shift; /* should be 0, 8, 16 */
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ signed int hook_offset;
+#else
void (*hook)(struct pci_dev *dev);
+#endif
};
enum pci_fixup_pass {
@@ -1806,12 +1810,28 @@ enum pci_fixup_pass {
pci_fixup_suspend_late, /* pci_device_suspend_late() */
};
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+#define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
+ class_shift, hook) \
+ __ADDRESSABLE(hook) \
+ asm(".section " #sec ", \"a\" \n" \
+ ".balign 16 \n" \
+ ".short " #vendor ", " #device " \n" \
+ ".long " #class ", " #class_shift " \n" \
+ ".long " VMLINUX_SYMBOL_STR(hook) " - . \n" \
+ ".previous \n");
+#define DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
+ class_shift, hook) \
+ __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
+ class_shift, hook)
+#else
/* Anonymous variables would be nice... */
#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
class_shift, hook) \
static const struct pci_fixup __PASTE(__pci_fixup_##name,__LINE__) __used \
__attribute__((__section__(#section), aligned((sizeof(void *))))) \
= { vendor, device, class, class_shift, hook };
+#endif
#define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \
class_shift, hook) \
--
2.11.0
^ permalink raw reply related
* [PATCH v6 3/8] init: allow initcall tables to be emitted using relative references
From: Ard Biesheuvel @ 2017-12-27 8:50 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227085033.22389-1-ard.biesheuvel@linaro.org>
Allow the initcall tables to be emitted using relative references that
are only half the size on 64-bit architectures and don't require fixups
at runtime on relocatable kernels.
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: James Morris <james.l.morris@oracle.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
include/linux/init.h | 44 +++++++++++++++-----
init/main.c | 32 +++++++-------
kernel/printk/printk.c | 4 +-
security/security.c | 4 +-
4 files changed, 53 insertions(+), 31 deletions(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index ea1b31101d9e..125bbea99c6b 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -109,8 +109,24 @@
typedef int (*initcall_t)(void);
typedef void (*exitcall_t)(void);
-extern initcall_t __con_initcall_start[], __con_initcall_end[];
-extern initcall_t __security_initcall_start[], __security_initcall_end[];
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+typedef signed int initcall_entry_t;
+
+static inline initcall_t initcall_from_entry(initcall_entry_t *entry)
+{
+ return (initcall_t)((unsigned long)entry + *entry);
+}
+#else
+typedef initcall_t initcall_entry_t;
+
+static inline initcall_t initcall_from_entry(initcall_entry_t *entry)
+{
+ return *entry;
+}
+#endif
+
+extern initcall_entry_t __con_initcall_start[], __con_initcall_end[];
+extern initcall_entry_t __security_initcall_start[], __security_initcall_end[];
/* Used for contructor calls. */
typedef void (*ctor_fn_t)(void);
@@ -160,9 +176,20 @@ extern bool initcall_debug;
* as KEEP() in the linker script.
*/
-#define __define_initcall(fn, id) \
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+#define ___define_initcall(fn, id, __sec) \
+ __ADDRESSABLE(fn) \
+ asm(".section \"" #__sec ".init\", \"a\" \n" \
+ "__initcall_" #fn #id ": \n" \
+ ".long " VMLINUX_SYMBOL_STR(fn) " - . \n" \
+ ".previous \n");
+#else
+#define ___define_initcall(fn, id, __sec) \
static initcall_t __initcall_##fn##id __used \
- __attribute__((__section__(".initcall" #id ".init"))) = fn;
+ __attribute__((__section__(#__sec ".init"))) = fn;
+#endif
+
+#define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
/*
* Early initcalls run before initializing SMP.
@@ -201,13 +228,8 @@ extern bool initcall_debug;
#define __exitcall(fn) \
static exitcall_t __exitcall_##fn __exit_call = fn
-#define console_initcall(fn) \
- static initcall_t __initcall_##fn \
- __used __section(.con_initcall.init) = fn
-
-#define security_initcall(fn) \
- static initcall_t __initcall_##fn \
- __used __section(.security_initcall.init) = fn
+#define console_initcall(fn) ___define_initcall(fn,, .con_initcall)
+#define security_initcall(fn) ___define_initcall(fn,, .security_initcall)
struct obs_kernel_param {
const char *str;
diff --git a/init/main.c b/init/main.c
index 7b606fc48482..2cbe3c2804ab 100644
--- a/init/main.c
+++ b/init/main.c
@@ -845,18 +845,18 @@ int __init_or_module do_one_initcall(initcall_t fn)
}
-extern initcall_t __initcall_start[];
-extern initcall_t __initcall0_start[];
-extern initcall_t __initcall1_start[];
-extern initcall_t __initcall2_start[];
-extern initcall_t __initcall3_start[];
-extern initcall_t __initcall4_start[];
-extern initcall_t __initcall5_start[];
-extern initcall_t __initcall6_start[];
-extern initcall_t __initcall7_start[];
-extern initcall_t __initcall_end[];
-
-static initcall_t *initcall_levels[] __initdata = {
+extern initcall_entry_t __initcall_start[];
+extern initcall_entry_t __initcall0_start[];
+extern initcall_entry_t __initcall1_start[];
+extern initcall_entry_t __initcall2_start[];
+extern initcall_entry_t __initcall3_start[];
+extern initcall_entry_t __initcall4_start[];
+extern initcall_entry_t __initcall5_start[];
+extern initcall_entry_t __initcall6_start[];
+extern initcall_entry_t __initcall7_start[];
+extern initcall_entry_t __initcall_end[];
+
+static initcall_entry_t *initcall_levels[] __initdata = {
__initcall0_start,
__initcall1_start,
__initcall2_start,
@@ -882,7 +882,7 @@ static char *initcall_level_names[] __initdata = {
static void __init do_initcall_level(int level)
{
- initcall_t *fn;
+ initcall_entry_t *fn;
strcpy(initcall_command_line, saved_command_line);
parse_args(initcall_level_names[level],
@@ -892,7 +892,7 @@ static void __init do_initcall_level(int level)
NULL, &repair_env_string);
for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++)
- do_one_initcall(*fn);
+ do_one_initcall(initcall_from_entry(fn));
}
static void __init do_initcalls(void)
@@ -923,10 +923,10 @@ static void __init do_basic_setup(void)
static void __init do_pre_smp_initcalls(void)
{
- initcall_t *fn;
+ initcall_entry_t *fn;
for (fn = __initcall_start; fn < __initcall0_start; fn++)
- do_one_initcall(*fn);
+ do_one_initcall(initcall_from_entry(fn));
}
/*
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index b9006617710f..0516005261c7 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2611,7 +2611,7 @@ EXPORT_SYMBOL(unregister_console);
*/
void __init console_init(void)
{
- initcall_t *call;
+ initcall_entry_t *call;
/* Setup the default TTY line discipline. */
n_tty_init();
@@ -2622,7 +2622,7 @@ void __init console_init(void)
*/
call = __con_initcall_start;
while (call < __con_initcall_end) {
- (*call)();
+ initcall_from_entry(call)();
call++;
}
}
diff --git a/security/security.c b/security/security.c
index 1cd8526cb0b7..f648eeff06de 100644
--- a/security/security.c
+++ b/security/security.c
@@ -45,10 +45,10 @@ static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] =
static void __init do_security_initcalls(void)
{
- initcall_t *call;
+ initcall_entry_t *call;
call = __security_initcall_start;
while (call < __security_initcall_end) {
- (*call) ();
+ initcall_from_entry(call)();
call++;
}
}
--
2.11.0
^ permalink raw reply related
* [PATCH v6 2/8] module: use relative references for __ksymtab entries
From: Ard Biesheuvel @ 2017-12-27 8:50 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227085033.22389-1-ard.biesheuvel@linaro.org>
An ordinary arm64 defconfig build has ~64 KB worth of __ksymtab
entries, each consisting of two 64-bit fields containing absolute
references, to the symbol itself and to a char array containing
its name, respectively.
When we build the same configuration with KASLR enabled, we end
up with an additional ~192 KB of relocations in the .init section,
i.e., one 24 byte entry for each absolute reference, which all need
to be processed at boot time.
Given how the struct kernel_symbol that describes each entry is
completely local to module.c (except for the references emitted
by EXPORT_SYMBOL() itself), we can easily modify it to contain
two 32-bit relative references instead. This reduces the size of
the __ksymtab section by 50% for all 64-bit architectures, and
gets rid of the runtime relocations entirely for architectures
implementing KASLR, either via standard PIE linking (arm64) or
using custom host tools (x86).
Note that the binary search involving __ksymtab contents relies
on each section being sorted by symbol name. This is implemented
based on the input section names, not the names in the ksymtab
entries, so this patch does not interfere with that.
Given that the use of place-relative relocations requires support
both in the toolchain and in the module loader, we cannot enable
this feature for all architectures. So make it dependent on whether
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS is defined.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Nicolas Pitre <nico@linaro.org>
Acked-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/x86/include/asm/Kbuild | 1 +
arch/x86/include/asm/export.h | 5 ---
include/asm-generic/export.h | 12 ++++-
include/linux/compiler.h | 11 +++++
include/linux/export.h | 46 +++++++++++++++-----
kernel/module.c | 33 +++++++++++---
6 files changed, 84 insertions(+), 24 deletions(-)
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 5d6a53fd7521..3e8a88dcaa1d 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -9,5 +9,6 @@ generated-y += xen-hypercalls.h
generic-y += clkdev.h
generic-y += dma-contiguous.h
generic-y += early_ioremap.h
+generic-y += export.h
generic-y += mcs_spinlock.h
generic-y += mm-arch-hooks.h
diff --git a/arch/x86/include/asm/export.h b/arch/x86/include/asm/export.h
deleted file mode 100644
index 2a51d66689c5..000000000000
--- a/arch/x86/include/asm/export.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifdef CONFIG_64BIT
-#define KSYM_ALIGN 16
-#endif
-#include <asm-generic/export.h>
diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h
index 719db1968d81..97ce606459ae 100644
--- a/include/asm-generic/export.h
+++ b/include/asm-generic/export.h
@@ -5,12 +5,10 @@
#define KSYM_FUNC(x) x
#endif
#ifdef CONFIG_64BIT
-#define __put .quad
#ifndef KSYM_ALIGN
#define KSYM_ALIGN 8
#endif
#else
-#define __put .long
#ifndef KSYM_ALIGN
#define KSYM_ALIGN 4
#endif
@@ -25,6 +23,16 @@
#define KSYM(name) name
#endif
+.macro __put, val, name
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ .long \val - ., \name - .
+#elif defined(CONFIG_64BIT)
+ .quad \val, \name
+#else
+ .long \val, \name
+#endif
+.endm
+
/*
* note on .section use: @progbits vs %progbits nastiness doesn't matter,
* since we immediately emit into those sections anyway.
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 52e611ab9a6c..fe752d365334 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -327,4 +327,15 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
compiletime_assert(__native_word(t), \
"Need native word sized stores/loads for atomicity.")
+/*
+ * Force the compiler to emit 'sym' as a symbol, so that we can reference
+ * it from inline assembler. Necessary in case 'sym' could be inlined
+ * otherwise, or eliminated entirely due to lack of references that are
+ * visibile to the compiler.
+ */
+#define __ADDRESSABLE(sym) \
+ static void *__attribute__((section(".discard.text"), used)) \
+ __PASTE(__discard_##sym, __LINE__)(void) \
+ { return (void *)&sym; } \
+
#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/export.h b/include/linux/export.h
index 1a1dfdb2a5c6..5112d0c41512 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -24,12 +24,6 @@
#define VMLINUX_SYMBOL_STR(x) __VMLINUX_SYMBOL_STR(x)
#ifndef __ASSEMBLY__
-struct kernel_symbol
-{
- unsigned long value;
- const char *name;
-};
-
#ifdef MODULE
extern struct module __this_module;
#define THIS_MODULE (&__this_module)
@@ -60,17 +54,47 @@ extern struct module __this_module;
#define __CRC_SYMBOL(sym, sec)
#endif
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+#include <linux/compiler.h>
+/*
+ * Emit the ksymtab entry as a pair of relative references: this reduces
+ * the size by half on 64-bit architectures, and eliminates the need for
+ * absolute relocations that require runtime processing on relocatable
+ * kernels.
+ */
+#define __KSYMTAB_ENTRY(sym, sec) \
+ __ADDRESSABLE(sym) \
+ asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \
+ " .balign 8 \n" \
+ VMLINUX_SYMBOL_STR(__ksymtab_##sym) ": \n" \
+ " .long " VMLINUX_SYMBOL_STR(sym) "- . \n" \
+ " .long " VMLINUX_SYMBOL_STR(__kstrtab_##sym) "- .\n" \
+ " .previous \n")
+
+struct kernel_symbol {
+ signed int value_offset;
+ signed int name_offset;
+};
+#else
+#define __KSYMTAB_ENTRY(sym, sec) \
+ static const struct kernel_symbol __ksymtab_##sym \
+ __attribute__((section("___ksymtab" sec "+" #sym), used)) \
+ = { (unsigned long)&sym, __kstrtab_##sym }
+
+struct kernel_symbol {
+ unsigned long value;
+ const char *name;
+};
+#endif
+
/* For every exported symbol, place a struct in the __ksymtab section */
#define ___EXPORT_SYMBOL(sym, sec) \
extern typeof(sym) sym; \
__CRC_SYMBOL(sym, sec) \
static const char __kstrtab_##sym[] \
- __attribute__((section("__ksymtab_strings"), aligned(1))) \
+ __attribute__((section("__ksymtab_strings"), used, aligned(1))) \
= VMLINUX_SYMBOL_STR(sym); \
- static const struct kernel_symbol __ksymtab_##sym \
- __used \
- __attribute__((section("___ksymtab" sec "+" #sym), used)) \
- = { (unsigned long)&sym, __kstrtab_##sym }
+ __KSYMTAB_ENTRY(sym, sec)
#if defined(__KSYM_DEPS__)
diff --git a/kernel/module.c b/kernel/module.c
index dea01ac9cb74..d3a908ffc42c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -549,12 +549,31 @@ static bool check_symbol(const struct symsearch *syms,
return true;
}
+static unsigned long kernel_symbol_value(const struct kernel_symbol *sym)
+{
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ return (unsigned long)&sym->value_offset + sym->value_offset;
+#else
+ return sym->value;
+#endif
+}
+
+static const char *kernel_symbol_name(const struct kernel_symbol *sym)
+{
+#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
+ return (const char *)((unsigned long)&sym->name_offset +
+ sym->name_offset);
+#else
+ return sym->name;
+#endif
+}
+
static int cmp_name(const void *va, const void *vb)
{
const char *a;
const struct kernel_symbol *b;
a = va; b = vb;
- return strcmp(a, b->name);
+ return strcmp(a, kernel_symbol_name(b));
}
static bool find_symbol_in_section(const struct symsearch *syms,
@@ -2198,7 +2217,7 @@ void *__symbol_get(const char *symbol)
sym = NULL;
preempt_enable();
- return sym ? (void *)sym->value : NULL;
+ return sym ? (void *)kernel_symbol_value(sym) : NULL;
}
EXPORT_SYMBOL_GPL(__symbol_get);
@@ -2228,10 +2247,12 @@ static int verify_export_symbols(struct module *mod)
for (i = 0; i < ARRAY_SIZE(arr); i++) {
for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {
- if (find_symbol(s->name, &owner, NULL, true, false)) {
+ if (find_symbol(kernel_symbol_name(s), &owner, NULL,
+ true, false)) {
pr_err("%s: exports duplicate symbol %s"
" (owned by %s)\n",
- mod->name, s->name, module_name(owner));
+ mod->name, kernel_symbol_name(s),
+ module_name(owner));
return -ENOEXEC;
}
}
@@ -2280,7 +2301,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
ksym = resolve_symbol_wait(mod, info, name);
/* Ok if resolved. */
if (ksym && !IS_ERR(ksym)) {
- sym[i].st_value = ksym->value;
+ sym[i].st_value = kernel_symbol_value(ksym);
break;
}
@@ -2540,7 +2561,7 @@ static int is_exported(const char *name, unsigned long value,
ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab);
else
ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms);
- return ks != NULL && ks->value == value;
+ return ks != NULL && kernel_symbol_value(ks) == value;
}
/* As per nm */
--
2.11.0
^ permalink raw reply related
* [PATCH v6 1/8] arch: enable relative relocations for arm64, power, x86, s390 and x86
From: Ard Biesheuvel @ 2017-12-27 8:50 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227085033.22389-1-ard.biesheuvel@linaro.org>
Before updating certain subsystems to use place relative 32-bit
relocations in special sections, to save space and reduce the
number of absolute relocations that need to be processed at runtime
by relocatable kernels, introduce the Kconfig symbol and define it
for some architectures that should be able to support and benefit
from it.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86 at kernel.org
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/Kconfig | 10 ++++++++++
arch/arm64/Kconfig | 1 +
arch/arm64/kernel/vmlinux.lds.S | 2 +-
arch/powerpc/Kconfig | 1 +
arch/s390/Kconfig | 1 +
arch/x86/Kconfig | 1 +
6 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 400b9e1b2f27..dbc036a7bd1b 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -959,4 +959,14 @@ config REFCOUNT_FULL
against various use-after-free conditions that can be used in
security flaw exploits.
+config HAVE_ARCH_PREL32_RELOCATIONS
+ bool
+ help
+ May be selected by an architecture if it supports place-relative
+ 32-bit relocations, both in the toolchain and in the module loader,
+ in which case relative references can be used in special sections
+ for PCI fixup, initcalls etc which are only half the size on 64 bit
+ architectures, and don't require runtime relocation on relocatable
+ kernels.
+
source "kernel/gcov/Kconfig"
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c9a7e9e1414f..66c7b9ab2a3d 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -89,6 +89,7 @@ config ARM64
select HAVE_ARCH_KGDB
select HAVE_ARCH_MMAP_RND_BITS
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
+ select HAVE_ARCH_PREL32_RELOCATIONS
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 7da3e5c366a0..49ae5b43fe2b 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -156,7 +156,7 @@ SECTIONS
CON_INITCALL
SECURITY_INITCALL
INIT_RAM_FS
- *(.init.rodata.* .init.bss) /* from the EFI stub */
+ *(.init.rodata.* .init.bss .init.discard.*) /* EFI stub */
}
.exit.data : {
ARM_EXIT_KEEP(EXIT_DATA)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c51e6ce42e7a..e172478e2ae7 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -177,6 +177,7 @@ config PPC
select HAVE_ARCH_KGDB
select HAVE_ARCH_MMAP_RND_BITS
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
+ select HAVE_ARCH_PREL32_RELOCATIONS
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !RELOCATABLE && !HIBERNATION)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 829c67986db7..ed29d1ebecd9 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -129,6 +129,7 @@ config S390
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_JUMP_LABEL
select CPU_NO_EFFICIENT_FFS if !HAVE_MARCH_Z9_109_FEATURES
+ select HAVE_ARCH_PREL32_RELOCATIONS
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_SOFT_DIRTY
select HAVE_ARCH_TRACEHOOK
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d4fc98c50378..9f2bb853aedb 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -115,6 +115,7 @@ config X86
select HAVE_ARCH_MMAP_RND_BITS if MMU
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if MMU && COMPAT
select HAVE_ARCH_COMPAT_MMAP_BASES if MMU && COMPAT
+ select HAVE_ARCH_PREL32_RELOCATIONS
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
--
2.11.0
^ permalink raw reply related
* [PATCH v6 0/8] add support for relative references in special sections
From: Ard Biesheuvel @ 2017-12-27 8:50 UTC (permalink / raw)
To: linux-arm-kernel
This adds support for emitting special sections such as initcall arrays,
PCI fixups and tracepoints as relative references rather than absolute
references. This reduces the size by 50% on 64-bit architectures, but
more importantly, it removes the need for carrying relocation metadata
for these sections in relocatables kernels (e.g., for KASLR) that need
to fix up these absolute references at boot time. On arm64, this reduces
the vmlinux footprint of such a reference by 8x (8 byte absolute reference
+ 24 byte RELA entry vs 4 byte relative reference)
Patch #2 was sent out before as a single patch. This series supersedes
the previous submission. This version makes relative ksymtab entries
dependent on the new Kconfig symbol HAVE_ARCH_PREL32_RELOCATIONS rather
than trying to infer from kbuild test robot replies for which architectures
it should be blacklisted.
Patch #1 introduces the new Kconfig symbol HAVE_ARCH_PREL32_RELOCATIONS,
and sets it for the main architectures that are expected to benefit the
most from this feature, i.e., 64-bit architectures or ones that use
runtime relocations.
Patches #3 - #5 implement relative references for initcalls, PCI fixups
and tracepoints, respectively, all of which produce sections with order
~1000 entries on an arm64 defconfig kernel with tracing enabled. This
means we save about 28 KB of vmlinux space for each of these patches.
Patches #6 - #8 have been added in v5, and implement relative references
in jump tables for arm64 and x86. On arm64, this results in significant
space savings (650+ KB on a typical distro kernel). On x86, the savings
are not as impressive, but still worthwhile. (Note that these patches
do not rely on CONFIG_HAVE_ARCH_PREL32_RELOCATIONS, given that the
inline asm that is emitted is already per-arch)
For the arm64 kernel, all patches combined reduce the memory footprint of
vmlinux by about 1.3 MB (using a config copied from Ubuntu that has KASLR
enabled), of which ~1 MB is the size reduction of the RELA section in .init,
and the remaining 300 KB is reduction of .text/.data.
Branch:
git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git relative-special-sections-v6
Changes since v5:
- add missing jump_label prototypes to s390 jump_label.h (#6)
- fix inverted condition in call to jump_entry_is_module_init() (#6)
Changes since v4:
- add patches to convert x86 and arm64 to use relative references for jump
tables (#6 - #8)
- rename PCI patch and add Bjorn's ack (#4)
- rebase onto v4.15-rc5
Changes since v3:
- fix module unload issue in patch #5 reported by Jessica, by reusing the
updated routine for_each_tracepoint_range() for the quiescent check at
module unload time; this requires this routine to be moved before
tracepoint_module_going() in kernel/tracepoint.c
- add Jessica's ack to #2
- rebase onto v4.14-rc1
Changes since v2:
- Revert my slightly misguided attempt to appease checkpatch, which resulted
in needless churn and worse code. This v3 is based on v1 with a few tweaks
that were actually reasonable checkpatch warnings: unnecessary braces (as
pointed out by Ingo) and other minor whitespace misdemeanors.
Changes since v1:
- Remove checkpatch errors to the extent feasible: in some cases, this
involves moving extern declarations into C files, and switching to
struct definitions rather than typedefs. Some errors are impossible
to fix: please find the remaining ones after the diffstat.
- Used 'int' instead if 'signed int' for the various offset fields: there
is no ambiguity between architectures regarding its signedness (unlike
'char')
- Refactor the different patches to be more uniform in the way they define
the section entry type and accessors in the .h file, and avoid the need to
add #ifdefs to the C code.
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jessica Yu <jeyu@kernel.org>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-mips at linux-mips.org
Cc: linuxppc-dev at lists.ozlabs.org
Cc: linux-s390 at vger.kernel.org
Cc: sparclinux at vger.kernel.org
Cc: x86 at kernel.org
Ard Biesheuvel (8):
arch: enable relative relocations for arm64, power, x86, s390 and x86
module: use relative references for __ksymtab entries
init: allow initcall tables to be emitted using relative references
PCI: Add support for relative addressing in quirk tables
kernel: tracepoints: add support for relative references
kernel/jump_label: abstract jump_entry member accessors
arm64/kernel: jump_label: use relative references
x86/kernel: jump_table: use relative references
arch/Kconfig | 10 ++++
arch/arm/include/asm/jump_label.h | 27 +++++++++
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/jump_label.h | 48 +++++++++++++---
arch/arm64/kernel/jump_label.c | 22 +++++++-
arch/arm64/kernel/vmlinux.lds.S | 2 +-
arch/mips/include/asm/jump_label.h | 27 +++++++++
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/jump_label.h | 27 +++++++++
arch/s390/Kconfig | 1 +
arch/s390/include/asm/jump_label.h | 20 +++++++
arch/sparc/include/asm/jump_label.h | 27 +++++++++
arch/tile/include/asm/jump_label.h | 27 +++++++++
arch/x86/Kconfig | 1 +
arch/x86/include/asm/Kbuild | 1 +
arch/x86/include/asm/export.h | 5 --
arch/x86/include/asm/jump_label.h | 56 +++++++++++++++----
arch/x86/kernel/jump_label.c | 59 ++++++++++++++------
drivers/pci/quirks.c | 13 ++++-
include/asm-generic/export.h | 12 +++-
include/linux/compiler.h | 11 ++++
include/linux/export.h | 46 +++++++++++----
include/linux/init.h | 44 +++++++++++----
include/linux/pci.h | 20 +++++++
include/linux/tracepoint.h | 19 +++++--
init/main.c | 32 +++++------
kernel/jump_label.c | 38 ++++++-------
kernel/module.c | 33 +++++++++--
kernel/printk/printk.c | 4 +-
kernel/tracepoint.c | 50 +++++++++--------
security/security.c | 4 +-
tools/objtool/special.c | 4 +-
32 files changed, 544 insertions(+), 148 deletions(-)
delete mode 100644 arch/x86/include/asm/export.h
--
2.11.0
^ permalink raw reply
* [GIT PULL] tee dynamic shm for v4.16
From: Jens Wiklander @ 2017-12-27 8:36 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <6acdbda2-d1b1-127c-a6e4-df30dc5e200b@codeaurora.org>
On Mon, Dec 25, 2017 at 01:22:18PM -0800, thomas zeng wrote:
>
>
> On 2017?12?21? 08:30, Arnd Bergmann wrote:
> > On Fri, Dec 15, 2017 at 2:21 PM, Jens Wiklander
> > <jens.wiklander@linaro.org> wrote:
> > > Hello arm-soc maintainers,
> > >
> > > Please pull these tee driver changes. This implements support for dynamic
> > > shared memory support in OP-TEE. More specifically is enables mapping of
> > > user space memory in secure world to be used as shared memory.
> > >
> > > This has been reviewed and refined by the OP-TEE community at various
> > > places on Github during the last year. An earlier version of this pull
> > > request is used in the latest OP-TEE release (2.6.0). This has also been
> > > reviewed recently at the kernel mailing lists, with all comments from
> > > Mark Rutland <mark.rutland@arm.com> and Yury Norov
> > > <ynorov@caviumnetworks.com> addressed as far as I can tell.
> > >
> > > This isn't a bugfix so I'm aiming for the next merge window.
> > Given that Mark and Yury reviewed this, I'm assuming this is all
> > good and have now merged it. However I missed the entire discussion
> > about it, so I have one question about the implementation:
> >
> > What happens when user space passes a buffer that is not
> > backed by regular memory but instead is something it has itself
> > mapped from a device with special page attributes or physical
> > properties? Could this be inconsistent when optee and user
> > space disagree on the caching attributes? Can you get into
> > trouble if you pass an area from a device that is read-only
> > in user space but writable from secure world?
Read-only memory is dealt with by calling get_user_pages_fast() with
the 'write' parameter set to 1.
Mismatch in cache attributes isn't addressed though. This is something
that should be checked in the OP-TEE driver, typically
drivers/tee/optee/core.c.
I would like to add another patch on top of this patch series to guard
against cache attributes which aren't normal cached memory. So far I
haven't been able to find a nice way of doing that, I'd appreciate any
advice of idea of how to deal with this.
>
> Just recently, we have started to kick the tires of these "shm" related Gen
> Tee Driver patches.? And we have in the past encountered real world
> scenarios requiring some of the shared memory regions to be marked as
> "normal IC=0 and OC=0" in EL2 or SEL1, or else HW would misbehave. We worked
> around by hacking the boot code but that works if the regions are
> pre-allocated. Since now these regions can also be managed dynamically, we
> definitely agree with Arnd Bergmann that the dynamic registration SMC
> commands, and potention the SHM IOCTL commands, must convey cache
> intentions. Is it possible to take this requirement into consideration, in
> this iteration or the follow on?
I'd be happy to discuss using different cache attributes outside this
patch series. We have so far avoided specifying cache attributes by
calling it normal cached memory. Now that we have one use case we're
able take the next step here.
Thanks,
Jens
^ permalink raw reply
* [PATCH v2] arm64: dts: Hi3660: Fix up psci state id
From: Vincent Guittot @ 2017-12-27 8:29 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171225022202.GB600@leoy-linaro>
Hi Leo
On 25 December 2017 at 03:22, Leo Yan <leo.yan@linaro.org> wrote:
> Hi Vincent,
>
> [ + John, Kevin Wang ]
>
> On Fri, Dec 22, 2017 at 03:22:51PM +0100, Vincent Guittot wrote:
>> Hi Leo,
>>
>> Sorry for jumping late in the discussion but should we also remove
>> the NAP state from the property cpu-idle-states of the CPUs because
>> this state not supported by the platform at least for now and may be
>> not in a near future ?
>
> Thanks for bringing up this.
>
> I don't want to hide anything for patch discussion :) this patch is to
> resolve the PSCI parameter mismatching issue between kernel and ARM-TF
> and it's not used to resolve the bug for CPU_NAP, so I didn't mention
> the CPU_NAP malfunction issue to avoid complex discussion context.
>
> I want to keep CPU_NAP state and track bug for CPU_NAP fixing; if we
> remove this state, I suspect we might have no chance to enable it
> anymore. Finally this is up to Hisilicon colleague decision and if they
> have time to fix this.
>
> I will offline to check with Daniel and Kevin for this; and if we
> finally decide to remove it we can commit extra patch for this later,
> how about you think?
I would prefer to remove it right now.
Removing NAP from c-state table makes the hikey960 working correctly;
I mean even with current ATF and current state id. So it's the best
solution to the NAP problem IMO and I don't see the benefit of keeping
NAP in the table until this state has been fixed. This will just add
uncertainties in the behavior of the board.
I don't see why you can't re-add it once it has been fixed.
>
>> Then, I have another question regarding the update of the
>> psci-suspend-parameter. These changes implies an update of the psci
>> firmawre which means that we will now have 2 different firmware
>> version compatible with 2 different dt.
>>
>> Is there any way to check that the ATF on the board is the one that
>> compatible with the parameter with something like a version ? I
>> currently use the previous firmware which works fine with current
>> kernel and dt binding once the NAP state is removed from the table.
>> When moving on recent kernel, I will have to take care of updating the
>> firmware and if i need to go back on a previous kernel, i will have to
>> make sure that i have the right ATF version. This make a lot of chance
>> of having the wrong configuration
>
> AFAIK, we cannot distinguish the PSCI parameter by PSCI version or
And that's my main concern because this adds a new possible regression
factor when switching between different kernel version
> ARM-TF version number; alternatively one simple way for checking ARM-TF
> is we can get commit ID (e.g. 83df7ce) from the ARM-TF log; so any
> ARM-TF commit ID is newer than the patch fdae60b6ba27: "Hikey960:
> Change to use recommended power state id format" should apply this
> kernel patch.
>
> NOTICE: BL1: Booting BL31
> NOTICE: BL31: v1.4(debug):v1.4-441-g83df7ce-dirty
> NOTICE: BL31: Built : 17:31:35, Dec 22 2017
>
> BTW, I hope we can upgrade Linux kernel and ARM-TF to latest code base
> to avoid compatible issue; for Android offical releasing it uses the
> old PSCI parameters with Hisilicon legacy booting images, so they can
> work well, but if someone uses ARM-TF mainline code + Android kernel
> 4.4/4.9, there must have compatible issue.
>
> I am monitoring the integration ARM-TF/UEFI into Android on Hikey960,
> we need backport this patch onto Android kernel 4.4/4.9 ASAP after
> integration ARM-TF/UEFI.
>
> Thanks,
> Leo Yan
>
>> Regards,
>> Vincent
>>
>> On 12 December 2017 at 10:12, Leo Yan <leo.yan@linaro.org> wrote:
>> > Thanks a lot for Vincent Guittot careful work to find bug for 'CPU_NAP'
>> > idle state. From ftrace log we can observe CA73 CPUs can be easily
>> > waken up from 'CPU_NAP' state but the 'waken up' CPUs doesn't handle
>> > anything and sleep again; so there have tons of trace events for CA73
>> > CPUs entering and exiting idle state.
>> >
>> > On Hi3660 CA73 has retention state 'CPU_NAP' for CPU idle, this state we
>> > set its psci parameter as '0x0000001' and from this parameter it can
>> > calculate state id is 1. Unfortunately ARM trusted firmware (ARM-TF)
>> > takes 1 as a invalid value for state id, so the CPU cannot enter idle
>> > state and directly bail out to kernel.
>> >
>> > We want to create good practice for psci parameters platform definition,
>> > so review the psci specification. The spec "ARM Power State Coordination
>> > Interface - Platform Design Document (ARM DEN 0022D)" recommends state
>> > ID in chapter "6.5 Recommended StateID Encoding". The recommended power
>> > state IDs can be presented by below listed values; and it divides into
>> > three fields, every field can use 4 bits to present power states
>> > corresponding to core level, cluster level and system level:
>> > 0: Run
>> > 1: Standby
>> > 2: Retention
>> > 3: Powerdown
>> >
>> > This commit changes psci parameter to compliance with the suggested
>> > state ID in the doc. Except we change 'CPU_NAP' state psci parameter
>> > to '0x0000002', this commit also changes 'CPU_SLEEP' and 'CLUSTER_SLEEP'
>> > state parameters to '0x0010003' and '0x1010033' respectively.
>> >
>> > Credits to Daniel, Sudeep and Soby for suggestion and consolidation.
>> >
>> > Cc: Vincent Guittot <vincent.guittot@linaro.org>
>> > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>> > Cc: Sudeep Holla <sudeep.holla@arm.com>
>> > Cc: Soby Mathew <Soby.Mathew@arm.com>
>> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
>> > ---
>> > arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 8 ++++----
>> > 1 file changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
>> > index ab0b95b..99d5a46 100644
>> > --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
>> > +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
>> > @@ -147,7 +147,7 @@
>> >
>> > CPU_NAP: cpu-nap {
>> > compatible = "arm,idle-state";
>> > - arm,psci-suspend-param = <0x0000001>;
>> > + arm,psci-suspend-param = <0x0000002>;
>> > entry-latency-us = <7>;
>> > exit-latency-us = <2>;
>> > min-residency-us = <15>;
>> > @@ -156,7 +156,7 @@
>> > CPU_SLEEP: cpu-sleep {
>> > compatible = "arm,idle-state";
>> > local-timer-stop;
>> > - arm,psci-suspend-param = <0x0010000>;
>> > + arm,psci-suspend-param = <0x0010003>;
>> > entry-latency-us = <40>;
>> > exit-latency-us = <70>;
>> > min-residency-us = <3000>;
>> > @@ -165,7 +165,7 @@
>> > CLUSTER_SLEEP_0: cluster-sleep-0 {
>> > compatible = "arm,idle-state";
>> > local-timer-stop;
>> > - arm,psci-suspend-param = <0x1010000>;
>> > + arm,psci-suspend-param = <0x1010033>;
>> > entry-latency-us = <500>;
>> > exit-latency-us = <5000>;
>> > min-residency-us = <20000>;
>> > @@ -174,7 +174,7 @@
>> > CLUSTER_SLEEP_1: cluster-sleep-1 {
>> > compatible = "arm,idle-state";
>> > local-timer-stop;
>> > - arm,psci-suspend-param = <0x1010000>;
>> > + arm,psci-suspend-param = <0x1010033>;
>> > entry-latency-us = <1000>;
>> > exit-latency-us = <5000>;
>> > min-residency-us = <20000>;
>> > --
>> > 2.7.4
>> >
^ permalink raw reply
* [PATCH 10/11 v3] ARM: s3c24xx/s3c64xx: constify gpio_led
From: Krzysztof Kozlowski @ 2017-12-27 8:19 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <adb77ba31b66d391a49a12434dfe7811e8a8ba0f.1514267721.git.arvind.yadav.cs@gmail.com>
On Tue, Dec 26, 2017 at 7:50 PM, Arvind Yadav <arvind.yadav.cs@gmail.com> wrote:
> gpio_led are not supposed to change at runtime.
> struct gpio_led_platform_data working with const gpio_led
> provided by <linux/leds.h>. So mark the non-const structs
> as const.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> changes in v2:
> The GPIO LED driver can be built as a module, it can
> be loaded after the init sections have gone away.
> So removed '__initconst'.
> changes in v3:
> Description was missing.
>
> arch/arm/mach-s3c24xx/mach-h1940.c | 2 +-
> arch/arm/mach-s3c24xx/mach-rx1950.c | 2 +-
> arch/arm/mach-s3c64xx/mach-hmt.c | 2 +-
> arch/arm/mach-s3c64xx/mach-smartq5.c | 2 +-
> arch/arm/mach-s3c64xx/mach-smartq7.c | 2 +-
> arch/arm/mach-s3c64xx/mach-smdk6410.c | 2 +-
> 6 files changed, 6 insertions(+), 6 deletions(-)
There were few build errors reported by kbuild for your patches. Are
you sure that you compiled every file you touch?
Best regards,
Krzysztof
^ permalink raw reply
* [PATCH V2] ARM: imx: suspend/resume: use outer_disable/resume
From: Peng Fan @ 2017-12-27 5:52 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227025055.GD11724@b29396-OptiPlex-7040>
> -----Original Message-----
> From: Dong Aisheng [mailto:dongas86 at gmail.com]
> Sent: Wednesday, December 27, 2017 10:51 AM
> To: A.s. Dong <aisheng.dong@nxp.com>
> Cc: Shawn Guo <shawnguo@kernel.org>; Peng Fan <peng.fan@nxp.com>;
> linux-kernel at vger.kernel.org; Russell King <linux@armlinux.org.uk>; Fabio
> Estevam <fabio.estevam@nxp.com>; Sascha Hauer <kernel@pengutronix.de>;
> van.freenix at gmail.com; linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH V2] ARM: imx: suspend/resume: use
> outer_disable/resume
>
> On Wed, Dec 27, 2017 at 02:33:57AM +0000, A.s. Dong wrote:
> > > -----Original Message-----
> > > From: Shawn Guo [mailto:shawnguo at kernel.org]
> > > Sent: Wednesday, December 27, 2017 10:32 AM
> > > To: Peng Fan <peng.fan@nxp.com>
> > > Cc: A.s. Dong <aisheng.dong@nxp.com>; linux-kernel at vger.kernel.org;
> > > Russell King <linux@armlinux.org.uk>; Fabio Estevam
> > > <fabio.estevam@nxp.com>; Sascha Hauer <kernel@pengutronix.de>;
> > > van.freenix at gmail.com; linux-arm- kernel at lists.infradead.org
> > > Subject: Re: [PATCH V2] ARM: imx: suspend/resume: use
> > > outer_disable/resume
> > >
> > > On Wed, Dec 27, 2017 at 09:57:47AM +0800, Peng Fan wrote:
> > > > Use outer_disable/resume for suspend/resume.
> > > > With the two APIs used, code could be simplified and easy to
> > > > extend to introduce l2c_write_sec for i.MX platforms when moving
> > > > Linux Kernel runs in non-secure world.
> > > >
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > Cc: Shawn Guo <shawnguo@kernel.org>
> > > > Cc: Sascha Hauer <kernel@pengutronix.de>
> > > > Cc: Fabio Estevam <fabio.estevam@nxp.com>
> > > > Cc: Russell King <linux@armlinux.org.uk>
> > > > Cc: Dong Aisheng <aisheng.dong@nxp.com>
> > >
> > > @Aisheng, can you please give it a test?
> > >
> >
> > Yes, of course.
> >
>
> Not sure but i can still meet booting crash on mx6sx sdb.
> Peng, you did not meet it, right?
I could reproduce this issue using for-next imx_v6_v7_defconfig.
it is a bit strange that if "bl l2c310_early_resume "
is kept, it performs well. Actually outer_resume
will take care of L2 resume at a later stage. Need check more on this.
My previous setup is linus' master branch with multi_v7_defconfig with
SNVS RTC enabled, since I need to enable TEE.
Thanks,
Peng.
>
> I tested with Shanw/for-next branch.
>
> [ 4.840665] VFS: Mounted root (nfs filesystem) readonly on device 0:13.
> [ 4.853448] devtmpfs: mounted
> [ 4.858370] Freeing unused kernel memory: 1024K
> INIT: version 2.88 booting
> [ 6.835667] BUG: Bad rss-counter state mm:ecef66c0 idx:0 val:-1
> [ 6.841783] BUG: Bad rss-counter state mm:ecef66c0 idx:1 val:1
> Starting udev
> [ 7.792090] Unable to handle kernel NULL pointer dereference at virtual
> address 00000001
> [ 7.800500] pgd = ecbcc000
> [ 7.803884] [00000001] *pgd=ba0c1831
> [ 7.807541] Internal error: Oops: 17 [#1] SMP ARM
> [ 7.812268] Modules linked in:
> [ 7.815368] CPU: 0 PID: 175 Comm: S04udev Not tainted 4.15.0-rc1-00043-
> g7afb5ac-dirty #1891
> [ 7.823739] Hardware name: Freescale i.MX6 SoloX (Device Tree)
> [ 7.829595] task: ec79d940 task.stack: ec8bc000
> [ 7.834168] PC is at kmem_cache_alloc+0xf0/0x168
> [ 7.838808] LR is at 0x2e85d000
> [ 7.841971] pc : [<c0226ec0>] lr : [<2e85d000>] psr: 20000013
> [ 7.848257] sp : ec8bdef8 ip : ef7d9ee0 fp : ec8bdf2c
> [ 7.853502] r10: 00000b5e r9 : 00000001 r8 : a0000013
> [ 7.858748] r7 : 00000b5f r6 : c014a21c r5 : 014000c0 r4 : ec001d80
> [ 7.865295] r3 : 00000000 r2 : eca5b200 r1 : ec8bc000 r0 : c1009290
> [ 7.871848] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment
> none
> [ 7.879003] Control: 10c5387d Table: acbcc04a DAC: 00000051
> [ 7.884770] Process S04udev (pid: 175, stack limit = 0xec8bc210)
> [ 7.890798] Stack: (0xec8bdef8 to 0xec8be000)
> [ 7.895180] dee0: 00422030 00000000
> [ 7.903387] df00: 000000c3 00000004 ec79d940 ffffff9c 0178f780 c0108104
> ec8bc000 00000000
> [ 7.911592] df20: ec8bdf44 ec8bdf30 c014a21c c0226ddc 00000004 00000000
> ec8bdf94 ec8bdf48
> [ 7.919798] df40: c022bf2c c014a1fc 00422030 00000000 0000000d 00000004
> 000003e8 000003e8
> [ 7.928004] df60: 0000a990 00000000 5a41ff5b 00000004 00000000 0178f780
> 00000021 c0108104
> [ 7.936209] df80: ec8bc000 00000000 ec8bdfa4 ec8bdf98 c022c120 c022bf0c
> 00000000 ec8bdfa8
> [ 7.944414] dfa0: c0107f40 c022c110 00000004 00000000 0178f780 00000004
> be92eca8 00008000
> [ 7.952619] dfc0: 00000004 00000000 0178f780 00000021 00000000 00000000
> 00000024 be92edac
> [ 7.960826] dfe0: 000e51e4 be92eca4 b6eac97c b6eac87c 60000010 0178f780
> 00000000 00000000
> [ 7.969018] Backtrace:
> [ 7.971519] [<c0226dd0>] (kmem_cache_alloc) from [<c014a21c>]
> (prepare_creds+0x2c/0x120)
> [ 7.979642] r10:00000000 r9:ec8bc000 r8:c0108104 r7:0178f780 r6:ffffff9c
> r5:ec79d940
> [ 7.987492] r4:00000004
> [ 7.990060] [<c014a1f0>] (prepare_creds) from [<c022bf2c>]
> (SyS_faccessat+0x2c/0x204)
> [ 7.997911] r5:00000000 r4:00000004
> [ 8.001517] [<c022bf00>] (SyS_faccessat) from [<c022c120>]
> (SyS_access+0x1c/0x20)
> [ 8.009028] r10:00000000 r9:ec8bc000 r8:c0108104 r7:00000021 r6:0178f780
> r5:00000000
> [ 8.016875] r4:00000004
> [ 8.019448] [<c022c104>] (SyS_access) from [<c0107f40>]
> (ret_fast_syscall+0x0/0x28)
> [ 8.027135] Code: e121f008 e3590000 0a000002 e5943014 (e7993003)
> [ 8.033525] ---[ end trace 5829484d9a98b0fd ]---
> /etc/init.d/rc: line 45: 175 Se[ 8.042776] Unable to handle kernel NULL
> pointer dereference at virtual address 00000001
>
> Regards
> Dong Aisheng
>
> > Regards
> > Dong Aisheng
> >
> > > Shawn
^ permalink raw reply
* [clk:clk-next 136/143] drivers/clk/clk-si5351.c:906:6: sparse: symbol '_si5351_clkout_reset_pll' was not declared. Should it be static?
From: kbuild test robot @ 2017-12-27 4:25 UTC (permalink / raw)
To: linux-arm-kernel
tree: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
head: cf12ed59508b49c2baaccd7cff68d550c5042b58
commit: b26ff127c52c005ac4eb99ebff7bd17c240c2e89 [136/143] clk: si5351: Apply PLL soft reset before enabling the outputs
reproduce:
# apt-get install sparse
git checkout b26ff127c52c005ac4eb99ebff7bd17c240c2e89
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply
* [RFC PATCH clk] clk: si5351: _si5351_clkout_reset_pll() can be static
From: kbuild test robot @ 2017-12-27 4:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201712271259.pq3B6Kw4%fengguang.wu@intel.com>
Fixes: b26ff127c52c ("clk: si5351: Apply PLL soft reset before enabling the outputs")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
clk-si5351.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 79b770f..fedaeb1 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -903,7 +903,7 @@ static int _si5351_clkout_set_disable_state(
return 0;
}
-void _si5351_clkout_reset_pll(struct si5351_driver_data *drvdata, int num)
+static void _si5351_clkout_reset_pll(struct si5351_driver_data *drvdata, int num)
{
u8 val = si5351_reg_read(drvdata, SI5351_CLK0_CTRL + num);
^ permalink raw reply related
* [PATCH] ARM: dts: ls1021a: fix incorrect clock references
From: Shawn Guo @ 2017-12-27 4:14 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171221214432.3658852-1-arnd@arndb.de>
On Thu, Dec 21, 2017 at 10:44:20PM +0100, Arnd Bergmann wrote:
> dtc warns about two 'clocks' properties that have an extraneous '1'
> at the end:
>
> arch/arm/boot/dts/ls1021a-qds.dtb: Warning (clocks_property): arch/arm/boot/dts/ls1021a-twr.dtb: Warning (clocks_property): Property 'clocks', cell 1 is not a phandle reference in /soc/i2c at 2180000/mux at 77/i2c at 4/sgtl5000 at 2a
> arch/arm/boot/dts/ls1021a-qds.dtb: Warning (clocks_property): Missing property '#clock-cells' in node /soc/interrupt-controller at 1400000 or bad phandle (referred from /soc/i2c at 2180000/mux at 77/i2c at 4/sgtl5000 at 2a:clocks[1])
> Property 'clocks', cell 1 is not a phandle reference in /soc/i2c at 2190000/sgtl5000 at a
> arch/arm/boot/dts/ls1021a-twr.dtb: Warning (clocks_property): Missing property '#clock-cells' in node /soc/interrupt-controller at 1400000 or bad phandle (referred from /soc/i2c at 2190000/sgtl5000 at a:clocks[1])
>
> The clocks that get referenced here are fixed-rate, so they do not
> take any argument, and dtc interprets the next cell as a phandle, which
> is invalid.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Hi Arnd,
Thanks for the patch. But I have queued up a couple of patches from
Fabio [1] for that.
Shawn
[1] https://www.spinics.net/lists/arm-kernel/msg624303.html
^ permalink raw reply
* [PATCH v3 00/11] Allwinner H3/H5/A64(DE2) SimpleFB support
From: Icenowy Zheng @ 2017-12-27 4:10 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CAGb2v653n_Q-spOSP9RTXBrL7CtrYiV7dAyRAVYCxg3KpzRvoQ@mail.gmail.com>
? 2017?12?27???? CST ??12:09:41?Chen-Yu Tsai ???
> On Fri, Dec 22, 2017 at 8:22 PM, Icenowy Zheng <icenowy@aosc.io> wrote:
> > This patchset adds support for the SimpleFB on Allwinner SoCs with
> > "Display Engine 2.0".
> >
> > PATCH 1 to PATCH 3 are DE2 CCU fixes for H3/H5 SoCs.
> >
> > PATCH 4 adds the pipeline strings for DE2 SimpleFB.
> >
> > PATCH 5 to 7 adds necessary device tree nodes (DE2 CCU and SimpleFB)
> > for H3/H5 SoCs.
> >
> > PATCH 8 to 11 are for Allwinner A64 SoC to enable SimpleFB.
>
> Changelog?
They're in seperate patches.
>
> ChenYu
>
> > Icenowy Zheng (11):
> > dt-bindings: fix the binding of Allwinner DE2 CCU of A83T and H3
> > clk: sunxi-ng: add support for Allwinner H3 DE2 CCU
> > clk: sunxi-ng: fix the A64/H5 clock description of DE2 CCU
> > dt-bindings: simplefb-sunxi: add pipelines for DE2
> > ARM: sun8i: h3/h5: add DE2 CCU device node for H3
> > arm64: allwinner: h5: add compatible string for DE2 CCU
> > ARM: sunxi: h3/h5: add simplefb nodes
> > dt-bindings: add binding for A64 DE2 CCU SRAM
> > clk: sunxi-ng: add support for Allwinner A64 DE2 CCU
> > arm64: allwinner: a64: add DE2 CCU for A64 SoC
> > arm64: allwinner: a64: add simplefb for A64 SoC
> >
> > .../devicetree/bindings/clock/sun8i-de2.txt | 10 ++-
> > .../bindings/display/simple-framebuffer-sunxi.txt | 4 +
> > arch/arm/boot/dts/sun8i-h3.dtsi | 4 +
> > arch/arm/boot/dts/sunxi-h3-h5.dtsi | 43 +++++++++++
> > arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 65 +++++++++++++++++
> > arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 4 +
> > drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 85
> > +++++++++++++++++++--- 7 files changed, 202 insertions(+), 13
> > deletions(-)
> >
> > --
> > 2.14.2
^ permalink raw reply
* [PATCH 2/2] ARM: dts: imx6: RDU2: correct RTC compatible
From: Andrey Smirnov @ 2017-12-27 3:56 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227035656.4941-1-andrew.smirnov@gmail.com>
The RTC is manufactured by Maxim. This is a cosmetic fix, as Linux
doesn't match the vendor string for i2c devices.
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: devicetree at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: cphealy at gmail.com
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
index eef737bd52d9..6bef9a98678e 100644
--- a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
@@ -581,7 +581,7 @@
};
ds1341: rtc at 68 {
- compatible = "dallas,ds1341";
+ compatible = "maxim,ds1341";
reg = <0x68>;
};
};
^ permalink raw reply related
* [PATCH 1/2] ARM: dts: imx6: RDU2: disable internal watchdog
From: Andrey Smirnov @ 2017-12-27 3:56 UTC (permalink / raw)
To: linux-arm-kernel
The system has an external watchdog in the environment processor
so the internal watchdog is of no use.
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: devicetree at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Cc: cphealy at gmail.com
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
index 6bef9a98678e..818bfc8692a5 100644
--- a/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi
@@ -838,6 +838,10 @@
status = "okay";
};
+&wdog1 {
+ status = "disabled";
+};
+
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
^ permalink raw reply related
* [PATCH 09/11 v3] ARM: orion5x: constify gpio_led
From: Arvind Yadav @ 2017-12-27 3:09 UTC (permalink / raw)
To: linux-arm-kernel
gpio_led are not supposed to change at runtime.
struct gpio_led_platform_data working with const gpio_led
provided by <linux/leds.h>. So mark the non-const structs
as const.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
changes in v2:
The GPIO LED driver can be built as a module, it can
be loaded after the init sections have gone away.
So removed '__initconst'.
changes in v3:
Fix build error.
arch/arm/mach-orion5x/board-d2net.c | 2 +-
arch/arm/mach-orion5x/dns323-setup.c | 2 +-
arch/arm/mach-orion5x/ls_hgl-setup.c | 2 +-
arch/arm/mach-orion5x/mv2120-setup.c | 2 +-
arch/arm/mach-orion5x/net2big-setup.c | 2 +-
arch/arm/mach-orion5x/rd88f5182-setup.c | 2 +-
arch/arm/mach-orion5x/ts409-setup.c | 2 +-
arch/arm/mach-orion5x/wrt350n-v2-setup.c | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-orion5x/board-d2net.c b/arch/arm/mach-orion5x/board-d2net.c
index a89376a..55d6562 100644
--- a/arch/arm/mach-orion5x/board-d2net.c
+++ b/arch/arm/mach-orion5x/board-d2net.c
@@ -54,7 +54,7 @@
#define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16
#define D2NET_GPIO_BLUE_LED_OFF 23
-static struct gpio_led d2net_leds[] = {
+static const struct gpio_led d2net_leds[] = {
{
.name = "d2net:blue:sata",
.default_trigger = "default-on",
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index cd483bf..792a56e 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -221,7 +221,7 @@ static struct gpio_led dns323ab_leds[] = {
};
-static struct gpio_led dns323c_leds[] = {
+static const struct gpio_led dns323c_leds[] = {
{
.name = "power:blue",
.gpio = DNS323C_GPIO_LED_POWER,
diff --git a/arch/arm/mach-orion5x/ls_hgl-setup.c b/arch/arm/mach-orion5x/ls_hgl-setup.c
index 47ba6e0..c394281 100644
--- a/arch/arm/mach-orion5x/ls_hgl-setup.c
+++ b/arch/arm/mach-orion5x/ls_hgl-setup.c
@@ -86,7 +86,7 @@ static struct i2c_board_info __initdata ls_hgl_i2c_rtc = {
#define LS_HGL_GPIO_LED_PWR 0
-static struct gpio_led ls_hgl_led_pins[] = {
+static const struct gpio_led ls_hgl_led_pins[] = {
{
.name = "alarm:red",
.gpio = LS_HGL_GPIO_LED_ALARM,
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c
index 2bf8ec7..724c08a 100644
--- a/arch/arm/mach-orion5x/mv2120-setup.c
+++ b/arch/arm/mach-orion5x/mv2120-setup.c
@@ -136,7 +136,7 @@ static struct i2c_board_info __initdata mv2120_i2c_rtc = {
.irq = 0,
};
-static struct gpio_led mv2120_led_pins[] = {
+static const struct gpio_led mv2120_led_pins[] = {
{
.name = "mv2120:blue:health",
.gpio = 0,
diff --git a/arch/arm/mach-orion5x/net2big-setup.c b/arch/arm/mach-orion5x/net2big-setup.c
index bf6be4c..7d59888 100644
--- a/arch/arm/mach-orion5x/net2big-setup.c
+++ b/arch/arm/mach-orion5x/net2big-setup.c
@@ -214,7 +214,7 @@ static void __init net2big_sata_power_init(void)
#define NET2BIG_GPIO_SATA0_BLUE_LED 17
#define NET2BIG_GPIO_SATA1_BLUE_LED 13
-static struct gpio_led net2big_leds[] = {
+static const struct gpio_led net2big_leds[] = {
{
.name = "net2big:red:power",
.gpio = NET2BIG_GPIO_PWR_RED_LED,
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index fe3e67c..e2f280d 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -83,7 +83,7 @@ static struct platform_device rd88f5182_nor_flash = {
#define RD88F5182_GPIO_LED 0
-static struct gpio_led rd88f5182_gpio_led_pins[] = {
+static const struct gpio_led rd88f5182_gpio_led_pins[] = {
{
.name = "rd88f5182:cpu",
.default_trigger = "cpu0",
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index a77613b..a31f6848 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -169,7 +169,7 @@ static struct i2c_board_info __initdata qnap_ts409_i2c_rtc = {
* LEDs attached to GPIO
****************************************************************************/
-static struct gpio_led ts409_led_pins[] = {
+static const struct gpio_led ts409_led_pins[] = {
{
.name = "ts409:red:sata1",
.gpio = 4,
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index 9250bb2..5493d73 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -29,7 +29,7 @@
/*
* LEDs attached to GPIO
*/
-static struct gpio_led wrt350n_v2_led_pins[] = {
+static const struct gpio_led wrt350n_v2_led_pins[] = {
{
.name = "wrt350nv2:green:power",
.gpio = 0,
--
2.7.4
^ permalink raw reply related
* [PATCH V2] ARM: imx: suspend/resume: use outer_disable/resume
From: Peng Fan @ 2017-12-27 2:53 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227025055.GD11724@b29396-OptiPlex-7040>
> -----Original Message-----
> From: Dong Aisheng [mailto:dongas86 at gmail.com]
> Sent: Wednesday, December 27, 2017 10:51 AM
> To: A.s. Dong <aisheng.dong@nxp.com>
> Cc: Shawn Guo <shawnguo@kernel.org>; Peng Fan <peng.fan@nxp.com>;
> linux-kernel at vger.kernel.org; Russell King <linux@armlinux.org.uk>; Fabio
> Estevam <fabio.estevam@nxp.com>; Sascha Hauer <kernel@pengutronix.de>;
> van.freenix at gmail.com; linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH V2] ARM: imx: suspend/resume: use
> outer_disable/resume
>
> On Wed, Dec 27, 2017 at 02:33:57AM +0000, A.s. Dong wrote:
> > > -----Original Message-----
> > > From: Shawn Guo [mailto:shawnguo at kernel.org]
> > > Sent: Wednesday, December 27, 2017 10:32 AM
> > > To: Peng Fan <peng.fan@nxp.com>
> > > Cc: A.s. Dong <aisheng.dong@nxp.com>; linux-kernel at vger.kernel.org;
> > > Russell King <linux@armlinux.org.uk>; Fabio Estevam
> > > <fabio.estevam@nxp.com>; Sascha Hauer <kernel@pengutronix.de>;
> > > van.freenix at gmail.com; linux-arm- kernel at lists.infradead.org
> > > Subject: Re: [PATCH V2] ARM: imx: suspend/resume: use
> > > outer_disable/resume
> > >
> > > On Wed, Dec 27, 2017 at 09:57:47AM +0800, Peng Fan wrote:
> > > > Use outer_disable/resume for suspend/resume.
> > > > With the two APIs used, code could be simplified and easy to
> > > > extend to introduce l2c_write_sec for i.MX platforms when moving
> > > > Linux Kernel runs in non-secure world.
> > > >
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > Cc: Shawn Guo <shawnguo@kernel.org>
> > > > Cc: Sascha Hauer <kernel@pengutronix.de>
> > > > Cc: Fabio Estevam <fabio.estevam@nxp.com>
> > > > Cc: Russell King <linux@armlinux.org.uk>
> > > > Cc: Dong Aisheng <aisheng.dong@nxp.com>
> > >
> > > @Aisheng, can you please give it a test?
> > >
> >
> > Yes, of course.
> >
>
> Not sure but i can still meet booting crash on mx6sx sdb.
> Peng, you did not meet it, right?
>
> I tested with Shanw/for-next branch.
I use kernel master branch. I'll switch to shawn's for-next branch and give a test.
Thanks,
Peng.
>
> [ 4.840665] VFS: Mounted root (nfs filesystem) readonly on device 0:13.
> [ 4.853448] devtmpfs: mounted
> [ 4.858370] Freeing unused kernel memory: 1024K
> INIT: version 2.88 booting
> [ 6.835667] BUG: Bad rss-counter state mm:ecef66c0 idx:0 val:-1
> [ 6.841783] BUG: Bad rss-counter state mm:ecef66c0 idx:1 val:1
> Starting udev
> [ 7.792090] Unable to handle kernel NULL pointer dereference at virtual
> address 00000001
> [ 7.800500] pgd = ecbcc000
> [ 7.803884] [00000001] *pgd=ba0c1831
> [ 7.807541] Internal error: Oops: 17 [#1] SMP ARM
> [ 7.812268] Modules linked in:
> [ 7.815368] CPU: 0 PID: 175 Comm: S04udev Not tainted 4.15.0-rc1-00043-
> g7afb5ac-dirty #1891
> [ 7.823739] Hardware name: Freescale i.MX6 SoloX (Device Tree)
> [ 7.829595] task: ec79d940 task.stack: ec8bc000
> [ 7.834168] PC is at kmem_cache_alloc+0xf0/0x168
> [ 7.838808] LR is at 0x2e85d000
> [ 7.841971] pc : [<c0226ec0>] lr : [<2e85d000>] psr: 20000013
> [ 7.848257] sp : ec8bdef8 ip : ef7d9ee0 fp : ec8bdf2c
> [ 7.853502] r10: 00000b5e r9 : 00000001 r8 : a0000013
> [ 7.858748] r7 : 00000b5f r6 : c014a21c r5 : 014000c0 r4 : ec001d80
> [ 7.865295] r3 : 00000000 r2 : eca5b200 r1 : ec8bc000 r0 : c1009290
> [ 7.871848] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment
> none
> [ 7.879003] Control: 10c5387d Table: acbcc04a DAC: 00000051
> [ 7.884770] Process S04udev (pid: 175, stack limit = 0xec8bc210)
> [ 7.890798] Stack: (0xec8bdef8 to 0xec8be000)
> [ 7.895180] dee0: 00422030 00000000
> [ 7.903387] df00: 000000c3 00000004 ec79d940 ffffff9c 0178f780 c0108104
> ec8bc000 00000000
> [ 7.911592] df20: ec8bdf44 ec8bdf30 c014a21c c0226ddc 00000004 00000000
> ec8bdf94 ec8bdf48
> [ 7.919798] df40: c022bf2c c014a1fc 00422030 00000000 0000000d 00000004
> 000003e8 000003e8
> [ 7.928004] df60: 0000a990 00000000 5a41ff5b 00000004 00000000 0178f780
> 00000021 c0108104
> [ 7.936209] df80: ec8bc000 00000000 ec8bdfa4 ec8bdf98 c022c120 c022bf0c
> 00000000 ec8bdfa8
> [ 7.944414] dfa0: c0107f40 c022c110 00000004 00000000 0178f780 00000004
> be92eca8 00008000
> [ 7.952619] dfc0: 00000004 00000000 0178f780 00000021 00000000 00000000
> 00000024 be92edac
> [ 7.960826] dfe0: 000e51e4 be92eca4 b6eac97c b6eac87c 60000010 0178f780
> 00000000 00000000
> [ 7.969018] Backtrace:
> [ 7.971519] [<c0226dd0>] (kmem_cache_alloc) from [<c014a21c>]
> (prepare_creds+0x2c/0x120)
> [ 7.979642] r10:00000000 r9:ec8bc000 r8:c0108104 r7:0178f780 r6:ffffff9c
> r5:ec79d940
> [ 7.987492] r4:00000004
> [ 7.990060] [<c014a1f0>] (prepare_creds) from [<c022bf2c>]
> (SyS_faccessat+0x2c/0x204)
> [ 7.997911] r5:00000000 r4:00000004
> [ 8.001517] [<c022bf00>] (SyS_faccessat) from [<c022c120>]
> (SyS_access+0x1c/0x20)
> [ 8.009028] r10:00000000 r9:ec8bc000 r8:c0108104 r7:00000021 r6:0178f780
> r5:00000000
> [ 8.016875] r4:00000004
> [ 8.019448] [<c022c104>] (SyS_access) from [<c0107f40>]
> (ret_fast_syscall+0x0/0x28)
> [ 8.027135] Code: e121f008 e3590000 0a000002 e5943014 (e7993003)
> [ 8.033525] ---[ end trace 5829484d9a98b0fd ]---
> /etc/init.d/rc: line 45: 175 Se[ 8.042776] Unable to handle kernel NULL
> pointer dereference at virtual address 00000001
>
> Regards
> Dong Aisheng
>
> > Regards
> > Dong Aisheng
> >
> > > Shawn
^ permalink raw reply
* [PATCH] ARM: dts: imx7s: Avoid using label in unit address and reg
From: Shawn Guo @ 2017-12-27 2:53 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1514318385-12135-1-git-send-email-festevam@gmail.com>
On Tue, Dec 26, 2017 at 05:59:45PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> As recommended by Rob Herring [1] labels should not be used in unit address
> and reg, so use its real value directly instead.
>
> [1] https://www.spinics.net/lists/devicetree/msg206567.html
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Applied, thanks.
^ permalink raw reply
* [PATCH V2] ARM: imx: suspend/resume: use outer_disable/resume
From: Dong Aisheng @ 2017-12-27 2:50 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <AM3PR04MB3067ECFE7A7DAE48DFD124780070@AM3PR04MB306.eurprd04.prod.outlook.com>
On Wed, Dec 27, 2017 at 02:33:57AM +0000, A.s. Dong wrote:
> > -----Original Message-----
> > From: Shawn Guo [mailto:shawnguo at kernel.org]
> > Sent: Wednesday, December 27, 2017 10:32 AM
> > To: Peng Fan <peng.fan@nxp.com>
> > Cc: A.s. Dong <aisheng.dong@nxp.com>; linux-kernel at vger.kernel.org; Russell
> > King <linux@armlinux.org.uk>; Fabio Estevam <fabio.estevam@nxp.com>;
> > Sascha Hauer <kernel@pengutronix.de>; van.freenix at gmail.com; linux-arm-
> > kernel at lists.infradead.org
> > Subject: Re: [PATCH V2] ARM: imx: suspend/resume: use
> > outer_disable/resume
> >
> > On Wed, Dec 27, 2017 at 09:57:47AM +0800, Peng Fan wrote:
> > > Use outer_disable/resume for suspend/resume.
> > > With the two APIs used, code could be simplified and easy to extend to
> > > introduce l2c_write_sec for i.MX platforms when moving Linux Kernel
> > > runs in non-secure world.
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > Cc: Shawn Guo <shawnguo@kernel.org>
> > > Cc: Sascha Hauer <kernel@pengutronix.de>
> > > Cc: Fabio Estevam <fabio.estevam@nxp.com>
> > > Cc: Russell King <linux@armlinux.org.uk>
> > > Cc: Dong Aisheng <aisheng.dong@nxp.com>
> >
> > @Aisheng, can you please give it a test?
> >
>
> Yes, of course.
>
Not sure but i can still meet booting crash on mx6sx sdb.
Peng, you did not meet it, right?
I tested with Shanw/for-next branch.
[ 4.840665] VFS: Mounted root (nfs filesystem) readonly on device 0:13.
[ 4.853448] devtmpfs: mounted
[ 4.858370] Freeing unused kernel memory: 1024K
INIT: version 2.88 booting
[ 6.835667] BUG: Bad rss-counter state mm:ecef66c0 idx:0 val:-1
[ 6.841783] BUG: Bad rss-counter state mm:ecef66c0 idx:1 val:1
Starting udev
[ 7.792090] Unable to handle kernel NULL pointer dereference at virtual address 00000001
[ 7.800500] pgd = ecbcc000
[ 7.803884] [00000001] *pgd=ba0c1831
[ 7.807541] Internal error: Oops: 17 [#1] SMP ARM
[ 7.812268] Modules linked in:
[ 7.815368] CPU: 0 PID: 175 Comm: S04udev Not tainted 4.15.0-rc1-00043-g7afb5ac-dirty #1891
[ 7.823739] Hardware name: Freescale i.MX6 SoloX (Device Tree)
[ 7.829595] task: ec79d940 task.stack: ec8bc000
[ 7.834168] PC is at kmem_cache_alloc+0xf0/0x168
[ 7.838808] LR is at 0x2e85d000
[ 7.841971] pc : [<c0226ec0>] lr : [<2e85d000>] psr: 20000013
[ 7.848257] sp : ec8bdef8 ip : ef7d9ee0 fp : ec8bdf2c
[ 7.853502] r10: 00000b5e r9 : 00000001 r8 : a0000013
[ 7.858748] r7 : 00000b5f r6 : c014a21c r5 : 014000c0 r4 : ec001d80
[ 7.865295] r3 : 00000000 r2 : eca5b200 r1 : ec8bc000 r0 : c1009290
[ 7.871848] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 7.879003] Control: 10c5387d Table: acbcc04a DAC: 00000051
[ 7.884770] Process S04udev (pid: 175, stack limit = 0xec8bc210)
[ 7.890798] Stack: (0xec8bdef8 to 0xec8be000)
[ 7.895180] dee0: 00422030 00000000
[ 7.903387] df00: 000000c3 00000004 ec79d940 ffffff9c 0178f780 c0108104 ec8bc000 00000000
[ 7.911592] df20: ec8bdf44 ec8bdf30 c014a21c c0226ddc 00000004 00000000 ec8bdf94 ec8bdf48
[ 7.919798] df40: c022bf2c c014a1fc 00422030 00000000 0000000d 00000004 000003e8 000003e8
[ 7.928004] df60: 0000a990 00000000 5a41ff5b 00000004 00000000 0178f780 00000021 c0108104
[ 7.936209] df80: ec8bc000 00000000 ec8bdfa4 ec8bdf98 c022c120 c022bf0c 00000000 ec8bdfa8
[ 7.944414] dfa0: c0107f40 c022c110 00000004 00000000 0178f780 00000004 be92eca8 00008000
[ 7.952619] dfc0: 00000004 00000000 0178f780 00000021 00000000 00000000 00000024 be92edac
[ 7.960826] dfe0: 000e51e4 be92eca4 b6eac97c b6eac87c 60000010 0178f780 00000000 00000000
[ 7.969018] Backtrace:
[ 7.971519] [<c0226dd0>] (kmem_cache_alloc) from [<c014a21c>] (prepare_creds+0x2c/0x120)
[ 7.979642] r10:00000000 r9:ec8bc000 r8:c0108104 r7:0178f780 r6:ffffff9c r5:ec79d940
[ 7.987492] r4:00000004
[ 7.990060] [<c014a1f0>] (prepare_creds) from [<c022bf2c>] (SyS_faccessat+0x2c/0x204)
[ 7.997911] r5:00000000 r4:00000004
[ 8.001517] [<c022bf00>] (SyS_faccessat) from [<c022c120>] (SyS_access+0x1c/0x20)
[ 8.009028] r10:00000000 r9:ec8bc000 r8:c0108104 r7:00000021 r6:0178f780 r5:00000000
[ 8.016875] r4:00000004
[ 8.019448] [<c022c104>] (SyS_access) from [<c0107f40>] (ret_fast_syscall+0x0/0x28)
[ 8.027135] Code: e121f008 e3590000 0a000002 e5943014 (e7993003)
[ 8.033525] ---[ end trace 5829484d9a98b0fd ]---
/etc/init.d/rc: line 45: 175 Se[ 8.042776] Unable to handle kernel NULL pointer dereference at virtual address 00000001
Regards
Dong Aisheng
> Regards
> Dong Aisheng
>
> > Shawn
^ permalink raw reply
* [PATCH] arm64: dts: ls1088a: add DT node of watchdog
From: Shawn Guo @ 2017-12-27 2:45 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20171227020200.25542-1-ying.zhang@freescale.com>
On Wed, Dec 27, 2017 at 10:02:00AM +0800, ying.zhang at freescale.com wrote:
> From: Zhang Ying-22455 <ying.zhang22455@nxp.com>
>
> There are eight cores in ls1088a and each core has an watchdog,
> ls1088a can use sp805-wdt driver, so we just add DT node for it.
>
> Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
> ---
> arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 56 ++++++++++++++++++++++++
> 1 files changed, 56 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> index f5f29a2..49366d1 100644
> --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
> @@ -369,6 +369,62 @@
> status = "disabled";
> };
>
> + cluster1_core0_watchdog: wdt at c000000 {
> + compatible = "arm,sp805-wdt", "arm,primecell";
> + reg = <0x0 0xc000000 0x0 0x1000>;
> + clocks = <&clockgen 4 3>, <&clockgen 4 3>;
> + clock-names = "apb_pclk", "wdog_clk";
> + };
> +
> + cluster1_core1_watchdog: wdt at c010000 {
> + compatible = "arm,sp805-wdt", "arm,primecell";
> + reg = <0x0 0xc010000 0x0 0x1000>;
> + clocks = <&clockgen 4 3>, <&clockgen 4 3>;
> + clock-names = "apb_pclk", "wdog_clk";
> + };
> +
> + cluster1_core2_watchdog: wdt at c020000 {
> + compatible = "arm,sp805-wdt", "arm,primecell";
> + reg = <0x0 0xc020000 0x0 0x1000>;
> + clocks = <&clockgen 4 3>, <&clockgen 4 3>;
> + clock-names = "apb_pclk", "wdog_clk";
> + };
> +
> + cluster1_core3_watchdog: wdt at c030000 {
> + compatible = "arm,sp805-wdt", "arm,primecell";
> + reg = <0x0 0xc030000 0x0 0x1000>;
> + clocks = <&clockgen 4 3>, <&clockgen 4 3>;
> + clock-names = "apb_pclk", "wdog_clk";
> + };
> +
> + cluster2_core0_watchdog: wdt at c100000 {
> + compatible = "arm,sp805-wdt", "arm,primecell";
> + reg = <0x0 0xc100000 0x0 0x1000>;
> + clocks = <&clockgen 4 3>, <&clockgen 4 3>;
> + clock-names = "apb_pclk", "wdog_clk";
> + };
> +
> + cluster2_core1_watchdog: wdt at c110000 {
> + compatible = "arm,sp805-wdt", "arm,primecell";
> + reg = <0x0 0xc110000 0x0 0x1000>;
> + clocks = <&clockgen 4 3>, <&clockgen 4 3>;
> + clock-names = "apb_pclk", "wdog_clk";
> + };
> +
> + cluster2_core2_watchdog: wdt at c120000 {
> + compatible = "arm,sp805-wdt", "arm,primecell";
> + reg = <0x0 0xc120000 0x0 0x1000>;
> + clocks = <&clockgen 4 3>, <&clockgen 4 3>;
> + clock-names = "apb_pclk", "wdog_clk";
> + };
> +
> + cluster2_core3_watchdog: wdt at c130000 {
> + compatible = "arm,sp805-wdt", "arm,primecell";
> + reg = <0x0 0xc130000 0x0 0x1000>;
> + clocks = <&clockgen 4 3>, <&clockgen 4 3>;
> + clock-names = "apb_pclk", "wdog_clk";
> + };
> +
Please maintain the devices under simple-bus 'soc' node in order of
unit-address, when you add new device nodes. For example, wdt at c130000
shouldn't go before gpio at 2300000.
Shawn
> gpio0: gpio at 2300000 {
> compatible = "fsl,qoriq-gpio";
> reg = <0x0 0x2300000 0x0 0x10000>;
> --
> 1.7.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH v2] arm64: dts: ls1088a: add DT node of watchdog
From: ying.zhang at freescale.com @ 2017-12-27 2:41 UTC (permalink / raw)
To: linux-arm-kernel
From: Zhang Ying-22455 <ying.zhang22455@nxp.com>
There are eight cores in ls1088a and each core has an watchdog,
ls1088a can use sp805-wdt driver, so we just add DT node for it.
Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
---
arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 56 ++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
index f5f29a2..fb1858a 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi
@@ -592,6 +592,62 @@
<0000 0 0 3 &gic 0 0 0 121 IRQ_TYPE_LEVEL_HIGH>,
<0000 0 0 4 &gic 0 0 0 122 IRQ_TYPE_LEVEL_HIGH>;
};
+
+ cluster1_core0_watchdog: wdt at c000000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xc000000 0x0 0x1000>;
+ clocks = <&clockgen 4 3>, <&clockgen 4 3>;
+ clock-names = "apb_pclk", "wdog_clk";
+ };
+
+ cluster1_core1_watchdog: wdt at c010000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xc010000 0x0 0x1000>;
+ clocks = <&clockgen 4 3>, <&clockgen 4 3>;
+ clock-names = "apb_pclk", "wdog_clk";
+ };
+
+ cluster1_core2_watchdog: wdt at c020000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xc020000 0x0 0x1000>;
+ clocks = <&clockgen 4 3>, <&clockgen 4 3>;
+ clock-names = "apb_pclk", "wdog_clk";
+ };
+
+ cluster1_core3_watchdog: wdt at c030000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xc030000 0x0 0x1000>;
+ clocks = <&clockgen 4 3>, <&clockgen 4 3>;
+ clock-names = "apb_pclk", "wdog_clk";
+ };
+
+ cluster2_core0_watchdog: wdt at c100000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xc100000 0x0 0x1000>;
+ clocks = <&clockgen 4 3>, <&clockgen 4 3>;
+ clock-names = "apb_pclk", "wdog_clk";
+ };
+
+ cluster2_core1_watchdog: wdt at c110000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xc110000 0x0 0x1000>;
+ clocks = <&clockgen 4 3>, <&clockgen 4 3>;
+ clock-names = "apb_pclk", "wdog_clk";
+ };
+
+ cluster2_core2_watchdog: wdt at c120000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xc120000 0x0 0x1000>;
+ clocks = <&clockgen 4 3>, <&clockgen 4 3>;
+ clock-names = "apb_pclk", "wdog_clk";
+ };
+
+ cluster2_core3_watchdog: wdt at c130000 {
+ compatible = "arm,sp805-wdt", "arm,primecell";
+ reg = <0x0 0xc130000 0x0 0x1000>;
+ clocks = <&clockgen 4 3>, <&clockgen 4 3>;
+ clock-names = "apb_pclk", "wdog_clk";
+ };
};
firmware {
--
1.7.1
^ permalink raw reply related
* [PATCH] ARM: dts: imx51-zii-rdu1: Add missing #phy-cells to usb-nop-xceiv
From: Shawn Guo @ 2017-12-27 2:38 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1514311460-8840-1-git-send-email-festevam@gmail.com>
On Tue, Dec 26, 2017 at 04:04:20PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> Commit 915fbe59cbf2fe6 ("ARM: dts: imx: Add missing #phy-cells to
> usb-nop-xceiv") missed to update imx51-zii-rdu1.dts probably due to a
> merge timing issue, so add #phy-cells here too.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Applied, thanks.
^ permalink raw reply
* [PATCH] ARM: dts: imx6qdl-hummingboard2: Remove leading zero in unit address
From: Shawn Guo @ 2017-12-27 2:37 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1514310958-3792-1-git-send-email-festevam@gmail.com>
On Tue, Dec 26, 2017 at 03:55:58PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> Remove the leading zero from unit address to fix the following build
> warning with W=1:
>
> arch/arm/boot/dts/imx6dl-hummingboard2.dtb: Warning (unit_address_format): Node /soc/aips-bus at 2100000/i2c at 21a0000/codec at 0a unit name should not have leading 0s
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Applied, thanks.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox