Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp929600ybt; Wed, 24 Jun 2020 15:07:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4d7Th6i0e5Pg11QAZyxv+QIHmLEq4QL0RkHFt82BtGMTzsJcVqwbHYibLLHHsw9M0LyTm X-Received: by 2002:a50:a701:: with SMTP id h1mr28195994edc.170.1593036438123; Wed, 24 Jun 2020 15:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593036438; cv=none; d=google.com; s=arc-20160816; b=cb9MIWijw0lXoaVwQpUMuEmAzSrVrnc5SczOIvbPsdSjsqfkhljegVarz+CEjCLiry eXx1Z737bVx1rM65/ddJXikoUI7U0Kn1KCtEIOilCl8uC71g9tgwUdtFPHu262ecq9LU eb652ljb+3WKZegPfkphOg4D7IY1HNExvauNKAGvhGzJmjNoPZUSjwckvn3/rGYtvGI6 ex92M/cUMuAN9PzwfzQ67jgPUZQ8iVIP2PerzREP8Z9EHirurUlvLLVF5bOnvN3b4Aox t8EV8M8QkgA1mjpUqiTMMSLOoIL5YZm6Z9epxhpP9fEDgOpXmo6Npqi8rMA/9i2eieVo lmTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2I1W9/xF2d1Vj6fXUSW50a6lcRysW14cejGyX/KQrUE=; b=xkCGl1jeZKTdJuA0utw0rC44ARvwF3jJ4QhX9YKhEKvMTUbWSdGXhi6iyTxD4WTBAI NTBKF3MUXYw2xpRp4p3BZaBdfbdHtUKoUJH8STeOhYXN5VTzIGvPhxXmETR+m28VXVVA J8xMss/H2nmZNMq5E1nQ59GVxq6TvrGjlMtgzpzAMbVlu6U94ZcIza0iXyEG3ZYlBHbl mNhJybO4Rzt+XEupQf5WPgP4CifyF2ypZsNj6DrunHFqiF2LJ29HDjPEfJhXmyARRqAp +6vdxThrPpY69XwHnbgx3tiF/+kCXwU7+OX1UvUILQnRNJmtB9A+zCOKGxcnS+sP1xqe COvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kAzFiuub; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si1812192edv.570.2020.06.24.15.06.54; Wed, 24 Jun 2020 15:07:18 -0700 (PDT) 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=@google.com header.s=20161025 header.b=kAzFiuub; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404702AbgFXVpl (ORCPT + 99 others); Wed, 24 Jun 2020 17:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404672AbgFXVpj (ORCPT ); Wed, 24 Jun 2020 17:45:39 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDB46C061795 for ; Wed, 24 Jun 2020 14:45:37 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id jz3so1786581pjb.0 for ; Wed, 24 Jun 2020 14:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2I1W9/xF2d1Vj6fXUSW50a6lcRysW14cejGyX/KQrUE=; b=kAzFiuub3JptGeF8CNTcnC+CeP/FsxM38jl9PiZjmZ2NQEKCzf5W55HotGQ3RFsl47 OU28gJzz3nFm0K+qZFZj3aI4XkCmA0i32hx7kEqSPXYASiEOFWG196YJXulcZC3Y9dyz 7yrrrZ4gUvmMXog64rqdi3irHXMSe28OJl0jht0IedPAX5FdSbei28cHde7gFfC8WQTO Th94MFJ7oKpcHcW0N9ISYWBLrKFqFcAygWKu8Bgdc273Y+lpnMx+5Oa57A1RVV779WXs N9wCMhhfGA+gmYVaSfQFrOgexBHpRg0exI1Q7NtzxhM5Ml3G7MxFC3aUmhMIk7wXvif6 SpYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2I1W9/xF2d1Vj6fXUSW50a6lcRysW14cejGyX/KQrUE=; b=kzHEgWUE/ggEeBBi7jTZfEVt/qlRW9GF4Z29/ILXI8s15tCSpVmragwsW1lcS2alrJ LStW04ezrQEoCfrXRQ2Hp4Xe8G8D7V6qEIYVo7FQQ6n7/VCKnxYpOVbiOdWaEkAucQI2 4avHkLo2TUZZagu6WiypDMPXkyNP3IzR465gpKI+kn0pWaWhr1j3SSmOta7mJy7/e/Pr Vu0iEHU4gGWoztBfNNlYbzqznx/ibM+ycmOdjGurKBf5KIzz84I8F3ODkXfIG26cQnSP ZMeDB9YiHYwBupkMr0AQVf26yH3bqUwnBpeGCit27+Ks7knZGPy4vJMpyBjLym/LD18O WtAw== X-Gm-Message-State: AOAM5301kfqk1HuZ/QGq+lJX7OYZEIswuliVeX1Qfs2nFSXhMngZ6xFm IeD0TIM/Phj6CfkefvN/CrR+4A== X-Received: by 2002:a17:90b:916:: with SMTP id bo22mr7503001pjb.100.1593035136962; Wed, 24 Jun 2020 14:45:36 -0700 (PDT) Received: from google.com ([2620:15c:201:2:ce90:ab18:83b0:619]) by smtp.gmail.com with ESMTPSA id x1sm20175037pfn.76.2020.06.24.14.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 14:45:36 -0700 (PDT) Date: Wed, 24 Jun 2020 14:45:30 -0700 From: Sami Tolvanen To: Peter Zijlstra , Steven Rostedt Cc: Masahiro Yamada , Will Deacon , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 04/22] kbuild: lto: fix recordmcount Message-ID: <20200624214530.GA120457@google.com> References: <20200624203200.78870-1-samitolvanen@google.com> <20200624203200.78870-5-samitolvanen@google.com> <20200624212737.GV4817@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624212737.GV4817@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 11:27:37PM +0200, Peter Zijlstra wrote: > On Wed, Jun 24, 2020 at 01:31:42PM -0700, Sami Tolvanen wrote: > > With LTO, LLVM bitcode won't be compiled into native code until > > modpost_link. This change postpones calls to recordmcount until after > > this step. > > > > In order to exclude specific functions from inspection, we add a new > > code section .text..nomcount, which we tell recordmcount to ignore, and > > a __nomcount attribute for moving functions to this section. > > I'm confused, you only add this to functions in ftrace itself, which is > compiled with: > > KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)) > > and so should not have mcount/fentry sites anyway. So what's the point > of ignoring them further? > > This Changelog does not explain. Normally, recordmcount ignores each ftrace.o file, but since we are running it on vmlinux.o, we need another way to stop it from looking at references to mcount/fentry that are not calls. Here's a comment from recordmcount.c: /* * The file kernel/trace/ftrace.o references the mcount * function but does not call it. Since ftrace.o should * not be traced anyway, we just skip it. */ But I agree, the commit message could use more defails. Also +Steven for thoughts about this approach. Sami