From: Jan Glauber <jang@linux.vnet.ibm.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
"David S. Miller" <davem@davemloft.net>,
David Daney <david.daney@cavium.com>,
Michael Ellerman <michael@ellerman.id.au>,
Jason Baron <jbaron@redhat.com>,
the arch/x86 maintainers <x86@kernel.org>,
Xen Devel <xen-devel@lists.xensource.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Subject: Re: [PATCH RFC 7/8] s390/jump-label: add arch_jump_label_transform_early()
Date: Sat, 01 Oct 2011 13:22:17 +0200 [thread overview]
Message-ID: <1317468137.11297.70.camel@localhost.localdomain> (raw)
In-Reply-To: <4E85E867.8080809@goop.org>
On Fri, 2011-09-30 at 09:03 -0700, Jeremy Fitzhardinge wrote:
> On 09/30/2011 07:48 AM, Jan Glauber wrote:
> > On Thu, 2011-09-29 at 16:26 -0700, Jeremy Fitzhardinge wrote:
> >> From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> >>
> >> This allows jump-label entries to be modified early, in a pre-SMP
> >> environment.
> >>
> >> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> >> Cc: Jan Glauber <jang@linux.vnet.ibm.com>
> > Hi Jeremy,
> >
> > Your patch looks fine, if you can fix the minor compiler warnings
> > below. Excluding stop_machine() on pre-SMP also looks safer too me.
>
> Do you think there would be an actual problem, or are you just being
> cautious?
Just cautious since stop_machine() is quite a big hammer. Who knows how
many jump labels we might get? So without an early exit in
stop_machine() for pre-SMP we might waste performance there.
> It seems to me - in general - stop_machine could just be defined to be a
> no-op (ie, just directly calls the callback) until enough SMP is
> initialized for it to make sense, rather than having to make every user
> work around it (if there's a chance they might call it early).
Agreed.
> > CC arch/s390/kernel/jump_label.o
> > arch/s390/kernel/jump_label.c: In function ‘__jump_label_transform’:
> > arch/s390/kernel/jump_label.c:41:2: error: ‘rc’ undeclared (first use in this function)
> > arch/s390/kernel/jump_label.c:41:2: note: each undeclared identifier is reported only once for each function it appears in
> > arch/s390/kernel/jump_label.c:41:2: warning: passing argument 1 of ‘probe_kernel_write’ makes pointer from integer without a cast [enabled by default]
> > include/linux/uaccess.h:108:21: note: expected ‘void *’ but argument is of type ‘jump_label_t’
> > arch/s390/kernel/jump_label.c:28:19: warning: unused variable ‘args’ [-Wunused-variable]
> > make[2]: *** [arch/s390/kernel/jump_label.o] Error 1
> >
> >
>
> Like so?
Yes, that compiles!
--Jan
> From 9572689d1e5e6f54a1936a1dca09a6920d1bce27 Mon Sep 17 00:00:00 2001
> From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> Date: Thu, 29 Sep 2011 10:58:46 -0700
> Subject: [PATCH] s390/jump-label: add arch_jump_label_transform_early()
>
> This allows jump-label entries to be modified early, in a pre-SMP
> environment.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> Cc: Jan Glauber <jang@linux.vnet.ibm.com>
>
> diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c
> index 44cc06b..4fbe63b 100644
> --- a/arch/s390/kernel/jump_label.c
> +++ b/arch/s390/kernel/jump_label.c
> @@ -18,26 +18,15 @@ struct insn {
> } __packed;
>
> struct insn_args {
> - unsigned long *target;
> - struct insn *insn;
> - ssize_t size;
> + struct jump_entry *entry;
> + enum jump_label_type type;
> };
>
> -static int __arch_jump_label_transform(void *data)
> +static void __jump_label_transform(struct jump_entry *entry,
> + enum jump_label_type type)
> {
> - struct insn_args *args = data;
> - int rc;
> -
> - rc = probe_kernel_write(args->target, args->insn, args->size);
> - WARN_ON_ONCE(rc < 0);
> - return 0;
> -}
> -
> -void arch_jump_label_transform(struct jump_entry *entry,
> - enum jump_label_type type)
> -{
> - struct insn_args args;
> struct insn insn;
> + int rc;
>
> if (type == JUMP_LABEL_ENABLE) {
> /* brcl 15,offset */
> @@ -49,11 +38,33 @@ void arch_jump_label_transform(struct jump_entry *entry,
> insn.offset = 0;
> }
>
> - args.target = (void *) entry->code;
> - args.insn = &insn;
> - args.size = JUMP_LABEL_NOP_SIZE;
> + rc = probe_kernel_write((void *)entry->code, &insn, JUMP_LABEL_NOP_SIZE);
> + WARN_ON_ONCE(rc < 0);
> +}
>
> - stop_machine(__arch_jump_label_transform, &args, NULL);
> +static int __sm_arch_jump_label_transform(void *data)
> +{
> + struct insn_args *args = data;
> +
> + __jump_label_transform(args->entry, args->type);
> + return 0;
> +}
> +
> +void arch_jump_label_transform(struct jump_entry *entry,
> + enum jump_label_type type)
> +{
> + struct insn_args args;
> +
> + args.entry = entry;
> + args.type = type;
> +
> + stop_machine(__sm_arch_jump_label_transform, &args, NULL);
> +}
> +
> +void __init arch_jump_label_transform_early(struct jump_entry *entry,
> + enum jump_label_type type)
> +{
> + __jump_label_transform(entry, type);
> }
>
> #endif
>
> J
>
next prev parent reply other threads:[~2011-10-01 11:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 23:26 [PATCH RFC 0/8] jump-label: allow early jump_label_enable() Jeremy Fitzhardinge
2011-09-29 23:26 ` [PATCH RFC 1/8] jump_label: use proper atomic_t initializer Jeremy Fitzhardinge
2011-09-29 23:26 ` [PATCH RFC 2/8] jump_label: if a key has already been initialized, don't nop it out Jeremy Fitzhardinge
2011-09-29 23:26 ` [PATCH RFC 3/8] x86/jump_label: add arch_jump_label_transform_early() Jeremy Fitzhardinge
2011-09-29 23:26 ` [PATCH RFC 4/8] sparc/jump_label: " Jeremy Fitzhardinge
2011-09-29 23:31 ` David Miller
2011-09-29 23:26 ` [PATCH RFC 5/8] mips/jump_label: " Jeremy Fitzhardinge
2011-09-29 23:26 ` [PATCH RFC 6/8] powerpc/jump_label: " Jeremy Fitzhardinge
2011-09-29 23:26 ` [PATCH RFC 7/8] s390/jump-label: " Jeremy Fitzhardinge
2011-09-30 14:48 ` Jan Glauber
2011-09-30 16:03 ` Jeremy Fitzhardinge
2011-10-01 11:22 ` Jan Glauber [this message]
2011-09-29 23:26 ` [PATCH RFC 8/8] jump_label: drop default arch_jump_label_transform_early Jeremy Fitzhardinge
2011-09-30 0:52 ` [PATCH RFC 0/8] jump-label: allow early jump_label_enable() Steven Rostedt
2011-09-30 4:40 ` Jeremy Fitzhardinge
2011-09-30 15:28 ` Steven Rostedt
2011-09-30 16:09 ` Jeremy Fitzhardinge
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=1317468137.11297.70.camel@localhost.localdomain \
--to=jang@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=david.daney@cavium.com \
--cc=jbaron@redhat.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@ellerman.id.au \
--cc=rostedt@goodmis.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.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