From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH v1 11/11] xsplice: Add support for alternatives
Date: Thu, 5 Nov 2015 14:48:31 -0500 [thread overview]
Message-ID: <20151105194831.GC3448@x230.dumpdata.com> (raw)
In-Reply-To: <1446574568-9644-11-git-send-email-ross.lagerwall@citrix.com>
On Tue, Nov 03, 2015 at 06:16:08PM +0000, Ross Lagerwall wrote:
> Add support for applying alternative sections within xsplice modules. At
> module load time, apply any alternative sections that are found.
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
> xen/arch/x86/Makefile | 2 +-
> xen/arch/x86/alternative.c | 12 ++++++------
> xen/common/xsplice.c | 11 +++++++++++
> xen/include/asm-x86/alternative.h | 1 +
> 4 files changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
> index 6e05532..5dbe2e8 100644
> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -7,7 +7,7 @@ subdir-y += oprofile
>
> subdir-$(x86_64) += x86_64
>
> -obj-bin-y += alternative.init.o
> +obj-bin-y += alternative.o
> obj-y += apic.o
> obj-y += bitops.o
> obj-bin-y += bzimage.init.o
> diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
> index 46ac0fd..8d895ad 100644
> --- a/xen/arch/x86/alternative.c
> +++ b/xen/arch/x86/alternative.c
> @@ -28,7 +28,7 @@
> extern struct alt_instr __alt_instructions[], __alt_instructions_end[];
>
> #ifdef K8_NOP1
> -static const unsigned char k8nops[] __initconst = {
> +static const unsigned char k8nops[] = {
> K8_NOP1,
> K8_NOP2,
> K8_NOP3,
> @@ -52,7 +52,7 @@ static const unsigned char * const k8_nops[ASM_NOP_MAX+1] = {
> #endif
>
> #ifdef P6_NOP1
> -static const unsigned char p6nops[] __initconst = {
> +static const unsigned char p6nops[] = {
> P6_NOP1,
> P6_NOP2,
> P6_NOP3,
> @@ -75,7 +75,7 @@ static const unsigned char * const p6_nops[ASM_NOP_MAX+1] = {
> };
> #endif
>
> -static const unsigned char * const *ideal_nops __initdata = k8_nops;
> +static const unsigned char * const *ideal_nops = k8_nops;
>
> static int __init mask_nmi_callback(const struct cpu_user_regs *regs, int cpu)
> {
> @@ -100,7 +100,7 @@ static void __init arch_init_ideal_nops(void)
> }
>
> /* Use this to add nops to a buffer, then text_poke the whole buffer. */
> -static void __init add_nops(void *insns, unsigned int len)
> +static void add_nops(void *insns, unsigned int len)
> {
> while ( len > 0 )
> {
> @@ -127,7 +127,7 @@ static void __init add_nops(void *insns, unsigned int len)
> *
> * This routine is called with local interrupt disabled.
> */
> -static void *__init text_poke_early(void *addr, const void *opcode, size_t len)
> +static void *text_poke_early(void *addr, const void *opcode, size_t len)
> {
> memcpy(addr, opcode, len);
> sync_core();
> @@ -142,7 +142,7 @@ static void *__init text_poke_early(void *addr, const void *opcode, size_t len)
> * APs have less capabilities than the boot processor are not handled.
> * Tough. Make sure you disable such features by hand.
> */
> -static void __init apply_alternatives(struct alt_instr *start, struct alt_instr *end)
> +void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
> {
> struct alt_instr *a;
> u8 *instr, *replacement;
> diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c
> index c5a403b..6a368af 100644
> --- a/xen/common/xsplice.c
> +++ b/xen/common/xsplice.c
> @@ -682,6 +682,17 @@ static int find_special_sections(struct payload *payload,
> payload->funcs = (struct xsplice_patch_func *)sec->load_addr;
> payload->nfuncs = sec->sec->sh_size / (sizeof *payload->funcs);
>
> +#ifdef CONFIG_X86
> + sec = xsplice_elf_sec_by_name(elf, ".altinstructions");
> + if ( sec )
> + {
> + local_irq_disable();
> + apply_alternatives((struct alt_instr *)sec->load_addr,
> + (struct alt_instr *)(sec->load_addr + sec->sec->sh_size));
Before we do that we need to double-check that 'sh_size' is the proper
size (size aligns with the size of the structure) and that it does not
have some funny value (0).
> + local_irq_enable();
> + }
> +#endif
> +
> for ( i = 0; i < 4; i++ )
> {
> char str[14];
> diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h
> index 23c9b9f..8e83572 100644
> --- a/xen/include/asm-x86/alternative.h
> +++ b/xen/include/asm-x86/alternative.h
> @@ -23,6 +23,7 @@ struct alt_instr {
> u8 replacementlen; /* length of new instruction, <= instrlen */
> };
>
> +extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
> extern void alternative_instructions(void);
>
> #define OLDINSTR(oldinstr) "661:\n\t" oldinstr "\n662:\n"
> --
> 2.4.3
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-11-05 19:48 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 18:15 [PATCH v1 01/11] xsplice: Design document (v2) Ross Lagerwall
2015-11-03 18:15 ` [PATCH v1 02/11] xen/xsplice: Hypervisor implementation of XEN_XSPLICE_op Ross Lagerwall
2015-11-04 21:17 ` Konrad Rzeszutek Wilk
2015-11-12 16:28 ` Jan Beulich
2015-11-13 14:13 ` Konrad Rzeszutek Wilk
2015-11-13 23:50 ` Daniel De Graaf
2015-11-03 18:16 ` [PATCH v1 03/11] libxc: Implementation of XEN_XSPLICE_op in libxc Ross Lagerwall
2015-11-03 18:16 ` [PATCH v1 04/11] xen-xsplice: Tool to manipulate xsplice payloads Ross Lagerwall
2015-11-04 21:27 ` Konrad Rzeszutek Wilk
2015-11-03 18:16 ` [PATCH v1 05/11] elf: Add relocation types to elfstructs.h Ross Lagerwall
2015-11-05 10:38 ` Jan Beulich
2015-11-05 11:52 ` Ross Lagerwall
2015-11-03 18:16 ` [PATCH v1 06/11] xsplice: Add helper elf routines Ross Lagerwall
2015-11-04 21:49 ` Konrad Rzeszutek Wilk
2015-11-03 18:16 ` [PATCH v1 07/11] xsplice: Implement payload loading Ross Lagerwall
2015-11-04 22:21 ` Konrad Rzeszutek Wilk
2015-11-05 10:35 ` Jan Beulich
2015-11-05 11:51 ` Ross Lagerwall
2015-11-05 12:13 ` Jan Beulich
2015-11-05 11:15 ` Ross Lagerwall
2015-11-05 20:12 ` Konrad Rzeszutek Wilk
2015-11-03 18:16 ` [PATCH v1 08/11] xsplice: Implement support for applying patches Ross Lagerwall
2015-11-05 3:17 ` Konrad Rzeszutek Wilk
2015-11-05 11:45 ` Ross Lagerwall
2015-11-05 20:08 ` Konrad Rzeszutek Wilk
2015-11-05 3:19 ` Konrad Rzeszutek Wilk
2015-11-27 13:51 ` Martin Pohlack
2015-11-03 18:16 ` [PATCH v1 09/11] xsplice: Add support for bug frames Ross Lagerwall
2015-11-05 19:43 ` Konrad Rzeszutek Wilk
2015-11-03 18:16 ` [PATCH v1 10/11] xsplice: Add support for exception tables Ross Lagerwall
2015-11-05 19:47 ` Konrad Rzeszutek Wilk
2015-11-27 16:28 ` Martin Pohlack
2015-11-27 17:05 ` Ross Lagerwall
2015-11-03 18:16 ` [PATCH v1 11/11] xsplice: Add support for alternatives Ross Lagerwall
2015-11-05 19:48 ` Konrad Rzeszutek Wilk [this message]
2015-11-04 21:10 ` [PATCH v1 01/11] xsplice: Design document (v2) Konrad Rzeszutek Wilk
2015-11-05 10:49 ` Ross Lagerwall
2015-11-05 19:56 ` Konrad Rzeszutek Wilk
2015-11-10 9:55 ` Ross Lagerwall
2015-11-27 12:48 ` Martin Pohlack
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=20151105194831.GC3448@x230.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=ross.lagerwall@citrix.com \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.