All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org, Doug Goldstein <cardoe@cardoe.com>
Subject: Re: [PATCH v2 5/5] automation: add x86-64 livepatching test
Date: Wed, 13 Dec 2023 11:55:00 +0100	[thread overview]
Message-ID: <ZXmNhK58kveTKT0N@macbook> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2311291901250.3533093@ubuntu-linux-20-04-desktop>

On Wed, Nov 29, 2023 at 07:03:10PM -0800, Stefano Stabellini wrote:
> On Tue, 28 Nov 2023, Roger Pau Monne wrote:
> > Introduce a new gitlab tests for livepatching, using livepatch-build-tools,
> > which better reflects how downstreams build live patches rather than the
> > in-tree tests.
> > 
> > The tests applies the dummy in-tree patch example, checks that the patch is
> > applied correctly and then reverts and unloads it.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> >  automation/gitlab-ci/build.yaml               |  8 +++
> >  automation/gitlab-ci/test.yaml                |  8 +++
> >  automation/scripts/build                      | 21 ++++++
> >  .../scripts/qemu-alpine-x86_64-livepatch.sh   | 68 +++++++++++++++++++
> >  4 files changed, 105 insertions(+)
> >  create mode 100755 automation/scripts/qemu-alpine-x86_64-livepatch.sh
> > 
> > diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
> > index 32af30ccedc9..22026df51b87 100644
> > --- a/automation/gitlab-ci/build.yaml
> > +++ b/automation/gitlab-ci/build.yaml
> > @@ -358,6 +358,14 @@ alpine-3.18-gcc-debug:
> >    variables:
> >      CONTAINER: alpine:3.18
> >  
> > +alpine-3.18-gcc-livepatch:
> > +  extends: .gcc-x86-64-build
> > +  variables:
> > +    CONTAINER: alpine:3.18
> > +    LIVEPATCH: y
> > +    EXTRA_XEN_CONFIG: |
> > +      CONFIG_LIVEPATCH=y
> > +
> >  debian-stretch-gcc-debug:
> >    extends: .gcc-x86-64-build-debug
> >    variables:
> > diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
> > index 6aabdb9d156f..58a90be5ed0e 100644
> > --- a/automation/gitlab-ci/test.yaml
> > +++ b/automation/gitlab-ci/test.yaml
> > @@ -459,3 +459,11 @@ qemu-smoke-ppc64le-powernv9-gcc:
> >    needs:
> >      - qemu-system-ppc64-8.1.0-ppc64-export
> >      - debian-bullseye-gcc-ppc64le-debug
> > +
> > +qemu-alpine-x86_64-gcc-livepatch:
> > +  extends: .qemu-x86-64
> > +  script:
> > +    - ./automation/scripts/qemu-alpine-x86_64-livepatch.sh 2>&1 | tee ${LOGFILE}
> > +  needs:
> > +    - *x86-64-test-needs
> > +    - alpine-3.18-gcc-livepatch
> > diff --git a/automation/scripts/build b/automation/scripts/build
> > index b3c71fb6fb60..0a0a6dceb08c 100755
> > --- a/automation/scripts/build
> > +++ b/automation/scripts/build
> > @@ -103,3 +103,24 @@ else
> >      cp -r dist binaries/
> >      if [[ -f xen/xen ]] ; then cp xen/xen binaries/xen; fi
> >  fi
> > +
> > +if [[ "$LIVEPATCH" == "y" ]]; then
> > +    # Build a test livepatch using livepatch-build-tools.
> > +
> > +    if [[ "$XEN_TARGET_ARCH" != "x86_64" ]]; then
> > +        exit 1
> > +    fi
> > +
> > +    # git diff --no-index returns 0 if no differences, otherwise 1.
> > +    git diff --no-index --output=test.patch xen/arch/x86/test-smc-lp.c \
> > +                                            xen/arch/x86/test-smc-lp-alt.c && exit 1
> > +
> > +    BUILDID=$(readelf -Wn xen/xen-syms | sed -n -e 's/^.*Build ID: //p')
> > +
> > +    git clone https://xenbits.xen.org/git-http/livepatch-build-tools.git
> > +    cd livepatch-build-tools
> > +    make
> > +    ./livepatch-build -s ../ -p ../test.patch -o out -c ../xen/.config \
> > +        --depends $BUILDID --xen-depends $BUILDID
> > +    cp out/test.livepatch ../binaries/test.livepatch
> > +fi
> 
> I realize this is a matter of taste but if possible I would move this to
> qemu-alpine-x86_64-livepatch.sh not to make the build script too
> complex.

I've attempted that, but there are some issues.  First, the
elfutils-dev package would need to be added to the test container,
checkout livepatch-build-tools.git from the test script, and do the
differential build in the test script, so all the Xen hypervisor build
dependencies would also be needed in the test container.

> Otherwise, plase create automation/scripts/livepatch and move this code
> there. You can call automation/scripts/livepatch from
> automation/scripts/build.

Unless you have a strong desire to pursue building the livepatch in
the test step, I will go with the route proposed here, and split the
livepatch build into automation/scripts/build-livepatch.

> Other than that, this is great! I'll let other review the livepatch
> specific changes in this series

Thanks, will post a new version soon.

Roger.


  reply	other threads:[~2023-12-13 10:55 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é
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é [this message]
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=ZXmNhK58kveTKT0N@macbook \
    --to=roger.pau@citrix.com \
    --cc=cardoe@cardoe.com \
    --cc=sstabellini@kernel.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.