Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1192907 > unrolled thread

Re: [RFC][PATCH 6/7] jump_label: Add a new static_key interface

Started byPeter Zijlstra <peterz@infradead.org>
First post2015-07-27 12:00 +0200
Last post2015-07-27 13:00 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC][PATCH 6/7] jump_label: Add a new static_key interface Peter Zijlstra <peterz@infradead.org> - 2015-07-27 12:00 +0200
    Re: [RFC][PATCH 6/7] jump_label: Add a new static_key interface Heiko Carstens <heiko.carstens@de.ibm.com> - 2015-07-27 12:30 +0200
      Re: [RFC][PATCH 6/7] jump_label: Add a new static_key interface Peter Zijlstra <peterz@infradead.org> - 2015-07-27 12:50 +0200
        Re: [RFC][PATCH 6/7] jump_label: Add a new static_key interface Heiko Carstens <heiko.carstens@de.ibm.com> - 2015-07-27 13:00 +0200
          Re: [RFC][PATCH 6/7] jump_label: Add a new static_key interface Peter Zijlstra <peterz@infradead.org> - 2015-07-27 16:40 +0200
        Re: [RFC][PATCH 6/7] jump_label: Add a new static_key interface Peter Zijlstra <peterz@infradead.org> - 2015-07-27 13:00 +0200

#1192907 — Re: [RFC][PATCH 6/7] jump_label: Add a new static_key interface

