Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932192AbdCFRZy (ORCPT ); Mon, 6 Mar 2017 12:25:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36854 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932138AbdCFRZk (ORCPT ); Mon, 6 Mar 2017 12:25:40 -0500 Date: Mon, 6 Mar 2017 11:25:37 -0600 From: Josh Poimboeuf To: Nicholas Mc Guire Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Masami Hiramatsu , Adrian Hunter , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org Subject: Re: [PATCH] objtool: drop redundant flags generation Message-ID: <20170306172537.uox2f7ru3x72jzea@treble> References: <1488819625-27395-1-git-send-email-der.herr@hofr.at> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1488819625-27395-1-git-send-email-der.herr@hofr.at> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 06 Mar 2017 17:25:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2205 Lines: 47 On Mon, Mar 06, 2017 at 06:00:25PM +0100, Nicholas Mc Guire wrote: > The generator was emitting quite a few duplicate flags which was making > doublebitand.cocci nervous. This awk hack resolves the duplicate issue. > > Signed-off-by: Nicholas Mc Guire > --- > > The coccinelle complaints emitted was about 230 findings total: > ./arch/x86/lib/inat-tables.c:214:10-20: duplicated argument to & or | > ./arch/x86/lib/inat-tables.c:214:23-33: duplicated argument to & or | > ./arch/x86/lib/inat-tables.c:218:10-20: duplicated argument to & or | > ./arch/x86/lib/inat-tables.c:218:23-33: duplicated argument to & or | > .... > ./tools/objtool/arch/x86/insn/inat-tables.c:214:10-20: duplicated argument to & or | > ./tools/objtool/arch/x86/insn/inat-tables.c:214:23-33: duplicated argument to & or | > ./tools/objtool/arch/x86/insn/inat-tables.c:218:10-20: duplicated argument to & or | > ./tools/objtool/arch/x86/insn/inat-tables.c:218:23-33: duplicated argument to & or | > ... > spatch --sp-file scripts/coccinelle/tests/doublebitand.cocci inat-tables.c -D report > will give you the full list - all are caused by duplicates in the generated > output by the add_flags function in the two instances of gen-insn-attr-x86.awk. > > Q: The two copies of gen-insn-attr-x86.awk are identical and its not actually clear > why this duplication is needed ? Further the maintainers list emitted for the > two files differ. > > Patch was checked by manual review of the diff between the initial file and the > regenerated file after the below patch was applied. > Second verification was by make tools/objtool and comparing the generated binaries > in tools/objtool/arch/x86/decode.o with diff. > > Patch is against 4.11-rc1 (localversion-next is next-20170306) > > arch/x86/tools/gen-insn-attr-x86.awk | 12 ++++++++++-- > tools/objtool/arch/x86/insn/gen-insn-attr-x86.awk | 12 ++++++++++-- There's actually a third copy of the decoder in: tools/perf/util/intel-pt-decoder/ Yes, the duplication is a pain, but it's part of an effort to keep 'tools/*' source independent from kernel code. Maybe we can at least combine the objtool and perf versions someday. -- Josh