Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp969468pxb; Fri, 13 Nov 2020 00:09:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEIQMdF/i8zAKYoXnxaWieqIz40tm66WP8WyOnnHvPnz+tWvj+/Scekzqh3eelX6eW3J+Z X-Received: by 2002:a17:906:3087:: with SMTP id 7mr788621ejv.375.1605254947467; Fri, 13 Nov 2020 00:09:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605254947; cv=none; d=google.com; s=arc-20160816; b=ITC1CWSb4spIk/rZBUFoH2IArLwpQf08Bp4RW3t9SLTye8bqDoKid//9ayZpTO2e+7 UQnlrpjo2XCU24vnF78mYkXBAW2UGGgjn7ZYSoWB0JkhdeQn3HQwTHx+xmptQaqDSuUa /Dw4CKLBBNqC27aFYFvBuMQQ5/hpadPaBbfC1KusAZJxchhiBiTmQTWbHP8Vs4PpzMvY 3L9owvfTIsgNIbq7wXEhh621BlRap7nTSFJziNS6XKPiNSvmQksYIqiciHP44XVLktuT nVLamepVAzaNQCBjU6QMlLydc3rCf/cGV2/p05uckm+DmDqeTXSTIFr1bVZf2+Q6Nwhm pYYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QggK8DwEmLqdOJ4zDar4KwAw4Fzlba1W/xUK3NW8un4=; b=xekQT5WWpLlodkJ+dZ1JaOJ6g9Eplr+WeMl2b6ALnTFLVNPtWyz/dqxpPPfZqTlQ6q bNwPOie+obefkCqC3jbTAcPs8+2XoMf6aznzYMcsi+u1jcL5jhRmMDMjs8Yau9yJXoR8 6iRn6hfRLrvVkiY2eFfV5dkEYFC0I98Mkn8ZxdaEICZtIcHdxPeazkmw/8INXc9fPnG3 Ft3MvBjXQC4OfSjeFX9s07LArpaYhqs3sc7J7Ot8Um1a7SLqOCj1lAXGe2DORFiuDhWt +o6mnsa5H6JdBWAy1DiZ9O0az36AoqUcIIfYLtypXUEPZ+vHIcQfQB+xoPg3m2I1M8TI 2G+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hkDK0iBt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w8si5563795ejv.263.2020.11.13.00.08.44; Fri, 13 Nov 2020 00:09:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hkDK0iBt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726147AbgKMIG5 (ORCPT + 99 others); Fri, 13 Nov 2020 03:06:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgKMIG5 (ORCPT ); Fri, 13 Nov 2020 03:06:57 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D26B4C0613D1 for ; Fri, 13 Nov 2020 00:06:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QggK8DwEmLqdOJ4zDar4KwAw4Fzlba1W/xUK3NW8un4=; b=hkDK0iBtw0v1y8aGgL5+MkPgix ZZoy6zjBUHs5SBvOMTqYv9CSRdzx7d+fv5jFpfKhwbr9FwNtq/UqusM7JNUGzyM0BiZ0D0th4ovNS nfWknGuq82yDXaeqjkHW2Ycgene9nb6ZqFSECDZ4PB815lgZGwwZnWORrTKFMB+avkColXevbKoiB sAr/zkTGm/bL41F2wp4aq2ZimaQzpCf5GXBJmoeCby+Wra7oC4PDGiBx6mKIZx626ediwNp0lsZLh Em9mMolMBpopTitWNHh0Gd0OL58u1qiGXR6u3i6KNRX0qi1mMEeIa2gXzASjk85nTuCyQw18jdebs +vXB9ALA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdU6U-0006VB-AP; Fri, 13 Nov 2020 08:06:42 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1C8A13006D0; Fri, 13 Nov 2020 09:06:41 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 07D992C084CAB; Fri, 13 Nov 2020 09:06:41 +0100 (CET) Date: Fri, 13 Nov 2020 09:06:40 +0100 From: Peter Zijlstra To: Vasily Gorbik Cc: Josh Poimboeuf , Masami Hiramatsu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Miroslav Benes , Alexandre Chartre , Julien Thierry , linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 5/5] objtool: Rework header include paths Message-ID: <20201113080640.GY2628@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 13, 2020 at 12:03:32AM +0100, Vasily Gorbik wrote: > Currently objtool headers are being included either by their base name > or included via ../ from a parent directory. In case of a base name usage: > > #include "warn.h" > #include "arch_elf.h" > > it does not make it apparent from which directory the file comes from. > To make it slightly better, and actually to avoid name clashes some arch > specific files have "arch_" suffix. And files from an arch folder have > to revert to including via ../ e.g: > #include "../../elf.h" > > With additional architectures support and the code base growth there is > a need for clearer headers naming scheme for multiple reasons: > 1. to make it instantly obvious where these files come from (objtool > itself / objtool arch|generic folders / some other external files), > 2. to avoid name clashes of objtool arch specific headers, potential > obtool arch generic headers and the system header files (there is > /usr/include/elf.h already), > 3. to avoid ../ includes and improve code readability. > 4. to give a warm fuzzy feeling to developers who are mostly kernel > developers and are accustomed to linux kernel headers arranging > scheme. > > Doesn't this make it instantly obvious where are these files come from? > > #include > #include > > And doesn't it look nicer to avoid ugly ../ includes? Which also > guarantees this is elf.h from the objtool and not /usr/include/elf.h. > > #include > > This patch defines and implements new objtool headers arranging > scheme. Which is: > - all generic headers go to include/objtool (similar to include/linux) > - all arch headers go to arch/$(SRCARCH)/include/arch (to get arch > prefix). This is similar to linux arch specific "asm/*" headers but we > are not abusing "asm" name and calling it what it is. This also helps > to prevent name clashes (arch is not used in system headers or kernel > exports). > > To bring objtool to this state the following things are done: > 1. current top level tools/objtool/ headers are moved into > include/objtool/ subdirectory, > 2. arch specific headers, currently only arch/x86/include/ are moved into > arch/x86/include/arch/ and were stripped of "arch_" suffix, > 3. new -I$(srctree)/tools/objtool/include include path to make > includes like possible, > 4. rewriting file includes, > 5. make git not to ignore include/objtool/ subdirectory. > > Signed-off-by: Vasily Gorbik Nice! For the whole series: Acked-by: Peter Zijlstra (Intel)