Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5897101iog; Thu, 23 Jun 2022 07:27:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tItjP+99YmsE72wUKvy5Z9WltwjWe6Sc66XOf1+ricJrtyLWGd1h/QmnXfDsXHCPFKmhwN X-Received: by 2002:a17:907:7206:b0:722:e1af:84f0 with SMTP id dr6-20020a170907720600b00722e1af84f0mr8673458ejc.740.1655994479041; Thu, 23 Jun 2022 07:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655994479; cv=none; d=google.com; s=arc-20160816; b=uXIoh2XDhno+56NY83NgBldBp995v0Hy1971yKlfdUKnyPLo0CBmY6d+JWQ4tckcoZ wxcsu0QDwsSqZ38QcmmPsBxQ0NIdYpP1tFi9QiMfAERRnC2Dt7M4b5DPjWgHoNdSVYW0 GW2z/hm+Cfzs+CGaia98BCrZnvtgDLQ1pzR29sKy/XIg/pPjmyI3385nl7wsTAWxz+f1 R6sButQy+FeO9d14hWUz3+unuwXcbmWmKnjZYds8oEPZIarkUy5NHUZbrmm/tyZpPKWV KXteY9eOt0ugIUM2Du3uW4jB6sXyq3yTq+nlp1WJ5AGD3n3LT303oYu+6VndtmRmK3h+ QgmA== 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; bh=50lUvPlYoUo/gvKOGpOZMaUu3e73Bo/gKfTz7s5u/KM=; b=zP8vejItOxfwXaKwU3vC0n9PHz9gumGjRVb4fJfwQHECPjF7CZaOfB+OaYiHgyxtx+ 6VAyUfTyMTofCqUCllq13p3kMngHpoWkQqUpxLwKlIMSfvvW0P8SQ1rEcs1NlGGXaR5A 3fa9C9DBNX93vpkxi2ZKQV1uqJUlQkVI1j4NEcuL82zsLGkMAFc9euiwztEfaBu1GWqS XHUcjZFLZ7A8fdM8Y34Bf+ty6g6zuSoSuuEHo2XocfmIpsWHAWVEnL4r9/ATEtWnbxwP iIzm8HSVTHUca11FRHEulSjODr2b8jp3yrNwYzKlE7sfVYe16IFRvy27hskJEwQ3Ik+J Vk9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p34-20020a056402502200b004355261f78csi23247741eda.531.2022.06.23.07.27.32; Thu, 23 Jun 2022 07:27:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231816AbiFWOUG (ORCPT + 99 others); Thu, 23 Jun 2022 10:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230470AbiFWOUE (ORCPT ); Thu, 23 Jun 2022 10:20:04 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A93CF43EFB for ; Thu, 23 Jun 2022 07:20:03 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9965912FC; Thu, 23 Jun 2022 07:20:03 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.26.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 012A13F66F; Thu, 23 Jun 2022 07:20:01 -0700 (PDT) Date: Thu, 23 Jun 2022 15:19:59 +0100 From: Mark Rutland To: Ard Biesheuvel Cc: Peter Zijlstra , Steven Rostedt , X86 ML , Linux Kernel Mailing List , Josh Poimboeuf , Christophe Leroy , "Naveen N . Rao" , Miroslav Benes , Nathan Chancellor , Nick Desaulniers Subject: Re: [RFC][PATCH] ftrace,objtool: PC32 based __mcount_loc Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 21, 2022 at 06:27:39PM +0200, Ard Biesheuvel wrote: > On Fri, 17 Jun 2022 at 13:40, Mark Rutland wrote: > > > > On Fri, Jun 17, 2022 at 01:24:53PM +0200, Peter Zijlstra wrote: > > > > > > Hi, > > > > > > I recently noticed that __mcount_loc is 64bit wide, containing absolute > > > addresses. Since __mcount_loc is a permanent section (not one we drop > > > after boot), this bloats the kernel memory usage for no real purpose. > > > > > > The below patch adds __mcount_loc_32 and objtool support to generate it. > > > This saves, on an x86_64-defconfig + FTRACE, 23975*4 ~= 94K of permanent > > > storage. > > > > We have a similar issue on arm64, which is exacerbated by needing ABS64 > > relocations (24 bytes per entry!) adding significant bloat when FTRACE is > > enabled. > > > > It'd be really nice if going forwards compilers could expose an option to > > generate PC32/PREL32 entries directly for this. > > As opposed to generating absolute references today? Or as opposed to > having to rely on our own tooling? Both; My prefrence would be the compiler had the option to generate these entries as relative at compile-time, without needing a binary post-processing step. That said, from my PoV this is one of the things that I think it's somewhat reasonable for objtool to do, as it's arguably akin to the build-time sort, and doesn't require deep knowledge of the control flow, etc. Thanks, Mark.