FromPeter Zijlstra <peterz@infradead.org>
Date2015-07-27 12:00 +0200
SubjectRe: [RFC][PATCH 6/7] jump_label: Add a new static_key interface
Message-ID<pQNmp-6qa-3@gated-at.bofh.it>
On Fri, Jul 24, 2015 at 07:52:15PM +0200, Peter Zijlstra wrote:
> --- a/arch/s390/include/asm/jump_label.h
> +++ b/arch/s390/include/asm/jump_label.h
> @@ -12,14 +12,29 @@
>   * We use a brcl 0,2 instruction for jump labels at compile time so it
>   * can be easily distinguished from a hotpatch generated instruction.
>   */
> -static __always_inline bool arch_static_branch(struct static_key *key)
> +static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
>  {
>  	asm_volatile_goto("0:	brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
>  		".pushsection __jump_table, \"aw\"\n"
>  		".balign 8\n"
>  		".quad 0b, %l[label], %0\n"
>  		".popsection\n"
> -		: : "X" (key) : : label);
> +		: : "X" (&((char *)key)[branch]) : : label);
> +
> +	return false;
> +label:
> +	return true;
> +}
> +
> +static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
> +{
> +	asm_volatile_goto("0:	j %l[l_yes]\n"

Looking at the s390 version of jump_label_make_branch(), this should
have been:

		"brcl 15, %l[l_yes]\n"

I suppose?

> +		".pushsection __jump_table, \"aw\"\n"
> +		".balign 8\n"
> +		".quad 0b, %l[label], %0\n"
> +		".popsection\n"
> +		: : "X" (&((char *)key)[branch]) : : label);
> +
>  	return false;
>  label:
>  	return true;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1192938

FromHeiko Carstens <heiko.carstens@de.ibm.com>
Date2015-07-27 12:30 +0200
Message-ID<pQNPt-7dH-23@gated-at.bofh.it>
In reply to#1192907
On Mon, Jul 27, 2015 at 11:52:25AM +0200, Peter Zijlstra wrote:
> > +static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
> > +{
> > +	asm_volatile_goto("0:	j %l[l_yes]\n"
> 
> Looking at the s390 version of jump_label_make_branch(), this should
> have been:
> 
> 		"brcl 15, %l[l_yes]\n"
> 
> I suppose?

Yes. I wanted to test your version, but I assume you will send
an updated version soon?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1192957

FromPeter Zijlstra <peterz@infradead.org>
Date2015-07-27 12:50 +0200
Message-ID<pQO8O-7zV-17@gated-at.bofh.it>
In reply to#1192938
On Mon, Jul 27, 2015 at 12:20:46PM +0200, Heiko Carstens wrote:
> On Mon, Jul 27, 2015 at 11:52:25AM +0200, Peter Zijlstra wrote:
> > > +static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
> > > +{
> > > +	asm_volatile_goto("0:	j %l[l_yes]\n"
> > 
> > Looking at the s390 version of jump_label_make_branch(), this should
> > have been:
> > 
> > 		"brcl 15, %l[l_yes]\n"
> > 
> > I suppose?
> 
> Yes. I wanted to test your version, but I assume you will send
> an updated version soon?

I just send out updated patches for 5/6. They boot without issue on my
x86_64.

Much obliged if you have a peek at that.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1192960

FromHeiko Carstens <heiko.carstens@de.ibm.com>
Date2015-07-27 13:00 +0200
Message-ID<pQOiu-7Lc-5@gated-at.bofh.it>
In reply to#1192957
On Mon, Jul 27, 2015 at 12:50:36PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 27, 2015 at 12:47:55PM +0200, Peter Zijlstra wrote:
> > On Mon, Jul 27, 2015 at 12:20:46PM +0200, Heiko Carstens wrote:
> > > On Mon, Jul 27, 2015 at 11:52:25AM +0200, Peter Zijlstra wrote:
> > > > > +static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
> > > > > +{
> > > > > +	asm_volatile_goto("0:	j %l[l_yes]\n"
> > > > 
> > > > Looking at the s390 version of jump_label_make_branch(), this should
> > > > have been:
> > > > 
> > > > 		"brcl 15, %l[l_yes]\n"
> > > > 
> > > > I suppose?
> > > 
> > > Yes. I wanted to test your version, but I assume you will send
> > > an updated version soon?
> > 
> > I just send out updated patches for 5/6. They boot without issue on my
> > x86_64.
> 
> Also, it helps if you convert one static_key user into something that'll
> trigger this new code.
> 
> The one I picked is unfortunately rather x86 specific.

Yeah, just did that and it crashes ;)
Hopefully I'll have time to look into it today.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1193198

FromPeter Zijlstra <peterz@infradead.org>
Date2015-07-27 16:40 +0200
Message-ID<pQRJo-4Ft-25@gated-at.bofh.it>
In reply to#1192960
On Mon, Jul 27, 2015 at 12:52:42PM +0200, Heiko Carstens wrote:
> Yeah, just did that and it crashes ;)

Does this make it go?

---
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -221,7 +221,10 @@ void __init jump_label_init(void)
 	for (iter = iter_start; iter < iter_stop; iter++) {
 		struct static_key *iterk;
 
-		arch_jump_label_transform_static(iter, jump_label_type(iter));
+		/* rewrite NOPs */
+		if (jump_label_type(iter) == JUMP_LABEL_NOP)
+			arch_jump_label_transform_static(iter, JUMP_LABEL_NOP);
+
 		iterk = jump_entry_key(iter);
 		if (iterk == key)
 			continue;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1192963

FromPeter Zijlstra <peterz@infradead.org>
Date2015-07-27 13:00 +0200
Message-ID<pQOiu-7Lc-7@gated-at.bofh.it>
In reply to#1192957
On Mon, Jul 27, 2015 at 12:47:55PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 27, 2015 at 12:20:46PM +0200, Heiko Carstens wrote:
> > On Mon, Jul 27, 2015 at 11:52:25AM +0200, Peter Zijlstra wrote:
> > > > +static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
> > > > +{
> > > > +	asm_volatile_goto("0:	j %l[l_yes]\n"
> > > 
> > > Looking at the s390 version of jump_label_make_branch(), this should
> > > have been:
> > > 
> > > 		"brcl 15, %l[l_yes]\n"
> > > 
> > > I suppose?
> > 
> > Yes. I wanted to test your version, but I assume you will send
> > an updated version soon?
> 
> I just send out updated patches for 5/6. They boot without issue on my
> x86_64.

Also, it helps if you convert one static_key user into something that'll
trigger this new code.

The one I picked is unfortunately rather x86 specific.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web