From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Wei Liu <wl@xen.org>, Anthony PERARD <anthony.perard@citrix.com>,
Juergen Gross <jgross@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 3/5] xen/x86: introduce self modifying code test
Date: Fri, 1 Dec 2023 13:08:02 +0100 [thread overview]
Message-ID: <ZWnMom8D8F4nEZFp@macbook> (raw)
In-Reply-To: <3ac223d0-75a1-40b0-8bf9-1c556703c07d@suse.com>
On Thu, Nov 30, 2023 at 06:02:55PM +0100, Jan Beulich wrote:
> On 28.11.2023 11:03, Roger Pau Monne wrote:
> > --- /dev/null
> > +++ b/xen/arch/x86/test-smc.c
> > @@ -0,0 +1,68 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +
> > +#include <xen/errno.h>
> > +
> > +#include <asm/alternative.h>
> > +#include <asm/cpufeature.h>
> > +#include <asm/test-smc.h>
> > +
> > +static bool cf_check test_insn_replacement(void)
> > +{
> > +#define EXPECTED_VALUE 2
> > + unsigned int r = ~EXPECTED_VALUE;
>
> The compiler is permitted to elide the initializer unless ...
>
> > + alternative_io("", "mov $" STR(EXPECTED_VALUE) ", %0",
> > + X86_FEATURE_ALWAYS, "=r"(r));
>
> ... you use "+r" here.
I see, '=' assumes the operand is always written to, which is not the
case if alternative is not applied.
> Also (nit) there's a blank missing between that
> string and the opening parethesis. Also what's wrong with passing
> EXPECTED_VALUE in as an "i" constraint input operand?
Me not knowing enough inline assembly I think, that's what's wrong.
> > @@ -1261,6 +1269,7 @@ struct xen_sysctl {
> > struct xen_sysctl_livepatch_op livepatch;
> > #if defined(__i386__) || defined(__x86_64__)
> > struct xen_sysctl_cpu_policy cpu_policy;
> > + struct xen_sysctl_test_smc smc;
>
> Imo the field name would better be test_smc (leaving aside Stefano's comment).
Right, will see what Stefano thinks about using test_smoc.
Thanks, Roger.
next prev parent reply other threads:[~2023-12-01 12:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 10:03 [PATCH v2 0/5] xen/x86: add testing for self modifying code and livepatch Roger Pau Monne
2023-11-28 10:03 ` [PATCH v2 1/5] x86/livepatch: set function alignment to ensure minimal function size Roger Pau Monne
2023-11-30 16:55 ` Jan Beulich
2023-11-30 17:37 ` Roger Pau Monné
2023-12-01 6:53 ` Jan Beulich
2023-12-01 8:50 ` Roger Pau Monné
2023-12-01 9:41 ` Jan Beulich
2023-12-01 10:21 ` Roger Pau Monné
2023-12-01 10:59 ` Jan Beulich
2023-12-01 11:31 ` Roger Pau Monné
2023-12-01 12:59 ` Jan Beulich
2023-12-05 13:42 ` Andrew Cooper
2023-12-05 15:01 ` Roger Pau Monné
2023-12-05 15:14 ` Jan Beulich
2023-12-05 15:36 ` Roger Pau Monné
2023-12-05 15:45 ` Jan Beulich
2023-11-28 10:03 ` [PATCH v2 2/5] automation/alpine: add elfutils-dev Roger Pau Monne
2023-11-30 2:56 ` Stefano Stabellini
2023-11-28 10:03 ` [PATCH v2 3/5] xen/x86: introduce self modifying code test Roger Pau Monne
2023-11-30 2:58 ` Stefano Stabellini
2023-12-01 11:52 ` Roger Pau Monné
2023-11-30 17:02 ` Jan Beulich
2023-12-01 12:08 ` Roger Pau Monné [this message]
2023-12-02 2:36 ` Stefano Stabellini
2023-11-28 10:03 ` [PATCH v2 4/5] x86/livepatch: introduce a basic live patch test to gitlab CI Roger Pau Monne
2023-12-05 11:49 ` Jan Beulich
2023-12-05 13:08 ` Roger Pau Monné
2023-12-05 13:23 ` Jan Beulich
2023-11-28 10:03 ` [PATCH v2 5/5] automation: add x86-64 livepatching test Roger Pau Monne
2023-11-30 3:03 ` Stefano Stabellini
2023-12-13 10:55 ` Roger Pau Monné
2023-12-14 2:08 ` Stefano Stabellini
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=ZWnMom8D8F4nEZFp@macbook \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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.