| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
 Re: [PATCH 4/4] livepatch: differentiate between old and new build systems
 
To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>From: Roger Pau Monné <roger.pau@xxxxxxxxxx>Date: Tue, 8 Mar 2022 15:52:42 +0100Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=noneArc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nG0fC5JoZBpZSdRQVousvPLt3MTbVP6sArOWO3yEn7w=; b=aNuXL3xZFRGKyZGBUAmEXCOyve5ZOWAxvE/JmktfHqTKg2C3fKvz9tLbsXYwJbNQs15PmFCtf1OKR5fr6RCkK9J189oSYS2bMdXiVK6parhGjsc1zxYVfnUZOp2kEMHIp8ywnOKeH/1M4dY8L5uOScBDdI8hY6ZPqiL4gX24LTo3sXxFhtIxD5mF0Oe+SohtEJ5dZ86F9Z4Ze6bwzI1n/rfkNe8u1ECaYDL6gyTHx1WyqbU56oPFtKVkTeJH03dUINPmuiZCyAVE+W8jnb9d7zRhU0hpXjQmZ7X4GpPt26SB63ceU/jPt1jTgC5d+Ie3VoB15JNzy+EzO6C0FA3vrg==Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kUjw6t4YhYbxWV5ryWB8Gh5I7W283amLES/KCz8Yrvsvfb4gkAr9+3Xkl63uJKs7xAeMTqYx4jiYc87e+Cl9uaL73qZgQaro7rRKfuHXbi+XHNRF7Ginw3vJoT/KLe6GqlZVj7qXmL1nNeiD2wx3QOUWAuWgC3JKdMSQ0xQ0V6lUKn1ZwaonPYb2NkZQMjhz2jPz0p3NKOC90c99UXQlrnXVxC8fna582siold8h9Ec4aUghj8ZKJZ0miLAr7k9cWLvPjVwJGhlsAzBkq3gha48KfXO9oJ4D9zfdTdU535qX5atCFUZvUtqWEBTR/6jMm2uSMua+LkXAJP5Tdu0b1w==Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.comCc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Ross Lagerwall" <ross.lagerwall@xxxxxxxxxx>, "konrad.wilk@xxxxxxxxxx"	<konrad.wilk@xxxxxxxxxx>, "doebel@xxxxxxxxx" <doebel@xxxxxxxxx>,	"julien@xxxxxxx" <julien@xxxxxxx>Delivery-date: Tue, 08 Mar 2022 14:53:04 +0000Ironport-data: A9a23:21ZIKq3eMh84+9IbtfbD5fhxkn2cJEfYwER7XKvMYLTBsI5bp2cBz zMeUGqGPPneZjH3c4p0OoS38E1TvpLVmNJjHAc5pC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkjk7xdOCn9xGQ7InQLlbGILes1htZGEk1EE/NtTo5w7Rj2tUw0YDja++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1RhcOWERgjMZb9p/tATyhHHgZSAJ1JreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHxO4wSoDd4xCzxBvc6W5HTBa7N4Le02R9u258XTKuHP qL1bxJAQRrPWBxRFmsvN6gwps6rnHbOQjRh/Qf9Sa0fvDGIkV0ZPKLWGNbSd9aHQe1cm0+Ko WSA82mRKhMHMN2SzxKV/3TqgfXA9QvrVYRXGLCm+/pChFyI2ndVGBAQTUG8o/Sylgi5Qd03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a9MwQ/U/WuonlrdCsT9Tpc+CQd9k1wg67VBaM0o9 gsCZ4Y5o2mfvVmHp6VO91xNPdfKla9CC4kY1jiaWgOKsk8SgbwQtjMkfII2N0=List-id: Xen developer discussion <xen-devel.lists.xenproject.org> 
 On Tue, Mar 08, 2022 at 02:38:47PM +0000, Andrew Cooper wrote:
> On 02/03/2022 14:27, Roger Pau Monne wrote:
> > diff --git a/livepatch-build b/livepatch-build
> > index 38a92be..656cdac 100755
> > --- a/livepatch-build
> > +++ b/livepatch-build
> > @@ -98,14 +98,20 @@ function build_special()
> >  
> >      # Build with special GCC flags
> >      cd "${SRCDIR}/xen" || die
> > -    sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc -ffunction-sections 
> > -fdata-sections/' Rules.mk
> > -    cp -p arch/x86/Makefile arch/x86/Makefile.bak
> > -    sed -i 's/--section-alignment=0x200000/--section-alignment=0x1000/' 
> > arch/x86/Makefile
> > -    # Restore timestamps to prevent spurious rebuilding
> > -    touch --reference=arch/x86/Makefile.bak arch/x86/Makefile
> > -    make "-j$CPUS" $XEN_DEBUG &> "${OUTPUT}/build_${name}_compile.log" || 
> > die
> > -    sed -i 's/CFLAGS += -nostdinc -ffunction-sections 
> > -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
> > -    mv -f arch/x86/Makefile.bak arch/x86/Makefile
> > +    if grep -q 'nostdinc' Rules.mk; then
> > +         # Support for old build system, attempt to set 
> > -f{function,data}-sections and rebuild
> > +        sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc 
> > -ffunction-sections -fdata-sections/' Rules.mk
> > +        cp -p arch/x86/Makefile arch/x86/Makefile.bak
> > +        sed -i 
> > 's/--section-alignment=0x200000/--section-alignment=0x1000/' 
> > arch/x86/Makefile
> > +        # Restore timestamps to prevent spurious rebuilding
> > +        touch --reference=arch/x86/Makefile.bak arch/x86/Makefile
> > +        make "-j$CPUS" $XEN_DEBUG &> "${OUTPUT}/build_${name}_compile.log" 
> > || die
> > +        sed -i 's/CFLAGS += -nostdinc -ffunction-sections 
> > -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
> > +        mv -f arch/x86/Makefile.bak arch/x86/Makefile
> > +    else
> > +        # -f{function,data}-sections set by CONFIG_LIVEPATCH
> > +        make "-j$CPUS" $XEN_DEBUG &> "${OUTPUT}/build_${name}_compile.log" 
> > || die
> > +    fi
> 
> This really ought to be the other way around, by spotting the thing we
> know is good, and then falling back to the heuristics.  In light of the
> updates to the Xen side, something like:
I'm not sure I agree. I do prefer to spot the 'bad' one, and just
fallback to expecting Xen to correctly set -f{function,data}-sections
otherwise.
> if grep -q CC_SPLIT_SECTIONS Kconfig; then
Because this logic ties us to not moving CC_SPLIT_SECTIONS from being
defined in xen/Kconfig (or even changing it's name), and gain ties the
livepatch tools to internal details about the Xen build system.
Thanks, Roger.
 |