From patchwork Mon Aug 27 18:48:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 180265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 149622C010E for ; Tue, 28 Aug 2012 04:47:33 +1000 (EST) Received: from localhost ([::1]:53802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T64LT-0002yV-7v for incoming@patchwork.ozlabs.org; Mon, 27 Aug 2012 14:47:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T64LM-0002w8-6j for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:47:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T64LK-0004J9-Uq for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:47:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T64LK-0004J2-Mx for qemu-devel@nongnu.org; Mon, 27 Aug 2012 14:47:22 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7RIlIMR009630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Aug 2012 14:47:18 -0400 Received: from redhat.com (vpn1-4-102.ams2.redhat.com [10.36.4.102]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id q7RIlFg5031780; Mon, 27 Aug 2012 14:47:15 -0400 Date: Mon, 27 Aug 2012 21:48:29 +0300 From: "Michael S. Tsirkin" To: Jan Kiszka Message-ID: <20120827184829.GA7025@redhat.com> References: <6dcaad57552e08e4ec799d814cdcbd1c38c7f37b.1346069810.git.mst@redhat.com> <503B6CB9.6000407@siemens.com> <20120827145322.GC779@redhat.com> <503B8B5C.2010907@siemens.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <503B8B5C.2010907@siemens.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Peter Maydell , "kvm@vger.kernel.org" , "gleb@redhat.com" , "mtosatti@redhat.com" , "qemu-devel@nongnu.org" , "avi@redhat.com" , Anthony Liguori Subject: Re: [Qemu-devel] [PATCHv2 1/4] linux-headers: update to 3.6-rc3 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Mon, Aug 27, 2012 at 04:59:40PM +0200, Jan Kiszka wrote: > On 2012-08-27 16:53, Michael S. Tsirkin wrote: > > On Mon, Aug 27, 2012 at 02:48:57PM +0200, Jan Kiszka wrote: > >> On 2012-08-27 14:42, Peter Maydell wrote: > >>> On 27 August 2012 13:20, Michael S. Tsirkin wrote: > >>>> Update linux-headers to version present in Linux 3.6-rc3. > >>>> Header asm-x96_64/kvm_para.h update is needed for the new PV EOI > >>>> feature. > >>>> > >>>> Signed-off-by: Michael S. Tsirkin > >>>> --- > >>>> linux-headers/asm-s390/kvm.h | 2 +- > >>>> linux-headers/asm-s390/kvm_para.h | 2 +- > >>>> linux-headers/asm-x86/kvm.h | 1 + > >>>> linux-headers/asm-x86/kvm_para.h | 7 +++++++ > >>>> linux-headers/linux/kvm.h | 3 +++ > >>>> 5 files changed, 13 insertions(+), 2 deletions(-) > >>> > >>> The latest version of update-linux-headers.sh should have caused > >>> this update to include asm-generic/kvm_para.h, I think. Did the > >>> script not pull that header in, or were you maybe using an old > >>> version of the script or forgot to git add the new file? > >> > >> To be fair, that is hard to guess. We should add some magic to the > >> update script to detect new files and maybe suggest them for addition. > >> > >> Jan > > > > But why did you add a header to qemu without adding it > > to git? That's a cleaner solution and needs no magic scripting. > > Yes, this would have been appropriate. Still, a simple "git status -s > linux-headers" run at the end of the update script can help reminding > people in the future. > > Jan Yes. But it would be better if instead of duplicating a list of files/directories, update-linux-headers.sh would just look at what is under linux-headers and update exactly that. This removes any chance of error, and avoids the need to tweak shell scripts each time we add a header. As a bonus we do not blow away random stuff developer might have under linux-headers. Thoughts? WFM ---> scripts: better update headers Be more careful when updating headers: only update files we already have in git. Also remove need to list files in this script. Signed-off-by: Michael S. Tsirkin diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index 9d2a4bc..6607e56 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -28,23 +28,33 @@ if [ -z "$output" ]; then output="$PWD" fi -for arch in x86 powerpc s390; do - make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install - - rm -rf "$output/linux-headers/asm-$arch" - mkdir -p "$output/linux-headers/asm-$arch" - for header in kvm.h kvm_para.h; do - cp "$tmpdir/include/asm/$header" "$output/linux-headers/asm-$arch" - done - if [ $arch = x86 ]; then - cp "$tmpdir/include/asm/hyperv.h" "$output/linux-headers/asm-x86" - fi -done +IFS=$'\n' + +#get list of files +dirs=`git ls-tree HEAD -- linux-headers/|grep tree|cut -f 2` +if [ -z "$dirs" ]; then + echo "Unable to get list of directories under linux-headers/ to update" +fi -rm -rf "$output/linux-headers/linux" -mkdir -p "$output/linux-headers/linux" -for header in kvm.h kvm_para.h vhost.h virtio_config.h virtio_ring.h; do - cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux" +for d in $dirs; do + a=${d/#linux-headers\//} + case "$a" in + asm-*) + arch=${a/asm-/} + make -C "$linux" INSTALL_HDR_PATH="$tmpdir" SRCARCH=$arch headers_install + files=`git ls-tree -r HEAD -- "$d" |cut -f 2` + for dst in $files; do + src=include/asm/${dst/linux-headers\/asm-$arch\//} + cp -f "$tmpdir/$src" "$output/$dst" || exit 2 + done ;; + *) + make -C "$linux" INSTALL_HDR_PATH="$tmpdir" headers_install + files=`git ls-tree -r HEAD -- "$d" |cut -f 2` + for dst in $files; do + src=include/${dst/linux-headers\//} + cp -f "$tmpdir/$src" "$output/$dst" || exit 2 + done ;; + esac done if [ -L "$linux/source" ]; then cp "$linux/source/COPYING" "$output/linux-headers"