linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andi Kleen <andi@firstfloor.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH v2 3/9] x86/paravirt: Replace paravirt patches with data
Date: Fri, 19 Apr 2019 23:26:50 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1904192306120.3174@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20190330004743.29541-3-andi@firstfloor.org>

On Fri, 29 Mar 2019, Andi Kleen wrote:
> For LTO all top level assembler statements need to be global because
> LTO might put it into a different assembler file than the referencing
> C code.
> 
> To avoid making all the paravirt patch snippets global replace them
> with data containing the patch instructions. Since these are unlikely
> to change this shouldn't be a significant maintenance burden.

s/with data containing/with unparseable, inconsistent and broken mess/

Unparseable:
------------

> +static const unsigned char patch_irq_save_fl[] = { 0x9c, 0x58 };  	/* pushf; pop %eax */
> +static const unsigned char patch_cpu_iret[] = { 0xcf };		  	/* iret */
> +static const unsigned char patch_mmu_read_cr2[] = { 0x0f, 0x20, 0xd0 }; /* mov %cr2, %eax */
> +static const unsigned char patch_mmu_write_cr3[] = { 0x0f, 0x22, 0xd8 };/* mov %eax, %cr3 */
> +static const unsigned char patch_mmu_read_cr3[] = { 0x0f, 0x20, 0xd8 }; /* mov %cr3, %eax */

  Overlong lines, spaces and tabs mixed, no formatting which allows easy
  reading and review.

Inconsistent and unparseable:
-----------------------------

>  #define PATCH_SITE(ops, x)					\
>  	case PARAVIRT_PATCH(ops.x):				\
> -		return paravirt_patch_insns(ibuf, len, start_##ops##_##x, end_##ops##_##x)
> +		return paravirt_patch_insns(ibuf, len, 		\
> +				patch_##ops##_##x, patch_##ops##_##x+sizeof(patch_##ops##_x));

vs.

> +		return paravirt_patch_insns(ibuf, len, start_##ops##_##x, \
> +				patch_##ops##_##x + sizeof(patch_##ops##_##x));

Broken:
-------

> +static const unsigned char patch_irq_restore_fl[] =  { 0x50, 0x9d};		/* pushq %rdi; popfq */

Can you spot the fail?

That probably works because Intel CPUs are so good at executing crappy
code, right? That's at least what you told me recently. If that's the proof
then I should really stop reviewing patches.

Thanks,

	tglx





  reply	other threads:[~2019-04-19 21:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30  0:47 [PATCH v2 1/9] x86/asm: Mark all top level asm statements as .text Andi Kleen
2019-03-30  0:47 ` [PATCH v2 2/9] x86/cpu/amd: Ifdef 32bit only assembler for 32bit Andi Kleen
2019-04-19 15:52   ` [tip:x86/asm] x86/cpu/amd: Exclude 32bit only assembler from 64bit build tip-bot for Andi Kleen
2019-03-30  0:47 ` [PATCH v2 3/9] x86/paravirt: Replace paravirt patches with data Andi Kleen
2019-04-19 21:26   ` Thomas Gleixner [this message]
2019-03-30  0:47 ` [PATCH v2 4/9] x86/timer: Don't inline __const_udelay Andi Kleen
2019-04-19 15:55   ` [tip:x86/timers] x86/timer: Don't inline __const_udelay() tip-bot for Andi Kleen
2019-03-30  0:47 ` [PATCH v2 5/9] x86/xen: Mark xen_vcpu_stolen as __visible Andi Kleen
2019-03-30 10:40   ` Juergen Gross
2019-03-30  0:47 ` [PATCH v2 6/9] x86/hyperv: Make hv_vcpu_is_preempted visible Andi Kleen
2019-04-19 15:58   ` [tip:x86/hyperv] x86/hyperv: Make hv_vcpu_is_preempted() visible tip-bot for Andi Kleen
2019-04-19 16:04   ` [tip:x86/platform] " tip-bot for Andi Kleen
2019-03-30  0:47 ` [PATCH v2 7/9] x86/kprobes: Make trampoline_handler global and visible Andi Kleen
2019-04-19 15:58   ` [tip:x86/core] x86/kprobes: Make trampoline_handler() " tip-bot for Andi Kleen
2019-05-08 11:20   ` [tip:x86/urgent] " tip-bot for Andi Kleen
2019-03-30  0:47 ` [PATCH v2 8/9] x86/kvm: Make steal_time visible Andi Kleen
2019-04-19 16:04   ` [tip:x86/platform] " tip-bot for Andi Kleen
2019-03-30  0:47 ` [PATCH v2 9/9] x86/cpu/bugs: Fix __initconst usage in bugs.c Andi Kleen
2019-04-19 15:16   ` [tip:x86/urgent] x86/cpu/bugs: Use __initconst for 'const' init data tip-bot for Andi Kleen
2019-04-19 15:52 ` [tip:x86/asm] x86/asm: Mark all top level asm statements as .text tip-bot for Andi Kleen

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=alpine.DEB.2.21.1904192306120.3174@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /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).