* Re: [PATCH v2 0/7] soc: fsl: guts: cleanups and serial_number support
From: Arnd Bergmann @ 2022-02-10 16:20 UTC (permalink / raw)
To: Michael Walle
Cc: Ulf Hansson, Arnd Bergmann, Linux Kernel Mailing List, Li Yang,
Dan Carpenter, Sudeep Holla, linuxppc-dev, Linux ARM
In-Reply-To: <20220209163242.430265-1-michael@walle.cc>
On Wed, Feb 9, 2022 at 5:32 PM Michael Walle <michael@walle.cc> wrote:
>
> This series converts the guts driver from a platform driver to just an
> core_initcall. The driver itself cannot (or rather should never) be
> unloaded because others depends on detecting the current SoC revision
> to apply chip errata. Other SoC drivers do it the same way. Overall I
> got rid of all the global static variables.
>
> The last patch finally adds unique id support to the guts driver. But
> because the binding [1] for the security fuse processor is still pending,
> it is marked as RFC.
>
> [1] https://lore.kernel.org/linux-devicetree/20220127163728.3650648-2-michael@walle.cc/
>
> changes since v1:
> - call kfree() in error case, thanks Dan
> - add missing of_node_put(np), thanks Dan
Looks all good to me,
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply
* Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
From: Shuah Khan @ 2022-02-10 15:08 UTC (permalink / raw)
To: Aneesh Kumar K V, linux-mm, akpm
Cc: Shuah Khan, linuxppc-dev, linux-kselftest, Shuah Khan
In-Reply-To: <d2c3d33a-9e4b-1efc-b956-66bbf9a6bac5@linux.ibm.com>
On 2/10/22 8:03 AM, Aneesh Kumar K V wrote:
> On 2/10/22 20:09, Shuah Khan wrote:
>> On 2/9/22 9:12 PM, Aneesh Kumar K.V wrote:
>>> Shuah Khan <skhan@linuxfoundation.org> writes:
>>>
>>>> On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote:
>>>>> Keep it simple by using a #define and limiting hugepage size to 2M.
>>>>> This keeps the test simpler instead of dynamically finding the page size
>>>>> and huge page size.
>>>>>
>>>>> Without this tests are broken w.r.t reading /proc/self/pagemap
>>>>>
>>>>> if (pread(pagemap_fd, ent, sizeof(ent),
>>>>> (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
>>>>> err(2, "read pagemap");
>>>>>
>>>>> Cc: Shuah Khan <shuah@kernel.org>
>>>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>>>> ---
>>>>> tools/testing/selftests/vm/ksm_tests.c | 8 ++++++++
>>>>> tools/testing/selftests/vm/transhuge-stress.c | 8 ++++++++
>>>>> 2 files changed, 16 insertions(+)
>>>>>
>>>>> diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
>>>>> index 1436e1a9a3d3..8200328ff018 100644
>>>>> --- a/tools/testing/selftests/vm/ksm_tests.c
>>>>> +++ b/tools/testing/selftests/vm/ksm_tests.c
>>>>> @@ -22,8 +22,16 @@
>>>>> #define KSM_MERGE_ACROSS_NODES_DEFAULT true
>>>>> #define MB (1ul << 20)
>>>>> +#ifdef __powerpc64__
>>>>> +#define PAGE_SHIFT 16
>>>>> +/*
>>>>> + * This will only work with radix 2M hugepage size
>>>>> + */
>>>>> +#define HPAGE_SHIFT 21
>>>>> +#else
>>>>> #define PAGE_SHIFT 12
>>>>> #define HPAGE_SHIFT 21
>>>>> +#endif
>>>>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>>>>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>>>>> diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
>>>>> index 5e4c036f6ad3..f04c8aa4bcf6 100644
>>>>> --- a/tools/testing/selftests/vm/transhuge-stress.c
>>>>> +++ b/tools/testing/selftests/vm/transhuge-stress.c
>>>>> @@ -16,8 +16,16 @@
>>>>> #include <string.h>
>>>>> #include <sys/mman.h>
>>>>> +#ifdef __powerpc64__
>>>>> +#define PAGE_SHIFT 16
>>>>> +/*
>>>>> + * This will only work with radix 2M hugepage size
>>>>> + */
>>>>> +#define HPAGE_SHIFT 21
>>>>
>>>> Why not have this is in common code?
>>>
>>> Can you suggest where I can move that. We also have helper functions
>>> like allocate_transhuge() duplicated between tests. I didn't find
>>> libutil.a or anything similar supported by the selftets build.
>>>
>>>>
>>
>> I noticed that HPAGE_SHIFT is defined in #ifdef __powerpc64__ block
>> as well as #else. I am asking is it necessary to be part of both
>> blocks.
>>
>> +#ifdef __powerpc64__
>> +#define PAGE_SHIFT 16
>> +/*
>> + * This will only work with radix 2M hugepage size
>> + */
>> +#define HPAGE_SHIFT 21 --- this one
>> +#else
>> #define PAGE_SHIFT 12
>> #define HPAGE_SHIFT 21 --- this one
>> +#endif
>>
>
>
> The reason I did that was to add the comment which is relevant only for ppc64. ppc64 supports two hugepage sizes, 2M and 16M. The test won't work correctly with 16M hugepage size. We do have other tests in selftest/vm/ with similar restrictions.
>
>
Right. You don't have to duplicate code for the comment. You can add the
comment and then clarify in the comment that it is only relevant to ppc64.
This way the comment is clear and we can avoid duplicate code that makes it
hard to maintain in the future.
thanks,
-- Shuah
^ permalink raw reply
* Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
From: Aneesh Kumar K V @ 2022-02-10 15:03 UTC (permalink / raw)
To: Shuah Khan, linux-mm, akpm; +Cc: Shuah Khan, linuxppc-dev
In-Reply-To: <eed2c443-21b0-3c0e-6571-551460fdf303@linuxfoundation.org>
On 2/10/22 20:09, Shuah Khan wrote:
> On 2/9/22 9:12 PM, Aneesh Kumar K.V wrote:
>> Shuah Khan <skhan@linuxfoundation.org> writes:
>>
>>> On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote:
>>>> Keep it simple by using a #define and limiting hugepage size to 2M.
>>>> This keeps the test simpler instead of dynamically finding the page
>>>> size
>>>> and huge page size.
>>>>
>>>> Without this tests are broken w.r.t reading /proc/self/pagemap
>>>>
>>>> if (pread(pagemap_fd, ent, sizeof(ent),
>>>> (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
>>>> err(2, "read pagemap");
>>>>
>>>> Cc: Shuah Khan <shuah@kernel.org>
>>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>>> ---
>>>> tools/testing/selftests/vm/ksm_tests.c | 8 ++++++++
>>>> tools/testing/selftests/vm/transhuge-stress.c | 8 ++++++++
>>>> 2 files changed, 16 insertions(+)
>>>>
>>>> diff --git a/tools/testing/selftests/vm/ksm_tests.c
>>>> b/tools/testing/selftests/vm/ksm_tests.c
>>>> index 1436e1a9a3d3..8200328ff018 100644
>>>> --- a/tools/testing/selftests/vm/ksm_tests.c
>>>> +++ b/tools/testing/selftests/vm/ksm_tests.c
>>>> @@ -22,8 +22,16 @@
>>>> #define KSM_MERGE_ACROSS_NODES_DEFAULT true
>>>> #define MB (1ul << 20)
>>>> +#ifdef __powerpc64__
>>>> +#define PAGE_SHIFT 16
>>>> +/*
>>>> + * This will only work with radix 2M hugepage size
>>>> + */
>>>> +#define HPAGE_SHIFT 21
>>>> +#else
>>>> #define PAGE_SHIFT 12
>>>> #define HPAGE_SHIFT 21
>>>> +#endif
>>>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>>>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>>>> diff --git a/tools/testing/selftests/vm/transhuge-stress.c
>>>> b/tools/testing/selftests/vm/transhuge-stress.c
>>>> index 5e4c036f6ad3..f04c8aa4bcf6 100644
>>>> --- a/tools/testing/selftests/vm/transhuge-stress.c
>>>> +++ b/tools/testing/selftests/vm/transhuge-stress.c
>>>> @@ -16,8 +16,16 @@
>>>> #include <string.h>
>>>> #include <sys/mman.h>
>>>> +#ifdef __powerpc64__
>>>> +#define PAGE_SHIFT 16
>>>> +/*
>>>> + * This will only work with radix 2M hugepage size
>>>> + */
>>>> +#define HPAGE_SHIFT 21
>>>
>>> Why not have this is in common code?
>>
>> Can you suggest where I can move that. We also have helper functions
>> like allocate_transhuge() duplicated between tests. I didn't find
>> libutil.a or anything similar supported by the selftets build.
>>
>>>
>
> I noticed that HPAGE_SHIFT is defined in #ifdef __powerpc64__ block
> as well as #else. I am asking is it necessary to be part of both
> blocks.
>
> +#ifdef __powerpc64__
> +#define PAGE_SHIFT 16
> +/*
> + * This will only work with radix 2M hugepage size
> + */
> +#define HPAGE_SHIFT 21 --- this one
> +#else
> #define PAGE_SHIFT 12
> #define HPAGE_SHIFT 21 --- this one
> +#endif
>
The reason I did that was to add the comment which is relevant only for
ppc64. ppc64 supports two hugepage sizes, 2M and 16M. The test won't
work correctly with 16M hugepage size. We do have other tests in
selftest/vm/ with similar restrictions.
-aneesh
^ permalink raw reply
* Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL
From: Steven Rostedt @ 2022-02-10 14:59 UTC (permalink / raw)
To: Naveen N. Rao
Cc: Daniel Borkmann, Yauheni Kaliuta, Jordan Niethe, linuxppc-dev,
bpf, Jiri Olsa, Alexei Starovoitov, Hari Bathini
In-Reply-To: <1644501274.apfdo9z1hy.naveen@linux.ibm.com>
On Thu, 10 Feb 2022 13:58:29 +0000
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index f9feb197b2daaf..68f20cf34b0c47 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1510,6 +1510,7 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
> }
>
>
> +#ifndef ftrace_cmp_recs
> static int ftrace_cmp_recs(const void *a, const void *b)
> {
> const struct dyn_ftrace *key = a;
> @@ -1521,6 +1522,7 @@ static int ftrace_cmp_recs(const void *a, const void *b)
> return 1;
> return 0;
> }
> +#endif
>
I don't really care for this part, as it seems somewhat ugly. But this
patch does appear to solve your issue, and I can't think of a prettier way
to do this.
So, I will reluctantly ack it.
If anything, please add a comment above saying that architectures may need
to override this function, and when doing so, they will define their own
ftrace_cmp_recs.
-- Steve
^ permalink raw reply
* Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
From: Shuah Khan @ 2022-02-10 14:39 UTC (permalink / raw)
To: Aneesh Kumar K.V, linux-mm, akpm; +Cc: Shuah Khan, linuxppc-dev, Shuah Khan
In-Reply-To: <87zgmz9x7e.fsf@linux.ibm.com>
On 2/9/22 9:12 PM, Aneesh Kumar K.V wrote:
> Shuah Khan <skhan@linuxfoundation.org> writes:
>
>> On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote:
>>> Keep it simple by using a #define and limiting hugepage size to 2M.
>>> This keeps the test simpler instead of dynamically finding the page size
>>> and huge page size.
>>>
>>> Without this tests are broken w.r.t reading /proc/self/pagemap
>>>
>>> if (pread(pagemap_fd, ent, sizeof(ent),
>>> (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
>>> err(2, "read pagemap");
>>>
>>> Cc: Shuah Khan <shuah@kernel.org>
>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>> ---
>>> tools/testing/selftests/vm/ksm_tests.c | 8 ++++++++
>>> tools/testing/selftests/vm/transhuge-stress.c | 8 ++++++++
>>> 2 files changed, 16 insertions(+)
>>>
>>> diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
>>> index 1436e1a9a3d3..8200328ff018 100644
>>> --- a/tools/testing/selftests/vm/ksm_tests.c
>>> +++ b/tools/testing/selftests/vm/ksm_tests.c
>>> @@ -22,8 +22,16 @@
>>> #define KSM_MERGE_ACROSS_NODES_DEFAULT true
>>> #define MB (1ul << 20)
>>>
>>> +#ifdef __powerpc64__
>>> +#define PAGE_SHIFT 16
>>> +/*
>>> + * This will only work with radix 2M hugepage size
>>> + */
>>> +#define HPAGE_SHIFT 21
>>> +#else
>>> #define PAGE_SHIFT 12
>>> #define HPAGE_SHIFT 21
>>> +#endif
>>>
>>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>>> diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
>>> index 5e4c036f6ad3..f04c8aa4bcf6 100644
>>> --- a/tools/testing/selftests/vm/transhuge-stress.c
>>> +++ b/tools/testing/selftests/vm/transhuge-stress.c
>>> @@ -16,8 +16,16 @@
>>> #include <string.h>
>>> #include <sys/mman.h>
>>>
>>> +#ifdef __powerpc64__
>>> +#define PAGE_SHIFT 16
>>> +/*
>>> + * This will only work with radix 2M hugepage size
>>> + */
>>> +#define HPAGE_SHIFT 21
>>
>> Why not have this is in common code?
>
> Can you suggest where I can move that. We also have helper functions
> like allocate_transhuge() duplicated between tests. I didn't find
> libutil.a or anything similar supported by the selftets build.
>
>>
I noticed that HPAGE_SHIFT is defined in #ifdef __powerpc64__ block
as well as #else. I am asking is it necessary to be part of both
blocks.
+#ifdef __powerpc64__
+#define PAGE_SHIFT 16
+/*
+ * This will only work with radix 2M hugepage size
+ */
+#define HPAGE_SHIFT 21 --- this one
+#else
#define PAGE_SHIFT 12
#define HPAGE_SHIFT 21 --- this one
+#endif
Hope this helps.
thanks,
-- Shuah
^ permalink raw reply
* Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL
From: Naveen N. Rao @ 2022-02-10 13:58 UTC (permalink / raw)
To: Steven Rostedt
Cc: Daniel Borkmann, Yauheni Kaliuta, Jordan Niethe, linuxppc-dev,
bpf, Jiri Olsa, Alexei Starovoitov, Hari Bathini
In-Reply-To: <20220209161017.2bbdb01a@gandalf.local.home>
Steven Rostedt wrote:
> On Wed, 09 Feb 2022 17:50:09 +0000
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
>
>> However, I think we will not be able to use a fixed range. I would like
>> to reserve instructions from function entry till the branch to
>> _mcount(), and it can be two or four instructions depending on whether a
>> function has a global entry point. For this, I am considering adding a
>> field in 'struct dyn_arch_ftrace', and a hook in ftrace_process_locs()
>> to initialize the same. I may need to override ftrace_cmp_recs().
>
> Be careful about adding anything to dyn_arch_ftrace. powerpc already adds
> the pointer to the module. Anything you add to that gets multiplied by
> thousands of times (which takes up memory).
>
> At boot up you may see something like:
>
> ftrace: allocating 45363 entries in 178 pages
>
> That's 45,363 dyn_arch_ftrace structures. And each module loads their own
> as well. To see how many total you have after boot up:
>
>
> # cat /sys/kernel/tracing/dyn_ftrace_total_info
> 55974 pages:295 groups: 89
>
> That's from the same kernel. Another 10,000 entries were created by modules.
> (This was for x86_64)
>
> What you may be able to do, is to add a way to look at the already saved
> kallsyms, which keeps track of the function entry and exit to know how to
> map an address back to the function.
>
> kallsyms_lookup(addr, NULL, &offset, NULL, NULL);
>
> Should give you the offset of addr from the start of the function.
Good point. I should be able to overload the existing field for this
purpose. Is something like the below ok?
---
arch/powerpc/include/asm/ftrace.h | 13 ++++++
arch/powerpc/kernel/trace/ftrace.c | 73 ++++++++++++++++++++++++++----
kernel/trace/ftrace.c | 2 +
3 files changed, 78 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
index debe8c4f706260..96d6e26cee86af 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -59,6 +59,19 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
struct dyn_arch_ftrace {
struct module *mod;
};
+
+struct dyn_ftrace;
+struct module *ftrace_mod_addr_get(struct dyn_ftrace *rec);
+void ftrace_mod_addr_set(struct dyn_ftrace *rec, struct module *mod);
+
+#ifdef CONFIG_MPROFILE_KERNEL
+int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
+#define ftrace_init_nop ftrace_init_nop
+
+int ftrace_cmp_recs(const void *a, const void *b);
+#define ftrace_cmp_recs ftrace_cmp_recs
+#endif
+
#endif /* __ASSEMBLY__ */
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c
index 80b6285769f27c..d9b6faa4c98a8c 100644
--- a/arch/powerpc/kernel/trace/ftrace.c
+++ b/arch/powerpc/kernel/trace/ftrace.c
@@ -428,21 +428,21 @@ int ftrace_make_nop(struct module *mod,
* We should either already have a pointer to the module
* or it has been passed in.
*/
- if (!rec->arch.mod) {
+ if (!ftrace_mod_addr_get(rec)) {
if (!mod) {
pr_err("No module loaded addr=%lx\n", addr);
return -EFAULT;
}
- rec->arch.mod = mod;
+ ftrace_mod_addr_set(rec, mod);
} else if (mod) {
- if (mod != rec->arch.mod) {
+ if (mod != ftrace_mod_addr_get(rec)) {
pr_err("Record mod %p not equal to passed in mod %p\n",
- rec->arch.mod, mod);
+ ftrace_mod_addr_get(rec), mod);
return -EINVAL;
}
/* nothing to do if mod == rec->arch.mod */
} else
- mod = rec->arch.mod;
+ mod = ftrace_mod_addr_get(rec);
return __ftrace_make_nop(mod, rec, addr);
#else
@@ -451,6 +451,59 @@ int ftrace_make_nop(struct module *mod,
#endif /* CONFIG_MODULES */
}
+#ifdef CONFIG_MPROFILE_KERNEL
+struct module *ftrace_mod_addr_get(struct dyn_ftrace *rec)
+{
+ return (struct module *)((unsigned long)rec->arch.mod & ~0x1);
+}
+
+void ftrace_mod_addr_set(struct dyn_ftrace *rec, struct module *mod)
+{
+ rec->arch.mod = (struct module *)(((unsigned long)rec->arch.mod & 0x1) | (unsigned long)mod);
+}
+
+bool ftrace_location_has_gep(const struct dyn_ftrace *rec)
+{
+ return !!((unsigned long)rec->arch.mod & 0x1);
+}
+
+int ftrace_cmp_recs(const void *a, const void *b)
+{
+ const struct dyn_ftrace *key = a;
+ const struct dyn_ftrace *rec = b;
+ int offset = ftrace_location_has_gep(rec) ? 12 : 4;
+
+ if (key->flags < rec->ip - offset)
+ return -1;
+ if (key->ip >= rec->ip + MCOUNT_INSN_SIZE)
+ return 1;
+ return 0;
+}
+
+int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec)
+{
+ unsigned long offset;
+
+ if (!kallsyms_lookup_size_offset(rec->ip, NULL, &offset) || (offset != 12 && offset != 4)) {
+ /* TODO: implement logic to deduce lep/gep from code */
+ } else if (offset == 12) {
+ ftrace_mod_addr_set(rec, (struct module *)1);
+ }
+
+ return ftrace_make_nop(mod, rec, MCOUNT_ADDR);
+}
+#else
+struct module *ftrace_mod_addr_get(struct dyn_ftrace *rec)
+{
+ return rec->arch.mod;
+}
+
+void ftrace_mod_addr_set(struct dyn_ftrace *rec, struct module * mod)
+{
+ rec->arch.mod = mod;
+}
+#endif /* CONFIG_MPROFILE_KERNEL */
+
#ifdef CONFIG_MODULES
#ifdef CONFIG_PPC64
/*
@@ -494,7 +547,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
ppc_inst_t instr;
void *ip = (void *)rec->ip;
unsigned long entry, ptr, tramp;
- struct module *mod = rec->arch.mod;
+ struct module *mod = ftrace_mod_addr_get(rec);
/* read where this goes */
if (copy_inst_from_kernel_nofault(op, ip))
@@ -561,7 +614,7 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
int err;
ppc_inst_t op;
u32 *ip = (u32 *)rec->ip;
- struct module *mod = rec->arch.mod;
+ struct module *mod = ftrace_mod_addr_get(rec);
unsigned long tramp;
/* read where this goes */
@@ -678,7 +731,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
* Being that we are converting from nop, it had better
* already have a module defined.
*/
- if (!rec->arch.mod) {
+ if (!ftrace_mod_addr_get(rec)) {
pr_err("No module loaded\n");
return -EINVAL;
}
@@ -699,7 +752,7 @@ __ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
ppc_inst_t op;
unsigned long ip = rec->ip;
unsigned long entry, ptr, tramp;
- struct module *mod = rec->arch.mod;
+ struct module *mod = ftrace_mod_addr_get(rec);
/* If we never set up ftrace trampolines, then bail */
if (!mod->arch.tramp || !mod->arch.tramp_regs) {
@@ -814,7 +867,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
/*
* Out of range jumps are called from modules.
*/
- if (!rec->arch.mod) {
+ if (!ftrace_mod_addr_get(rec)) {
pr_err("No module loaded\n");
return -EINVAL;
}
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f9feb197b2daaf..68f20cf34b0c47 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1510,6 +1510,7 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
}
+#ifndef ftrace_cmp_recs
static int ftrace_cmp_recs(const void *a, const void *b)
{
const struct dyn_ftrace *key = a;
@@ -1521,6 +1522,7 @@ static int ftrace_cmp_recs(const void *a, const void *b)
return 1;
return 0;
}
+#endif
static struct dyn_ftrace *lookup_rec(unsigned long start, unsigned long end)
{
Thanks,
Naveen
^ permalink raw reply related
* Re: [powerpc] Warning mm/slub.c:3246 during boot (next-20220210) w/ext4
From: Ritesh Harjani @ 2022-02-10 13:49 UTC (permalink / raw)
To: Sachin Sant; +Cc: Ext4 Developers List, linuxppc-dev, Paul E. McKenney
In-Reply-To: <6CB9EFBC-1FD6-4486-8C64-8C47EE2A71D4@linux.ibm.com>
On 22/02/10 06:57PM, Sachin Sant wrote:
> While booting 5.17.0-rc3-next-20220210 on Power following warning
> is seen:
>
> [ 32.626501] EXT4-fs (sda2): re-mounted. Quota mode: none.
> [ 32.627225] ------------[ cut here ]------------
> [ 32.627236] WARNING: CPU: 27 PID: 1084 at mm/slub.c:3246 kmem_cache_alloc+0x3b0/0x680
> [ 32.627250] Modules linked in: ext4 mbcache jbd2 sd_mod t10_pi sg ipr tg3 libata ptp pps_core fuse
> [ 32.627273] CPU: 27 PID: 1084 Comm: kworker/u161:0 Not tainted 5.17.0-rc3-next-20220210 #17
> [ 32.627283] NIP: c000000000444df0 LR: c008000007fe6b44 CTR: c000000000444a40
> [ 32.627291] REGS: c000000052393480 TRAP: 0700 Not tainted (5.17.0-rc3-next-20220210)
> [ 32.627298] MSR: 9000000000029033 <SF,HV,EE,ME,IR,DR,RI,LE> CR: 44002822 XER: 20000000
> [ 32.627316] CFAR: c000000000444a6c IRQMASK: 0
> [ 32.627316] GPR00: c008000007fe6b44 c000000052393720 c000000002a06b00 c000000059660200
> [ 32.627316] GPR04: 0000000000000d40 0000000000000000 c00000004f735000 c000000050760618
> [ 32.627316] GPR08: 0000000000000001 0000000000080000 0000000000000038 c008000007fe7a70
> [ 32.627316] GPR12: c000000000444a40 c0000007fffe1a80 c00000000017a6b8 0000000000000000
> [ 32.627316] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> [ 32.627316] GPR20: 0000000000000041 c000000052393b78 c000000052393a88 0000000000000338
> [ 32.627316] GPR24: c0080000089706d8 c0080000089706d8 c00000004f735000 c008000008014a98
> [ 32.627316] GPR28: 0000000000008d40 0000000000000000 0000000000400000 0000000000000100
> [ 32.627398] NIP [c000000000444df0] kmem_cache_alloc+0x3b0/0x680
> [ 32.627406] LR [c008000007fe6b44] jbd2_journal_add_journal_head+0x13c/0x2b8 [jbd2]
> [ 32.627430] Call Trace:
> [ 32.627433] [c000000052393720] [c008000007fd0e18] start_this_handle+0x530/0x6b0 [jbd2] (unreliable)
> [ 32.627454] [c000000052393790] [0000000000000d40] 0xd40
> [ 32.627462] [c000000052393820] [c008000007fd36d8] jbd2_journal_get_write_access+0x80/0x110 [jbd2]
> [ 32.627482] [c000000052393860] [c0080000088c5640] __ext4_journal_get_write_access+0xb8/0x2d0 [ext4]
> [ 32.627528] [c000000052393910] [c0080000088d69b8] ext4_file_open+0x2e0/0x430 [ext4]
> [ 32.627571] [c0000000523939e0] [c000000000488cf0] do_dentry_open+0x170/0x4e0
> [ 32.627582] [c000000052393a30] [c0000000004aabfc] path_openat+0xedc/0x1560
> [ 32.627593] [c000000052393b30] [c0000000004ac634] do_filp_open+0xa4/0x130
> [ 32.627602] [c000000052393c70] [c000000000499c8c] do_open_execat+0x9c/0x2f0
> [ 32.627611] [c000000052393cc0] [c00000000049ad44] bprm_execve+0x184/0x7f0
> [ 32.627620] [c000000052393d80] [c00000000049c6d8] kernel_execve+0x1a8/0x240
> [ 32.627630] [c000000052393dd0] [c00000000017a838] call_usermodehelper_exec_async+0x188/0x2c0
> [ 32.627642] [c000000052393e10] [c00000000000ce64] ret_from_kernel_thread+0x5c/0x64
> [ 32.627652] Instruction dump:
> [ 32.627657] e90d0030 7d49402a 394affff 7d49412a 4bbd1f79 60000000 eae10028 eb610048
> [ 32.627672] 4bfffd80 60000000 60000000 60000000 <0fe00000> 7c0802a6 f8410018 fae10028
> [ 32.627686] ---[ end trace 0000000000000000 ]—
>
> This WARN_ONCE was introduced by following commit:
>
> commit 120aa5e574796c9a3ef5f22cdb391747da997a26
> mm: Check for SLAB_TYPESAFE_BY_RCU and __GFP_ZERO slab allocation
>
> The system has ext4 file system.
Yup, this is getting discussed in this thread [1] @ linux-ext4
[1]: https://lore.kernel.org/linux-ext4/20220210091648.w5wie3llqri5kfw3@quack3.lan/T/#m5f371e9910ee646e6361f484b2f12eab6aa47eeb
-ritesh
^ permalink raw reply
* [powerpc] Warning mm/slub.c:3246 during boot (next-20220210) w/ext4
From: Sachin Sant @ 2022-02-10 13:27 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: riteshh, linuxppc-dev, Paul E. McKenney
While booting 5.17.0-rc3-next-20220210 on Power following warning
is seen:
[ 32.626501] EXT4-fs (sda2): re-mounted. Quota mode: none.
[ 32.627225] ------------[ cut here ]------------
[ 32.627236] WARNING: CPU: 27 PID: 1084 at mm/slub.c:3246 kmem_cache_alloc+0x3b0/0x680
[ 32.627250] Modules linked in: ext4 mbcache jbd2 sd_mod t10_pi sg ipr tg3 libata ptp pps_core fuse
[ 32.627273] CPU: 27 PID: 1084 Comm: kworker/u161:0 Not tainted 5.17.0-rc3-next-20220210 #17
[ 32.627283] NIP: c000000000444df0 LR: c008000007fe6b44 CTR: c000000000444a40
[ 32.627291] REGS: c000000052393480 TRAP: 0700 Not tainted (5.17.0-rc3-next-20220210)
[ 32.627298] MSR: 9000000000029033 <SF,HV,EE,ME,IR,DR,RI,LE> CR: 44002822 XER: 20000000
[ 32.627316] CFAR: c000000000444a6c IRQMASK: 0
[ 32.627316] GPR00: c008000007fe6b44 c000000052393720 c000000002a06b00 c000000059660200
[ 32.627316] GPR04: 0000000000000d40 0000000000000000 c00000004f735000 c000000050760618
[ 32.627316] GPR08: 0000000000000001 0000000000080000 0000000000000038 c008000007fe7a70
[ 32.627316] GPR12: c000000000444a40 c0000007fffe1a80 c00000000017a6b8 0000000000000000
[ 32.627316] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 32.627316] GPR20: 0000000000000041 c000000052393b78 c000000052393a88 0000000000000338
[ 32.627316] GPR24: c0080000089706d8 c0080000089706d8 c00000004f735000 c008000008014a98
[ 32.627316] GPR28: 0000000000008d40 0000000000000000 0000000000400000 0000000000000100
[ 32.627398] NIP [c000000000444df0] kmem_cache_alloc+0x3b0/0x680
[ 32.627406] LR [c008000007fe6b44] jbd2_journal_add_journal_head+0x13c/0x2b8 [jbd2]
[ 32.627430] Call Trace:
[ 32.627433] [c000000052393720] [c008000007fd0e18] start_this_handle+0x530/0x6b0 [jbd2] (unreliable)
[ 32.627454] [c000000052393790] [0000000000000d40] 0xd40
[ 32.627462] [c000000052393820] [c008000007fd36d8] jbd2_journal_get_write_access+0x80/0x110 [jbd2]
[ 32.627482] [c000000052393860] [c0080000088c5640] __ext4_journal_get_write_access+0xb8/0x2d0 [ext4]
[ 32.627528] [c000000052393910] [c0080000088d69b8] ext4_file_open+0x2e0/0x430 [ext4]
[ 32.627571] [c0000000523939e0] [c000000000488cf0] do_dentry_open+0x170/0x4e0
[ 32.627582] [c000000052393a30] [c0000000004aabfc] path_openat+0xedc/0x1560
[ 32.627593] [c000000052393b30] [c0000000004ac634] do_filp_open+0xa4/0x130
[ 32.627602] [c000000052393c70] [c000000000499c8c] do_open_execat+0x9c/0x2f0
[ 32.627611] [c000000052393cc0] [c00000000049ad44] bprm_execve+0x184/0x7f0
[ 32.627620] [c000000052393d80] [c00000000049c6d8] kernel_execve+0x1a8/0x240
[ 32.627630] [c000000052393dd0] [c00000000017a838] call_usermodehelper_exec_async+0x188/0x2c0
[ 32.627642] [c000000052393e10] [c00000000000ce64] ret_from_kernel_thread+0x5c/0x64
[ 32.627652] Instruction dump:
[ 32.627657] e90d0030 7d49402a 394affff 7d49412a 4bbd1f79 60000000 eae10028 eb610048
[ 32.627672] 4bfffd80 60000000 60000000 60000000 <0fe00000> 7c0802a6 f8410018 fae10028
[ 32.627686] ---[ end trace 0000000000000000 ]—
This WARN_ONCE was introduced by following commit:
commit 120aa5e574796c9a3ef5f22cdb391747da997a26
mm: Check for SLAB_TYPESAFE_BY_RCU and __GFP_ZERO slab allocation
The system has ext4 file system.
Thanks
-Sachin
^ permalink raw reply
* [PATCH] powerpc/lib/sstep: fix 'ptesync' build error
From: Anders Roxell @ 2022-02-10 12:44 UTC (permalink / raw)
To: mpe; +Cc: Arnd Bergmann, Anders Roxell, linuxppc-dev, linux-kernel, stable
Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian
2.37.90.20220207) the following build error shows up:
{standard input}: Assembler messages:
{standard input}:2088: Error: unrecognized opcode: `ptesync'
make[3]: *** [/builds/linux/scripts/Makefile.build:287: arch/powerpc/lib/sstep.o] Error 1
Re-add the ifdef __powerpc64__ around the 'ptesync' in function
'emulate_update_regs()' to like it is in 'analyse_instr()'. Since it looks like
it got dropped inadvertently by commit 3cdfcbfd32b9 ("powerpc: Change
analyse_instr so it doesn't modify *regs").
Cc: stable@vger.kernel.org # v4.14+
Fixes: 3cdfcbfd32b9 ("powerpc: Change analyse_instr so it doesn't modify *regs")
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
arch/powerpc/lib/sstep.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index a94b0cd0bdc5..d23772f91a36 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -3264,12 +3264,14 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op)
case BARRIER_EIEIO:
eieio();
break;
+#ifdef __powerpc64__
case BARRIER_LWSYNC:
asm volatile("lwsync" : : : "memory");
break;
case BARRIER_PTESYNC:
asm volatile("ptesync" : : : "memory");
break;
+#endif
}
break;
--
2.34.1
^ permalink raw reply related
* [PATCH v2] scsi: ibmvfc: replace snprintf with sysfs_emit
From: davidcomponentone @ 2022-02-10 10:33 UTC (permalink / raw)
To: tyreld
Cc: linux-scsi, martin.petersen, jejb, davidcomponentone,
linux-kernel, Yang Guang, paulus, linuxppc-dev, Zeal Robot
From: Yang Guang <yang.guang5@zte.com.cn>
coccinelle report:
./drivers/scsi/ibmvscsi/ibmvfc.c:3453:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/ibmvscsi/ibmvfc.c:3416:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/ibmvscsi/ibmvfc.c:3436:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/ibmvscsi/ibmvfc.c:3426:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/ibmvscsi/ibmvfc.c:3445:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/ibmvscsi/ibmvfc.c:3406:8-16:
WARNING: use scnprintf or sprintf
Use sysfs_emit instead of scnprintf or sprintf makes more sense.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
Change from v1-v2:
- Adjust some format
---
drivers/scsi/ibmvscsi/ibmvfc.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index d0eab5700dc5..ec63c45bf66b 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -3403,8 +3403,7 @@ static ssize_t ibmvfc_show_host_partition_name(struct device *dev,
struct Scsi_Host *shost = class_to_shost(dev);
struct ibmvfc_host *vhost = shost_priv(shost);
- return snprintf(buf, PAGE_SIZE, "%s\n",
- vhost->login_buf->resp.partition_name);
+ return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.partition_name);
}
static ssize_t ibmvfc_show_host_device_name(struct device *dev,
@@ -3413,8 +3412,7 @@ static ssize_t ibmvfc_show_host_device_name(struct device *dev,
struct Scsi_Host *shost = class_to_shost(dev);
struct ibmvfc_host *vhost = shost_priv(shost);
- return snprintf(buf, PAGE_SIZE, "%s\n",
- vhost->login_buf->resp.device_name);
+ return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.device_name);
}
static ssize_t ibmvfc_show_host_loc_code(struct device *dev,
@@ -3423,8 +3421,7 @@ static ssize_t ibmvfc_show_host_loc_code(struct device *dev,
struct Scsi_Host *shost = class_to_shost(dev);
struct ibmvfc_host *vhost = shost_priv(shost);
- return snprintf(buf, PAGE_SIZE, "%s\n",
- vhost->login_buf->resp.port_loc_code);
+ return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.port_loc_code);
}
static ssize_t ibmvfc_show_host_drc_name(struct device *dev,
@@ -3433,8 +3430,7 @@ static ssize_t ibmvfc_show_host_drc_name(struct device *dev,
struct Scsi_Host *shost = class_to_shost(dev);
struct ibmvfc_host *vhost = shost_priv(shost);
- return snprintf(buf, PAGE_SIZE, "%s\n",
- vhost->login_buf->resp.drc_name);
+ return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.drc_name);
}
static ssize_t ibmvfc_show_host_npiv_version(struct device *dev,
@@ -3442,7 +3438,8 @@ static ssize_t ibmvfc_show_host_npiv_version(struct device *dev,
{
struct Scsi_Host *shost = class_to_shost(dev);
struct ibmvfc_host *vhost = shost_priv(shost);
- return snprintf(buf, PAGE_SIZE, "%d\n", be32_to_cpu(vhost->login_buf->resp.version));
+
+ return sysfs_emit(buf, "%u\n", be32_to_cpu(vhost->login_buf->resp.version));
}
static ssize_t ibmvfc_show_host_capabilities(struct device *dev,
@@ -3450,7 +3447,8 @@ static ssize_t ibmvfc_show_host_capabilities(struct device *dev,
{
struct Scsi_Host *shost = class_to_shost(dev);
struct ibmvfc_host *vhost = shost_priv(shost);
- return snprintf(buf, PAGE_SIZE, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities));
+
+ return sysfs_emit(buf, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities));
}
/**
@@ -3471,7 +3469,7 @@ static ssize_t ibmvfc_show_log_level(struct device *dev,
int len;
spin_lock_irqsave(shost->host_lock, flags);
- len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->log_level);
+ len = sysfs_emit(buf, "%d\n", vhost->log_level);
spin_unlock_irqrestore(shost->host_lock, flags);
return len;
}
@@ -3509,7 +3507,7 @@ static ssize_t ibmvfc_show_scsi_channels(struct device *dev,
int len;
spin_lock_irqsave(shost->host_lock, flags);
- len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->client_scsi_channels);
+ len = sysfs_emit(buf, "%d\n", vhost->client_scsi_channels);
spin_unlock_irqrestore(shost->host_lock, flags);
return len;
}
--
2.30.2
^ permalink raw reply related
* Re: [PATCH v3 08/12] asm-generic: Refactor dereference_[kernel]_function_descriptor()
From: Michael Ellerman @ 2022-02-10 10:30 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
Andrew Morton, James E.J. Bottomley, Helge Deller, Arnd Bergmann,
Kees Cook, Greg Kroah-Hartman
Cc: linux-arch, linux-ia64, linux-parisc, linux-kernel, linux-mm,
linuxppc-dev
In-Reply-To: <93a2006a5d90292baf69cb1c34af5785da53efde.1634457599.git.christophe.leroy@csgroup.eu>
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> diff --git a/kernel/extable.c b/kernel/extable.c
> index b0ea5eb0c3b4..1ef13789bea9 100644
> --- a/kernel/extable.c
> +++ b/kernel/extable.c
> @@ -159,12 +160,32 @@ int kernel_text_address(unsigned long addr)
> }
>
> /*
> - * On some architectures (PPC64, IA64) function pointers
> + * On some architectures (PPC64, IA64, PARISC) function pointers
> * are actually only tokens to some data that then holds the
> * real function address. As a result, to find if a function
> * pointer is part of the kernel text, we need to do some
> * special dereferencing first.
> */
> +#ifdef CONFIG_HAVE_FUNCTION_DESCRIPTORS
> +void *dereference_function_descriptor(void *ptr)
> +{
> + func_desc_t *desc = ptr;
> + void *p;
> +
> + if (!get_kernel_nofault(p, (void *)&desc->addr))
> + ptr = p;
> + return ptr;
> +}
This needs an EXPORT_SYMBOL_GPL(), otherwise the build breaks after
patch 10 with CONFIG_LKDTM=m.
cheers
^ permalink raw reply
* Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
From: Aneesh Kumar K.V @ 2022-02-10 5:35 UTC (permalink / raw)
To: Shuah Khan, linux-mm, akpm; +Cc: Shuah Khan, linuxppc-dev, Shuah Khan
In-Reply-To: <87zgmz9x7e.fsf@linux.ibm.com>
Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> writes:
> Shuah Khan <skhan@linuxfoundation.org> writes:
>
>> On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote:
>> --- a/tools/testing/selftests/vm/transhuge-stress.c
>>> +++ b/tools/testing/selftests/vm/transhuge-stress.c
>>> @@ -16,8 +16,16 @@
>>> #include <string.h>
>>> #include <sys/mman.h>
>>>
>>> +#ifdef __powerpc64__
>>> +#define PAGE_SHIFT 16
>>> +/*
>>> + * This will only work with radix 2M hugepage size
>>> + */
>>> +#define HPAGE_SHIFT 21
>>
>> Why not have this is in common code?
>
> Can you suggest where I can move that. We also have helper functions
> like allocate_transhuge() duplicated between tests. I didn't find
> libutil.a or anything similar supported by the selftets build.
>
>>
>>> +#else
>>> #define PAGE_SHIFT 12
>>> #define HPAGE_SHIFT 21
>>
I can do a util.h for vm related test as below.
commit 378fa2d73f1255d3045023875dd00d5b8486440e
Author: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Date: Thu Feb 10 10:22:27 2022 +0530
selftest/vm: Add util.h and and move helper functions there
Avoid code duplication by adding util.h
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
index 8200328ff018..fd85f15869d1 100644
--- a/tools/testing/selftests/vm/ksm_tests.c
+++ b/tools/testing/selftests/vm/ksm_tests.c
@@ -12,6 +12,7 @@
#include "../kselftest.h"
#include "../../../../include/vdso/time64.h"
+#include "util.h"
#define KSM_SYSFS_PATH "/sys/kernel/mm/ksm/"
#define KSM_FP(s) (KSM_SYSFS_PATH s)
@@ -22,23 +23,6 @@
#define KSM_MERGE_ACROSS_NODES_DEFAULT true
#define MB (1ul << 20)
-#ifdef __powerpc64__
-#define PAGE_SHIFT 16
-/*
- * This will only work with radix 2M hugepage size
- */
-#define HPAGE_SHIFT 21
-#else
-#define PAGE_SHIFT 12
-#define HPAGE_SHIFT 21
-#endif
-
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define HPAGE_SIZE (1 << HPAGE_SHIFT)
-
-#define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0)
-#define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1))
-
struct ksm_sysfs {
unsigned long max_page_sharing;
unsigned long merge_across_nodes;
@@ -464,34 +448,6 @@ static int check_ksm_numa_merge(int mapping, int prot, int timeout, bool merge_a
return KSFT_FAIL;
}
-int64_t allocate_transhuge(void *ptr, int pagemap_fd)
-{
- uint64_t ent[2];
-
- /* drop pmd */
- if (mmap(ptr, HPAGE_SIZE, PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_ANONYMOUS |
- MAP_NORESERVE | MAP_PRIVATE, -1, 0) != ptr)
- errx(2, "mmap transhuge");
-
- if (madvise(ptr, HPAGE_SIZE, MADV_HUGEPAGE))
- err(2, "MADV_HUGEPAGE");
-
- /* allocate transparent huge page */
- *(volatile void **)ptr = ptr;
-
- if (pread(pagemap_fd, ent, sizeof(ent),
- (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
- err(2, "read pagemap");
-
- if (PAGEMAP_PRESENT(ent[0]) && PAGEMAP_PRESENT(ent[1]) &&
- PAGEMAP_PFN(ent[0]) + 1 == PAGEMAP_PFN(ent[1]) &&
- !(PAGEMAP_PFN(ent[0]) & ((1 << (HPAGE_SHIFT - PAGE_SHIFT)) - 1)))
- return PAGEMAP_PFN(ent[0]);
-
- return -1;
-}
-
static int ksm_merge_hugepages_time(int mapping, int prot, int timeout, size_t map_size)
{
void *map_ptr, *map_ptr_orig;
diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
index f04c8aa4bcf6..0da4aa10746a 100644
--- a/tools/testing/selftests/vm/transhuge-stress.c
+++ b/tools/testing/selftests/vm/transhuge-stress.c
@@ -16,52 +16,7 @@
#include <string.h>
#include <sys/mman.h>
-#ifdef __powerpc64__
-#define PAGE_SHIFT 16
-/*
- * This will only work with radix 2M hugepage size
- */
-#define HPAGE_SHIFT 21
-#else
-#define PAGE_SHIFT 12
-#define HPAGE_SHIFT 21
-#endif
-
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define HPAGE_SIZE (1 << HPAGE_SHIFT)
-
-#define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0)
-#define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1))
-
-int pagemap_fd;
-
-int64_t allocate_transhuge(void *ptr)
-{
- uint64_t ent[2];
-
- /* drop pmd */
- if (mmap(ptr, HPAGE_SIZE, PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_ANONYMOUS |
- MAP_NORESERVE | MAP_PRIVATE, -1, 0) != ptr)
- errx(2, "mmap transhuge");
-
- if (madvise(ptr, HPAGE_SIZE, MADV_HUGEPAGE))
- err(2, "MADV_HUGEPAGE");
-
- /* allocate transparent huge page */
- *(volatile void **)ptr = ptr;
-
- if (pread(pagemap_fd, ent, sizeof(ent),
- (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
- err(2, "read pagemap");
-
- if (PAGEMAP_PRESENT(ent[0]) && PAGEMAP_PRESENT(ent[1]) &&
- PAGEMAP_PFN(ent[0]) + 1 == PAGEMAP_PFN(ent[1]) &&
- !(PAGEMAP_PFN(ent[0]) & ((1 << (HPAGE_SHIFT - PAGE_SHIFT)) - 1)))
- return PAGEMAP_PFN(ent[0]);
-
- return -1;
-}
+#include "util.h"
int main(int argc, char **argv)
{
@@ -71,6 +26,7 @@ int main(int argc, char **argv)
double s;
uint8_t *map;
size_t map_len;
+ int pagemap_fd;
ram = sysconf(_SC_PHYS_PAGES);
if (ram > SIZE_MAX / sysconf(_SC_PAGESIZE) / 4)
@@ -117,7 +73,7 @@ int main(int argc, char **argv)
for (p = ptr; p < ptr + len; p += HPAGE_SIZE) {
int64_t pfn;
- pfn = allocate_transhuge(p);
+ pfn = allocate_transhuge(p, pagemap_fd);
if (pfn < 0) {
nr_failed++;
diff --git a/tools/testing/selftests/vm/util.h b/tools/testing/selftests/vm/util.h
new file mode 100644
index 000000000000..1461a96f0bc0
--- /dev/null
+++ b/tools/testing/selftests/vm/util.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __KSELFTEST_VM_UTIL_H
+#define __KSELFTEST_VM_UTIL_H
+
+#include <sys/mman.h>
+#include <err.h>
+
+#ifdef __powerpc64__
+#define PAGE_SHIFT 16
+/*
+ * This will only work with radix 2M hugepage size
+ */
+#define HPAGE_SHIFT 21
+#else
+#define PAGE_SHIFT 12
+#define HPAGE_SHIFT 21
+#endif
+
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#define HPAGE_SIZE (1 << HPAGE_SHIFT)
+
+#define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0)
+#define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1))
+
+
+static inline int64_t allocate_transhuge(void *ptr, int pagemap_fd)
+{
+ uint64_t ent[2];
+
+ /* drop pmd */
+ if (mmap(ptr, HPAGE_SIZE, PROT_READ | PROT_WRITE,
+ MAP_FIXED | MAP_ANONYMOUS |
+ MAP_NORESERVE | MAP_PRIVATE, -1, 0) != ptr)
+ errx(2, "mmap transhuge");
+
+ if (madvise(ptr, HPAGE_SIZE, MADV_HUGEPAGE))
+ err(2, "MADV_HUGEPAGE");
+
+ /* allocate transparent huge page */
+ *(volatile void **)ptr = ptr;
+
+ if (pread(pagemap_fd, ent, sizeof(ent),
+ (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
+ err(2, "read pagemap");
+
+ if (PAGEMAP_PRESENT(ent[0]) && PAGEMAP_PRESENT(ent[1]) &&
+ PAGEMAP_PFN(ent[0]) + 1 == PAGEMAP_PFN(ent[1]) &&
+ !(PAGEMAP_PFN(ent[0]) & ((1 << (HPAGE_SHIFT - PAGE_SHIFT)) - 1)))
+ return PAGEMAP_PFN(ent[0]);
+
+ return -1;
+}
+
+#endif
^ permalink raw reply related
* Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
From: Aneesh Kumar K.V @ 2022-02-10 4:12 UTC (permalink / raw)
To: Shuah Khan, linux-mm, akpm; +Cc: Shuah Khan, linuxppc-dev, Shuah Khan
In-Reply-To: <84508bb4-9400-f429-e6d2-d8b05a1e8368@linuxfoundation.org>
Shuah Khan <skhan@linuxfoundation.org> writes:
> On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote:
>> Keep it simple by using a #define and limiting hugepage size to 2M.
>> This keeps the test simpler instead of dynamically finding the page size
>> and huge page size.
>>
>> Without this tests are broken w.r.t reading /proc/self/pagemap
>>
>> if (pread(pagemap_fd, ent, sizeof(ent),
>> (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
>> err(2, "read pagemap");
>>
>> Cc: Shuah Khan <shuah@kernel.org>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>> tools/testing/selftests/vm/ksm_tests.c | 8 ++++++++
>> tools/testing/selftests/vm/transhuge-stress.c | 8 ++++++++
>> 2 files changed, 16 insertions(+)
>>
>> diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
>> index 1436e1a9a3d3..8200328ff018 100644
>> --- a/tools/testing/selftests/vm/ksm_tests.c
>> +++ b/tools/testing/selftests/vm/ksm_tests.c
>> @@ -22,8 +22,16 @@
>> #define KSM_MERGE_ACROSS_NODES_DEFAULT true
>> #define MB (1ul << 20)
>>
>> +#ifdef __powerpc64__
>> +#define PAGE_SHIFT 16
>> +/*
>> + * This will only work with radix 2M hugepage size
>> + */
>> +#define HPAGE_SHIFT 21
>> +#else
>> #define PAGE_SHIFT 12
>> #define HPAGE_SHIFT 21
>> +#endif
>>
>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>> diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
>> index 5e4c036f6ad3..f04c8aa4bcf6 100644
>> --- a/tools/testing/selftests/vm/transhuge-stress.c
>> +++ b/tools/testing/selftests/vm/transhuge-stress.c
>> @@ -16,8 +16,16 @@
>> #include <string.h>
>> #include <sys/mman.h>
>>
>> +#ifdef __powerpc64__
>> +#define PAGE_SHIFT 16
>> +/*
>> + * This will only work with radix 2M hugepage size
>> + */
>> +#define HPAGE_SHIFT 21
>
> Why not have this is in common code?
Can you suggest where I can move that. We also have helper functions
like allocate_transhuge() duplicated between tests. I didn't find
libutil.a or anything similar supported by the selftets build.
>
>> +#else
>> #define PAGE_SHIFT 12
>> #define HPAGE_SHIFT 21
>
> Same here.
>
>> +#endif
>>
>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>>
>
> Please cc linux-kselftest mailing list in the future.
>
> With the above fixed.
>
> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
>
> thanks,
> -- Shuah
-aneesh
^ permalink raw reply
* Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL
From: Steven Rostedt @ 2022-02-09 21:10 UTC (permalink / raw)
To: Naveen N. Rao
Cc: Daniel Borkmann, Yauheni Kaliuta, Jordan Niethe, linuxppc-dev,
bpf, Jiri Olsa, Alexei Starovoitov, Hari Bathini
In-Reply-To: <1644426751.786cjrgqey.naveen@linux.ibm.com>
On Wed, 09 Feb 2022 17:50:09 +0000
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> However, I think we will not be able to use a fixed range. I would like
> to reserve instructions from function entry till the branch to
> _mcount(), and it can be two or four instructions depending on whether a
> function has a global entry point. For this, I am considering adding a
> field in 'struct dyn_arch_ftrace', and a hook in ftrace_process_locs()
> to initialize the same. I may need to override ftrace_cmp_recs().
Be careful about adding anything to dyn_arch_ftrace. powerpc already adds
the pointer to the module. Anything you add to that gets multiplied by
thousands of times (which takes up memory).
At boot up you may see something like:
ftrace: allocating 45363 entries in 178 pages
That's 45,363 dyn_arch_ftrace structures. And each module loads their own
as well. To see how many total you have after boot up:
# cat /sys/kernel/tracing/dyn_ftrace_total_info
55974 pages:295 groups: 89
That's from the same kernel. Another 10,000 entries were created by modules.
(This was for x86_64)
What you may be able to do, is to add a way to look at the already saved
kallsyms, which keeps track of the function entry and exit to know how to
map an address back to the function.
kallsyms_lookup(addr, NULL, &offset, NULL, NULL);
Should give you the offset of addr from the start of the function.
-- Steve
^ permalink raw reply
* [PATCH v3 0/5] Improve KVM's interaction with CPU hotplug
From: Chao Gao @ 2022-02-09 7:41 UTC (permalink / raw)
To: kvm, seanjc, pbonzini, kevin.tian, tglx
Cc: Daniel Lezcano, Catalin Marinas, David Hildenbrand,
Maciej S. Szmigiero, Dave Hansen, x86, linux-mips, Paul Mackerras,
H. Peter Anvin, Wanpeng Li, Alexander Gordeev, Claudio Imbrenda,
Will Deacon, kvmarm, linux-s390, Janosch Frank, Anup Patel,
Joerg Roedel, Huacai Chen, linux-riscv, Aleksandar Markovic,
Ingo Molnar, Darrick J. Wong, Palmer Dabbelt,
Christian Borntraeger, Chao Gao, Ravi Bangoria, Albert Ou,
Vasily Gorbik, Suzuki K Poulose, Heiko Carstens, John Garry,
Nicholas Piggin, Shaokun Zhang, Tom Zanussi, Borislav Petkov,
Paul Walmsley, Atish Patra, Sumanth Korikkar, Alexandru Elisei,
linux-arm-kernel, Jim Mattson, Thomas Bogendoerfer, Fabiano Rosas,
Mel Gorman, Thomas Richter, Nick Desaulniers, linux-kernel,
Bharata B Rao, James Morse, kvm-riscv, Marc Zyngier,
Vitaly Kuznetsov, linuxppc-dev
Changes from v2->v3:
- rebased to the latest kvm/next branch.
- patch 1: rename {svm,vmx}_check_processor_compat to follow the name
convention
- patch 3: newly added to provide more information when hardware enabling
fails
- patch 4: reset hardware_enable_failed if hardware enabling fails. And
remove redundent kernel log.
- patch 5: add a pr_err() for setup_vmcs_config() path.
Changes from v1->v2: (all comments/suggestions on v1 are from Sean, thanks)
- Merged v1's patch 2 into patch 1, and v1's patch 5 into patch 6.
- Use static_call for check_processor_compatibility().
- Generate patch 2 with "git revert" and do manual changes based on that.
- Loosen the WARN_ON() in kvm_arch_check_processor_compat() instead of
removing it.
- KVM always prevent incompatible CPUs from being brought up regardless of
running VMs.
- Use pr_warn instead of pr_info to emit logs when KVM finds offending
CPUs.
KVM registers its CPU hotplug callback to CPU starting section. And in the
callback, KVM enables hardware virtualization on hotplugged CPUs if any VM
is running on existing CPUs.
There are two problems in the process:
1. KVM doesn't do compatibility checks before enabling hardware
virtualization on hotplugged CPUs. This may cause #GP if VMX isn't
supported or vmentry failure if some in-use VMX features are missing on
hotplugged CPUs. Both break running VMs.
2. Callbacks in CPU STARTING section cannot fail. So, even if KVM finds
some incompatible CPUs, its callback cannot block CPU hotplug.
This series improves KVM's interaction with CPU hotplug to avoid
incompatible CPUs breaking running VMs. Following changes are made:
1. move KVM's CPU hotplug callback to ONLINE section (suggested by Thomas)
2. do compatibility checks on hotplugged CPUs.
3. abort onlining incompatible CPUs
This series is a follow-up to the discussion about KVM and CPU hotplug
https://lore.kernel.org/lkml/3d3296f0-9245-40f9-1b5a-efffdb082de9@redhat.com/T/
Note: this series is tested only on Intel systems.
Chao Gao (4):
KVM: x86: Move check_processor_compatibility from init ops to runtime
ops
Partially revert "KVM: Pass kvm_init()'s opaque param to additional
arch funcs"
KVM: Rename and move CPUHP_AP_KVM_STARTING to ONLINE section
KVM: Do compatibility checks on hotplugged CPUs
Sean Christopherson (1):
KVM: Provide more information in kernel log if hardware enabling fails
arch/arm64/kvm/arm.c | 2 +-
arch/mips/kvm/mips.c | 2 +-
arch/powerpc/kvm/powerpc.c | 2 +-
arch/riscv/kvm/main.c | 2 +-
arch/s390/kvm/kvm-s390.c | 2 +-
arch/x86/include/asm/kvm-x86-ops.h | 1 +
arch/x86/include/asm/kvm_host.h | 2 +-
arch/x86/kvm/svm/svm.c | 4 +-
arch/x86/kvm/vmx/evmcs.c | 2 +-
arch/x86/kvm/vmx/evmcs.h | 2 +-
arch/x86/kvm/vmx/vmx.c | 22 +++++----
arch/x86/kvm/x86.c | 16 +++++--
include/linux/cpuhotplug.h | 2 +-
include/linux/kvm_host.h | 2 +-
virt/kvm/kvm_main.c | 73 +++++++++++++++++++-----------
15 files changed, 83 insertions(+), 53 deletions(-)
--
2.25.1
^ permalink raw reply
* Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
From: Shuah Khan @ 2022-02-09 19:53 UTC (permalink / raw)
To: Aneesh Kumar K.V, linux-mm, akpm; +Cc: Shuah Khan, linuxppc-dev, Shuah Khan
In-Reply-To: <20220209154301.42024-1-aneesh.kumar@linux.ibm.com>
On 2/9/22 8:43 AM, Aneesh Kumar K.V wrote:
> Keep it simple by using a #define and limiting hugepage size to 2M.
> This keeps the test simpler instead of dynamically finding the page size
> and huge page size.
>
> Without this tests are broken w.r.t reading /proc/self/pagemap
>
> if (pread(pagemap_fd, ent, sizeof(ent),
> (uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
> err(2, "read pagemap");
>
> Cc: Shuah Khan <shuah@kernel.org>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
> tools/testing/selftests/vm/ksm_tests.c | 8 ++++++++
> tools/testing/selftests/vm/transhuge-stress.c | 8 ++++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
> index 1436e1a9a3d3..8200328ff018 100644
> --- a/tools/testing/selftests/vm/ksm_tests.c
> +++ b/tools/testing/selftests/vm/ksm_tests.c
> @@ -22,8 +22,16 @@
> #define KSM_MERGE_ACROSS_NODES_DEFAULT true
> #define MB (1ul << 20)
>
> +#ifdef __powerpc64__
> +#define PAGE_SHIFT 16
> +/*
> + * This will only work with radix 2M hugepage size
> + */
> +#define HPAGE_SHIFT 21
> +#else
> #define PAGE_SHIFT 12
> #define HPAGE_SHIFT 21
> +#endif
>
> #define PAGE_SIZE (1 << PAGE_SHIFT)
> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
> diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
> index 5e4c036f6ad3..f04c8aa4bcf6 100644
> --- a/tools/testing/selftests/vm/transhuge-stress.c
> +++ b/tools/testing/selftests/vm/transhuge-stress.c
> @@ -16,8 +16,16 @@
> #include <string.h>
> #include <sys/mman.h>
>
> +#ifdef __powerpc64__
> +#define PAGE_SHIFT 16
> +/*
> + * This will only work with radix 2M hugepage size
> + */
> +#define HPAGE_SHIFT 21
Why not have this is in common code?
> +#else
> #define PAGE_SHIFT 12
> #define HPAGE_SHIFT 21
Same here.
> +#endif
>
> #define PAGE_SIZE (1 << PAGE_SHIFT)
> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>
Please cc linux-kselftest mailing list in the future.
With the above fixed.
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
thanks,
-- Shuah
^ permalink raw reply
* Re: [PATCH v3 2/5] Partially revert "KVM: Pass kvm_init()'s opaque param to additional arch funcs"
From: Sean Christopherson @ 2022-02-09 19:52 UTC (permalink / raw)
To: Chao Gao
Cc: x86, Wanpeng Li, kvm, David Hildenbrand, Paul Walmsley,
linux-mips, Paul Mackerras, H. Peter Anvin, Alexander Gordeev,
Claudio Imbrenda, Will Deacon, Maciej S. Szmigiero, linux-s390,
Janosch Frank, Marc Zyngier, Joerg Roedel, Huacai Chen,
linux-riscv, kvmarm, Dave Hansen, Aleksandar Markovic,
Ingo Molnar, Catalin Marinas, Palmer Dabbelt,
Christian Borntraeger, Ravi Bangoria, kevin.tian, Albert Ou,
Vasily Gorbik, Suzuki K Poulose, Heiko Carstens, Borislav Petkov,
Atish Patra, tglx, Alexandru Elisei, linux-arm-kernel,
Jim Mattson, Juergen Gross, Thomas Bogendoerfer, Fabiano Rosas,
Nick Desaulniers, linux-kernel, Bharata B Rao, James Morse,
kvm-riscv, Anup Patel, pbonzini, Vitaly Kuznetsov, linuxppc-dev
In-Reply-To: <20220209074109.453116-3-chao.gao@intel.com>
On Wed, Feb 09, 2022, Chao Gao wrote:
> This partially reverts commit b99040853738 ("KVM: Pass kvm_init()'s opaque
> param to additional arch funcs") remove opaque from
> kvm_arch_check_processor_compat because no one uses this opaque now.
> Address conflicts for ARM (due to file movement) and manually handle RISC-V
> which comes after the commit.
>
> And changes about kvm_arch_hardware_setup() in original commit are still
> needed so they are not reverted.
>
> Signed-off-by: Chao Gao <chao.gao@intel.com>
> ---
Reviewed-by: Sean Christopherson <seanjc@google.com>
^ permalink raw reply
* Re: [RFC PATCH 2/3] powerpc/ftrace: Override ftrace_location_lookup() for MPROFILE_KERNEL
From: Naveen N. Rao @ 2022-02-09 17:50 UTC (permalink / raw)
To: Steven Rostedt
Cc: Daniel Borkmann, Yauheni Kaliuta, Jordan Niethe, linuxppc-dev,
bpf, Jiri Olsa, Alexei Starovoitov, Hari Bathini
In-Reply-To: <20220207102454.41b1d6b5@gandalf.local.home>
Steven Rostedt wrote:
> On Mon, 7 Feb 2022 12:37:21 +0530
> "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
>
>> --- a/arch/powerpc/kernel/trace/ftrace.c
>> +++ b/arch/powerpc/kernel/trace/ftrace.c
>> @@ -1137,3 +1137,14 @@ char *arch_ftrace_match_adjust(char *str, const char *search)
>> return str;
>> }
>> #endif /* PPC64_ELF_ABI_v1 */
>> +
>> +#ifdef CONFIG_MPROFILE_KERNEL
>> +unsigned long ftrace_location_lookup(unsigned long ip)
>> +{
>> + /*
>> + * Per livepatch.h, ftrace location is always within the first
>> + * 16 bytes of a function on powerpc with -mprofile-kernel.
>> + */
>> + return ftrace_location_range(ip, ip + 16);
>
> I think this is the wrong approach for the implementation and error prone.
>
>> +}
>> +#endif
>> --
>
> What I believe is a safer approach is to use the record address and add the
> range to it.
>
> That is, you know that the ftrace modification site is a range (multiple
> instructions), where in the ftrace infrastructure, only one ip represents
> that range. What you want is if you pass in an ip, and that ip is within
> that range, you return the ip that represents that range to ftrace.
>
> It looks like we need to change the compare function in the bsearch.
>
> Perhaps add a new macro to define the size of the range to be searched,
> instead of just using MCOUNT_INSN_SIZE? Then we may not even need this new
> lookup function?
>
> static int ftrace_cmp_recs(const void *a, const void *b)
> {
> const struct dyn_ftrace *key = a;
> const struct dyn_ftrace *rec = b;
>
> if (key->flags < rec->ip)
> return -1;
> if (key->ip >= rec->ip + ARCH_IP_SIZE)
> return 1;
> return 0;
> }
>
> Where ARCH_IP_SIZE is defined to MCOUNT_INSN_SIZE by default, but an arch
> could define it to something else, like 16.
>
> Would that work for you, or am I missing something?
Yes, I hadn't realized that [un]register_ftrace_direct() and
modify_ftrace_direct() internally lookup the correct ftrace location,
and act on that. So, changing ftrace_cmp_recs() does look like it will
work well for powerpc. Thanks for this suggestion.
However, I think we will not be able to use a fixed range. I would like
to reserve instructions from function entry till the branch to
_mcount(), and it can be two or four instructions depending on whether a
function has a global entry point. For this, I am considering adding a
field in 'struct dyn_arch_ftrace', and a hook in ftrace_process_locs()
to initialize the same. I may need to override ftrace_cmp_recs().
Thanks,
- Naveen
^ permalink raw reply
* [PATCH v2 6/7] soc: fsl: guts: drop platform driver
From: Michael Walle @ 2022-02-09 16:32 UTC (permalink / raw)
To: linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Ulf Hansson, Arnd Bergmann, Li Yang, Michael Walle, Sudeep Holla,
Dan Carpenter
In-Reply-To: <20220209163242.430265-1-michael@walle.cc>
This driver cannot be unloaded and it will be needed very early in the
boot process because other driver (weakly) depend on it (eg. for chip
errata handling). Drop all the platform driver and devres stuff and
simply make it a core_initcall.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/soc/fsl/guts.c | 134 ++++++++++++++++++++++-------------------
1 file changed, 71 insertions(+), 63 deletions(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 13d07cc19f45..370be923aa0f 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -110,21 +110,59 @@ static const struct fsl_soc_die_attr *fsl_soc_die_match(
return NULL;
}
-static int fsl_guts_probe(struct platform_device *pdev)
+/*
+ * Table for matching compatible strings, for device tree
+ * guts node, for Freescale QorIQ SOCs.
+ */
+static const struct of_device_id fsl_guts_of_match[] = {
+ { .compatible = "fsl,qoriq-device-config-1.0", },
+ { .compatible = "fsl,qoriq-device-config-2.0", },
+ { .compatible = "fsl,p1010-guts", },
+ { .compatible = "fsl,p1020-guts", },
+ { .compatible = "fsl,p1021-guts", },
+ { .compatible = "fsl,p1022-guts", },
+ { .compatible = "fsl,p1023-guts", },
+ { .compatible = "fsl,p2020-guts", },
+ { .compatible = "fsl,bsc9131-guts", },
+ { .compatible = "fsl,bsc9132-guts", },
+ { .compatible = "fsl,mpc8536-guts", },
+ { .compatible = "fsl,mpc8544-guts", },
+ { .compatible = "fsl,mpc8548-guts", },
+ { .compatible = "fsl,mpc8568-guts", },
+ { .compatible = "fsl,mpc8569-guts", },
+ { .compatible = "fsl,mpc8572-guts", },
+ { .compatible = "fsl,ls1021a-dcfg", },
+ { .compatible = "fsl,ls1043a-dcfg", },
+ { .compatible = "fsl,ls2080a-dcfg", },
+ { .compatible = "fsl,ls1088a-dcfg", },
+ { .compatible = "fsl,ls1012a-dcfg", },
+ { .compatible = "fsl,ls1046a-dcfg", },
+ { .compatible = "fsl,lx2160a-dcfg", },
+ { .compatible = "fsl,ls1028a-dcfg", },
+ {}
+};
+
+static int __init fsl_guts_init(void)
{
- struct device_node *np = pdev->dev.of_node;
struct soc_device_attribute *soc_dev_attr;
static struct soc_device *soc_dev;
- struct device *dev = &pdev->dev;
const struct fsl_soc_die_attr *soc_die;
struct ccsr_guts __iomem *regs;
const char *machine = NULL;
+ struct device_node *np;
bool little_endian;
u32 svr;
+ int ret;
+
+ np = of_find_matching_node_and_match(NULL, fsl_guts_of_match, NULL);
+ if (!np)
+ return 0;
regs = of_iomap(np, 0);
- if (IS_ERR(regs))
+ if (IS_ERR(regs)) {
+ of_node_put(np);
return PTR_ERR(regs);
+ }
little_endian = of_property_read_bool(np, "little-endian");
if (little_endian)
@@ -132,92 +170,62 @@ static int fsl_guts_probe(struct platform_device *pdev)
else
svr = ioread32be(®s->svr);
iounmap(regs);
+ of_node_put(np);
/* Register soc device */
- soc_dev_attr = devm_kzalloc(dev, sizeof(*soc_dev_attr), GFP_KERNEL);
+ soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr)
return -ENOMEM;
if (of_property_read_string(of_root, "model", &machine))
of_property_read_string_index(of_root, "compatible", 0, &machine);
if (machine) {
- soc_dev_attr->machine = devm_kstrdup(dev, machine, GFP_KERNEL);
+ soc_dev_attr->machine = kstrdup(machine, GFP_KERNEL);
if (!soc_dev_attr->machine)
- return -ENOMEM;
+ goto err_nomem;
}
soc_die = fsl_soc_die_match(svr, fsl_soc_die);
if (soc_die) {
- soc_dev_attr->family = devm_kasprintf(dev, GFP_KERNEL,
- "QorIQ %s", soc_die->die);
+ soc_dev_attr->family = kasprintf(GFP_KERNEL, "QorIQ %s",
+ soc_die->die);
} else {
- soc_dev_attr->family = devm_kasprintf(dev, GFP_KERNEL, "QorIQ");
+ soc_dev_attr->family = kasprintf(GFP_KERNEL, "QorIQ");
}
if (!soc_dev_attr->family)
- return -ENOMEM;
- soc_dev_attr->soc_id = devm_kasprintf(dev, GFP_KERNEL,
- "svr:0x%08x", svr);
+ goto err_nomem;
+
+ soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "svr:0x%08x", svr);
if (!soc_dev_attr->soc_id)
- return -ENOMEM;
- soc_dev_attr->revision = devm_kasprintf(dev, GFP_KERNEL, "%d.%d",
- (svr >> 4) & 0xf, svr & 0xf);
+ goto err_nomem;
+
+ soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d",
+ (svr >> 4) & 0xf, svr & 0xf);
if (!soc_dev_attr->revision)
- return -ENOMEM;
+ goto err_nomem;
soc_dev = soc_device_register(soc_dev_attr);
- if (IS_ERR(soc_dev))
- return PTR_ERR(soc_dev);
+ if (IS_ERR(soc_dev)) {
+ ret = PTR_ERR(soc_dev);
+ goto err;
+ }
pr_info("Machine: %s\n", soc_dev_attr->machine);
pr_info("SoC family: %s\n", soc_dev_attr->family);
pr_info("SoC ID: %s, Revision: %s\n",
soc_dev_attr->soc_id, soc_dev_attr->revision);
- return 0;
-}
-/*
- * Table for matching compatible strings, for device tree
- * guts node, for Freescale QorIQ SOCs.
- */
-static const struct of_device_id fsl_guts_of_match[] = {
- { .compatible = "fsl,qoriq-device-config-1.0", },
- { .compatible = "fsl,qoriq-device-config-2.0", },
- { .compatible = "fsl,p1010-guts", },
- { .compatible = "fsl,p1020-guts", },
- { .compatible = "fsl,p1021-guts", },
- { .compatible = "fsl,p1022-guts", },
- { .compatible = "fsl,p1023-guts", },
- { .compatible = "fsl,p2020-guts", },
- { .compatible = "fsl,bsc9131-guts", },
- { .compatible = "fsl,bsc9132-guts", },
- { .compatible = "fsl,mpc8536-guts", },
- { .compatible = "fsl,mpc8544-guts", },
- { .compatible = "fsl,mpc8548-guts", },
- { .compatible = "fsl,mpc8568-guts", },
- { .compatible = "fsl,mpc8569-guts", },
- { .compatible = "fsl,mpc8572-guts", },
- { .compatible = "fsl,ls1021a-dcfg", },
- { .compatible = "fsl,ls1043a-dcfg", },
- { .compatible = "fsl,ls2080a-dcfg", },
- { .compatible = "fsl,ls1088a-dcfg", },
- { .compatible = "fsl,ls1012a-dcfg", },
- { .compatible = "fsl,ls1046a-dcfg", },
- { .compatible = "fsl,lx2160a-dcfg", },
- { .compatible = "fsl,ls1028a-dcfg", },
- {}
-};
-MODULE_DEVICE_TABLE(of, fsl_guts_of_match);
+ return 0;
-static struct platform_driver fsl_guts_driver = {
- .driver = {
- .name = "fsl-guts",
- .of_match_table = fsl_guts_of_match,
- },
- .probe = fsl_guts_probe,
-};
+err_nomem:
+ ret = -ENOMEM;
+err:
+ kfree(soc_dev_attr->machine);
+ kfree(soc_dev_attr->family);
+ kfree(soc_dev_attr->soc_id);
+ kfree(soc_dev_attr->revision);
+ kfree(soc_dev_attr);
-static int __init fsl_guts_init(void)
-{
- return platform_driver_register(&fsl_guts_driver);
+ return ret;
}
core_initcall(fsl_guts_init);
--
2.30.2
^ permalink raw reply related
* [PATCH v2 5/7] soc: fsl: guts: use of_root instead of own reference
From: Michael Walle @ 2022-02-09 16:32 UTC (permalink / raw)
To: linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Ulf Hansson, Arnd Bergmann, Li Yang, Michael Walle, Sudeep Holla,
Dan Carpenter
In-Reply-To: <20220209163242.430265-1-michael@walle.cc>
There is already a global of_root reference. Use that instead of getting
one on our own. We don't need to care about the reference count either
this way.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/soc/fsl/guts.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index f992064a7f58..13d07cc19f45 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -112,7 +112,7 @@ static const struct fsl_soc_die_attr *fsl_soc_die_match(
static int fsl_guts_probe(struct platform_device *pdev)
{
- struct device_node *root, *np = pdev->dev.of_node;
+ struct device_node *np = pdev->dev.of_node;
struct soc_device_attribute *soc_dev_attr;
static struct soc_device *soc_dev;
struct device *dev = &pdev->dev;
@@ -138,17 +138,13 @@ static int fsl_guts_probe(struct platform_device *pdev)
if (!soc_dev_attr)
return -ENOMEM;
- root = of_find_node_by_path("/");
- if (of_property_read_string(root, "model", &machine))
- of_property_read_string_index(root, "compatible", 0, &machine);
+ if (of_property_read_string(of_root, "model", &machine))
+ of_property_read_string_index(of_root, "compatible", 0, &machine);
if (machine) {
soc_dev_attr->machine = devm_kstrdup(dev, machine, GFP_KERNEL);
- if (!soc_dev_attr->machine) {
- of_node_put(root);
+ if (!soc_dev_attr->machine)
return -ENOMEM;
- }
}
- of_node_put(root);
soc_die = fsl_soc_die_match(svr, fsl_soc_die);
if (soc_die) {
--
2.30.2
^ permalink raw reply related
* [PATCH v2 7/7] soc: fsl: guts: add serial_number support
From: Michael Walle @ 2022-02-09 16:32 UTC (permalink / raw)
To: linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Ulf Hansson, Arnd Bergmann, Li Yang, Michael Walle, Sudeep Holla,
Dan Carpenter
In-Reply-To: <20220209163242.430265-1-michael@walle.cc>
Most layerscapes provide a security fuse processor where the vendor
will store a unique id per part. Unfortunately, we cannot use the
corresponding efuse driver because this driver needs to be ready
early during the boot phase. To get the unique identifier, we just
need to access two registers. Thus we just search the device tree
for the corresponding device, map its memory to read the id and then
unmap it again.
Because it is likely that the offset within the fuses is dependent
on the SoC, we need a per SoC data. Also, the compatible string is
different among the SoCs. For now, this add support for the LS1028A
SoC.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/soc/fsl/guts.c | 48 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 370be923aa0f..27035de062f8 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -20,6 +20,11 @@ struct fsl_soc_die_attr {
u32 mask;
};
+struct fsl_soc_data {
+ const char *sfp_compat;
+ u32 uid_offset;
+};
+
/* SoC die attribute definition for QorIQ platform */
static const struct fsl_soc_die_attr fsl_soc_die[] = {
/*
@@ -110,6 +115,33 @@ static const struct fsl_soc_die_attr *fsl_soc_die_match(
return NULL;
}
+static u64 fsl_guts_get_soc_uid(const char *compat, unsigned int offset)
+{
+ struct device_node *np;
+ void __iomem *sfp_base;
+ u64 uid;
+
+ np = of_find_compatible_node(NULL, NULL, compat);
+ if (!np)
+ return 0;
+
+ sfp_base = of_iomap(np, 0);
+
+ uid = ioread32(sfp_base + offset);
+ uid <<= 32;
+ uid |= ioread32(sfp_base + offset + 4);
+
+ iounmap(sfp_base);
+ of_node_put(np);
+
+ return uid;
+}
+
+static const struct fsl_soc_data ls1028a_data = {
+ .sfp_compat = "fsl,ls1028a-sfp",
+ .uid_offset = 0x21c,
+};
+
/*
* Table for matching compatible strings, for device tree
* guts node, for Freescale QorIQ SOCs.
@@ -138,7 +170,7 @@ static const struct of_device_id fsl_guts_of_match[] = {
{ .compatible = "fsl,ls1012a-dcfg", },
{ .compatible = "fsl,ls1046a-dcfg", },
{ .compatible = "fsl,lx2160a-dcfg", },
- { .compatible = "fsl,ls1028a-dcfg", },
+ { .compatible = "fsl,ls1028a-dcfg", .data = &ls1028a_data},
{}
};
@@ -147,16 +179,20 @@ static int __init fsl_guts_init(void)
struct soc_device_attribute *soc_dev_attr;
static struct soc_device *soc_dev;
const struct fsl_soc_die_attr *soc_die;
+ const struct fsl_soc_data *soc_data;
+ const struct of_device_id *match;
struct ccsr_guts __iomem *regs;
const char *machine = NULL;
struct device_node *np;
bool little_endian;
+ u64 soc_uid = 0;
u32 svr;
int ret;
- np = of_find_matching_node_and_match(NULL, fsl_guts_of_match, NULL);
+ np = of_find_matching_node_and_match(NULL, fsl_guts_of_match, &match);
if (!np)
return 0;
+ soc_data = match->data;
regs = of_iomap(np, 0);
if (IS_ERR(regs)) {
@@ -204,6 +240,13 @@ static int __init fsl_guts_init(void)
if (!soc_dev_attr->revision)
goto err_nomem;
+ if (soc_data)
+ soc_uid = fsl_guts_get_soc_uid(soc_data->sfp_compat,
+ soc_data->uid_offset);
+ if (soc_uid)
+ soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX",
+ soc_uid);
+
soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR(soc_dev)) {
ret = PTR_ERR(soc_dev);
@@ -224,6 +267,7 @@ static int __init fsl_guts_init(void)
kfree(soc_dev_attr->family);
kfree(soc_dev_attr->soc_id);
kfree(soc_dev_attr->revision);
+ kfree(soc_dev_attr->serial_number);
kfree(soc_dev_attr);
return ret;
--
2.30.2
^ permalink raw reply related
* [PATCH v2 1/7] soc: fsl: guts: machine variable might be unset
From: Michael Walle @ 2022-02-09 16:32 UTC (permalink / raw)
To: linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Ulf Hansson, Arnd Bergmann, Li Yang, Michael Walle, Sudeep Holla,
Dan Carpenter
In-Reply-To: <20220209163242.430265-1-michael@walle.cc>
If both the model and the compatible properties are missing, then
machine will not be set. Initialize it with NULL.
Fixes: 34c1c21e94ac ("soc: fsl: fix section mismatch build warnings")
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/soc/fsl/guts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 5ed2fc1c53a0..be18d46c7b0f 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -140,7 +140,7 @@ static int fsl_guts_probe(struct platform_device *pdev)
struct device_node *root, *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
const struct fsl_soc_die_attr *soc_die;
- const char *machine;
+ const char *machine = NULL;
u32 svr;
/* Initialize guts */
--
2.30.2
^ permalink raw reply related
* [PATCH v2 4/7] soc: fsl: guts: allocate soc_dev_attr on the heap
From: Michael Walle @ 2022-02-09 16:32 UTC (permalink / raw)
To: linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Ulf Hansson, Arnd Bergmann, Li Yang, Michael Walle, Sudeep Holla,
Dan Carpenter
In-Reply-To: <20220209163242.430265-1-michael@walle.cc>
This is the last global static variable. Drop it and allocate the memory
on the heap instead.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/soc/fsl/guts.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 4e5675ab5f73..f992064a7f58 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -20,9 +20,6 @@ struct fsl_soc_die_attr {
u32 mask;
};
-static struct soc_device_attribute soc_dev_attr;
-
-
/* SoC die attribute definition for QorIQ platform */
static const struct fsl_soc_die_attr fsl_soc_die[] = {
/*
@@ -116,6 +113,7 @@ static const struct fsl_soc_die_attr *fsl_soc_die_match(
static int fsl_guts_probe(struct platform_device *pdev)
{
struct device_node *root, *np = pdev->dev.of_node;
+ struct soc_device_attribute *soc_dev_attr;
static struct soc_device *soc_dev;
struct device *dev = &pdev->dev;
const struct fsl_soc_die_attr *soc_die;
@@ -136,12 +134,16 @@ static int fsl_guts_probe(struct platform_device *pdev)
iounmap(regs);
/* Register soc device */
+ soc_dev_attr = devm_kzalloc(dev, sizeof(*soc_dev_attr), GFP_KERNEL);
+ if (!soc_dev_attr)
+ return -ENOMEM;
+
root = of_find_node_by_path("/");
if (of_property_read_string(root, "model", &machine))
of_property_read_string_index(root, "compatible", 0, &machine);
if (machine) {
- soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
- if (!soc_dev_attr.machine) {
+ soc_dev_attr->machine = devm_kstrdup(dev, machine, GFP_KERNEL);
+ if (!soc_dev_attr->machine) {
of_node_put(root);
return -ENOMEM;
}
@@ -150,30 +152,30 @@ static int fsl_guts_probe(struct platform_device *pdev)
soc_die = fsl_soc_die_match(svr, fsl_soc_die);
if (soc_die) {
- soc_dev_attr.family = devm_kasprintf(dev, GFP_KERNEL,
- "QorIQ %s", soc_die->die);
+ soc_dev_attr->family = devm_kasprintf(dev, GFP_KERNEL,
+ "QorIQ %s", soc_die->die);
} else {
- soc_dev_attr.family = devm_kasprintf(dev, GFP_KERNEL, "QorIQ");
+ soc_dev_attr->family = devm_kasprintf(dev, GFP_KERNEL, "QorIQ");
}
- if (!soc_dev_attr.family)
+ if (!soc_dev_attr->family)
return -ENOMEM;
- soc_dev_attr.soc_id = devm_kasprintf(dev, GFP_KERNEL,
+ soc_dev_attr->soc_id = devm_kasprintf(dev, GFP_KERNEL,
"svr:0x%08x", svr);
- if (!soc_dev_attr.soc_id)
+ if (!soc_dev_attr->soc_id)
return -ENOMEM;
- soc_dev_attr.revision = devm_kasprintf(dev, GFP_KERNEL, "%d.%d",
+ soc_dev_attr->revision = devm_kasprintf(dev, GFP_KERNEL, "%d.%d",
(svr >> 4) & 0xf, svr & 0xf);
- if (!soc_dev_attr.revision)
+ if (!soc_dev_attr->revision)
return -ENOMEM;
- soc_dev = soc_device_register(&soc_dev_attr);
+ soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR(soc_dev))
return PTR_ERR(soc_dev);
- pr_info("Machine: %s\n", soc_dev_attr.machine);
- pr_info("SoC family: %s\n", soc_dev_attr.family);
+ pr_info("Machine: %s\n", soc_dev_attr->machine);
+ pr_info("SoC family: %s\n", soc_dev_attr->family);
pr_info("SoC ID: %s, Revision: %s\n",
- soc_dev_attr.soc_id, soc_dev_attr.revision);
+ soc_dev_attr->soc_id, soc_dev_attr->revision);
return 0;
}
--
2.30.2
^ permalink raw reply related
* [PATCH v2 0/7] soc: fsl: guts: cleanups and serial_number support
From: Michael Walle @ 2022-02-09 16:32 UTC (permalink / raw)
To: linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Ulf Hansson, Arnd Bergmann, Li Yang, Michael Walle, Sudeep Holla,
Dan Carpenter
This series converts the guts driver from a platform driver to just an
core_initcall. The driver itself cannot (or rather should never) be
unloaded because others depends on detecting the current SoC revision
to apply chip errata. Other SoC drivers do it the same way. Overall I
got rid of all the global static variables.
The last patch finally adds unique id support to the guts driver. But
because the binding [1] for the security fuse processor is still pending,
it is marked as RFC.
[1] https://lore.kernel.org/linux-devicetree/20220127163728.3650648-2-michael@walle.cc/
changes since v1:
- call kfree() in error case, thanks Dan
- add missing of_node_put(np), thanks Dan
Michael Walle (7):
soc: fsl: guts: machine variable might be unset
soc: fsl: guts: remove module_exit() and fsl_guts_remove()
soc: fsl: guts: embed fsl_guts_get_svr() in probe()
soc: fsl: guts: allocate soc_dev_attr on the heap
soc: fsl: guts: use of_root instead of own reference
soc: fsl: guts: drop platform driver
soc: fsl: guts: add serial_number support
drivers/soc/fsl/guts.c | 219 ++++++++++++++++++++++-------------------
1 file changed, 118 insertions(+), 101 deletions(-)
--
2.30.2
^ permalink raw reply
* [PATCH v2 2/7] soc: fsl: guts: remove module_exit() and fsl_guts_remove()
From: Michael Walle @ 2022-02-09 16:32 UTC (permalink / raw)
To: linuxppc-dev, linux-arm-kernel, linux-kernel
Cc: Ulf Hansson, Arnd Bergmann, Li Yang, Michael Walle, Sudeep Holla,
Dan Carpenter
In-Reply-To: <20220209163242.430265-1-michael@walle.cc>
This driver will never be unloaded. Firstly, it is not available as a
module, but more importantly, other drivers will depend on this one to
apply possible chip errata.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/soc/fsl/guts.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index be18d46c7b0f..0bea43770d51 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -27,7 +27,6 @@ struct fsl_soc_die_attr {
static struct guts *guts;
static struct soc_device_attribute soc_dev_attr;
-static struct soc_device *soc_dev;
/* SoC die attribute definition for QorIQ platform */
@@ -138,6 +137,7 @@ static u32 fsl_guts_get_svr(void)
static int fsl_guts_probe(struct platform_device *pdev)
{
struct device_node *root, *np = pdev->dev.of_node;
+ static struct soc_device *soc_dev;
struct device *dev = &pdev->dev;
const struct fsl_soc_die_attr *soc_die;
const char *machine = NULL;
@@ -197,12 +197,6 @@ static int fsl_guts_probe(struct platform_device *pdev)
return 0;
}
-static int fsl_guts_remove(struct platform_device *dev)
-{
- soc_device_unregister(soc_dev);
- return 0;
-}
-
/*
* Table for matching compatible strings, for device tree
* guts node, for Freescale QorIQ SOCs.
@@ -242,7 +236,6 @@ static struct platform_driver fsl_guts_driver = {
.of_match_table = fsl_guts_of_match,
},
.probe = fsl_guts_probe,
- .remove = fsl_guts_remove,
};
static int __init fsl_guts_init(void)
@@ -250,9 +243,3 @@ static int __init fsl_guts_init(void)
return platform_driver_register(&fsl_guts_driver);
}
core_initcall(fsl_guts_init);
-
-static void __exit fsl_guts_exit(void)
-{
- platform_driver_unregister(&fsl_guts_driver);
-}
-module_exit(fsl_guts_exit);
--
2.30.2
^ permalink raw reply related
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