From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
James Bottomley <jejb@parisc-linux.org>,
Helge Deller <deller@gmx.de>,
Andrew Morton <akpm@linux-foundation.org>,
Jessica Yu <jeyu@kernel.org>, Alexei Starovoitov <ast@kernel.org>,
linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv3 1/7] switch dereference_function_descriptor() to `unsigned long'
Date: Wed, 4 Oct 2017 10:24:14 +0200 [thread overview]
Message-ID: <20171004082414.GC20084@pathway.suse.cz> (raw)
In-Reply-To: <20170930025319.987-2-sergey.senozhatsky@gmail.com>
On Sat 2017-09-30 11:53:13, Sergey Senozhatsky wrote:
> Convert dereference_function_descriptor() to accept and return
> `unsigned long'. There will be two new ARCH function for kernel
> and module function pointer dereference, which will work with
> `unsigned long', so the patch unifies interfaces.
>
> Besides, dereference_function_descriptor() mostly work with
> `unsigned long':
>
> Convert dereference_function_descriptor() users tree-wide.
I am not sure if this is a real win. If I count correctly,
the net result is 6 additional casts in this patch. Many
casts are still needed also in the other patches.
> diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h
> index 2ab2003698ef..de6bfa1ef8fb 100644
> --- a/arch/ia64/include/asm/sections.h
> +++ b/arch/ia64/include/asm/sections.h
> @@ -27,13 +27,13 @@ extern char __start_unwind[], __end_unwind[];
> extern char __start_ivt_text[], __end_ivt_text[];
>
> #undef dereference_function_descriptor
> -static inline void *dereference_function_descriptor(void *ptr)
> +static inline unsigned long dereference_function_descriptor(unsigned long ptr)
I would also expect that a function called "dereference*" would work with
a pointer. The parameter is called ptr but it is unsigned long.
> {
> - struct fdesc *desc = ptr;
> + struct fdesc *desc = (struct fdesc *)ptr;
> void *p;
>
> if (!probe_kernel_address(&desc->ip, p))
> - ptr = p;
> + ptr = (unsigned long)p;
> return ptr;
> }
>
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index 1ca9a2b4239f..06e1b79e2946 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -389,10 +389,10 @@ static void __init setup_bootmem(void)
> static int __init parisc_text_address(unsigned long vaddr)
> {
> static unsigned long head_ptr __initdata;
> + unsigned long addr = (unsigned long)&parisc_kernel_start;
>
> if (!head_ptr)
> - head_ptr = PAGE_MASK & (unsigned long)
> - dereference_function_descriptor(&parisc_kernel_start);
> + head_ptr = PAGE_MASK & dereference_function_descriptor(addr);
IMHO, this is harder to read than the original. You need to
search the definition of "addr" and check its manipulation
to understand the meaning.
>
> return core_kernel_text(vaddr) || vaddr == head_ptr;
> }
To make it clear. All these comments are not a big deal and I do
not want to invalidate all the acked-by and tested-by just because
of them.
But please, consider removing this change if we need to do
another iteration of this patchset. IMHO, there is no real win
and it would just pollute the git history.
Best Regards,
Petr
next prev parent reply other threads:[~2017-10-04 8:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-30 2:53 [PATCHv3 0/7] printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers Sergey Senozhatsky
2017-09-30 2:53 ` [PATCHv3 1/7] switch dereference_function_descriptor() to `unsigned long' Sergey Senozhatsky
2017-10-04 8:24 ` Petr Mladek [this message]
2017-10-19 6:50 ` Sergey Senozhatsky
2017-10-20 13:25 ` Petr Mladek
2017-09-30 2:53 ` [PATCHv3 2/7] sections: split dereference_function_descriptor() Sergey Senozhatsky
2017-10-04 9:00 ` Petr Mladek
2017-10-19 6:45 ` Sergey Senozhatsky
2017-09-30 2:53 ` [PATCHv3 3/7] ia64: Add .opd based function descriptor dereference Sergey Senozhatsky
2017-10-04 9:05 ` Petr Mladek
2017-09-30 2:53 ` [PATCHv3 4/7] powerpc64: " Sergey Senozhatsky
2017-10-04 9:21 ` Petr Mladek
2017-10-04 11:06 ` Michael Ellerman
2017-10-19 14:01 ` Sergey Senozhatsky
2017-10-19 6:45 ` Sergey Senozhatsky
2017-09-30 2:53 ` [PATCHv3 5/7] parisc64: " Sergey Senozhatsky
2017-10-04 10:40 ` Petr Mladek
2017-10-19 6:44 ` Sergey Senozhatsky
2017-09-30 2:53 ` [PATCHv3 6/7] symbol lookup: use new kernel and module dereference functions Sergey Senozhatsky
2017-10-04 11:53 ` Petr Mladek
2017-10-19 6:42 ` Sergey Senozhatsky
2017-10-20 13:08 ` Petr Mladek
2017-10-23 8:38 ` Sergey Senozhatsky
2017-09-30 2:53 ` [PATCHv3 7/7] checkpatch: add pF/pf deprecation warning Sergey Senozhatsky
2017-10-04 12:08 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171004082414.GC20084@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=deller@gmx.de \
--cc=fenghua.yu@intel.com \
--cc=jejb@parisc-linux.org \
--cc=jeyu@kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).