[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D25EC873-572E-457C-AEB1-DC0C1FAF8E85@vmware.com>
Date: Fri, 21 Jun 2019 18:37:52 +0000
From: Nadav Amit <namit@...are.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Vineet Gupta <Vineet.Gupta1@...opsys.com>,
Eugeniy Paltsev <Eugeniy.Paltsev@...opsys.com>,
"linux-snps-arc@...ts.infradead.org"
<linux-snps-arc@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Alexey Brodkin <Alexey.Brodkin@...opsys.com>,
Jason Baron <jbaron@...mai.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>
Subject: Re: [PATCH] ARC: ARCv2: jump label: implement jump label patching
> On Jun 21, 2019, at 5:12 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Fri, Jun 21, 2019 at 02:09:23PM +0200, Peter Zijlstra wrote:
>
>> --- /dev/null
>> +++ b/arch/x86/include/asm/jump_label_asm.h
>> @@ -0,0 +1,44 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef _ASM_X86_JUMP_LABEL_ASM_H
>> +#define _ASM_X86_JUMP_LABEL_ASM_H
>> +
>> +#include <asm/asm.h>
>> +#include <asm/nops.h>
>> +
>> +#ifdef __ASSEMBLY__
>> +
>> +.macro STATIC_BRANCH_ENTRY l_target:req l_yes:req key:req branch:req
>> + .pushsection __jump_table, "aw"
>> + .long \l_target - ., \l_yes - .
>> +#ifdef __X86_64__
>> + .quad (\key - .) + \branch
>> +#else
>> + .long (\key - .) + \branch
>> +#endif
>> + .popsection
>> +.endm
>> +
>> +.macro STATIC_BRANCH_NOP l_yes:req key:req branch:req
>> +.Lstatic_branch_nop_\@:
>> +.iflt 127 - .
>
> That should've been:
>
> .if \l_yes - . < 127
>
> too, I had been playing with various forms to see when it compiles.
> But as soon as a label (either \l_yes or '.' gets used) it barfs.
I think the error makes sense as it creates a “circular dependency”:
assembly of the code might affect the label address, and this address affect
the assembly.
Powered by blists - more mailing lists