Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp111519pxb; Thu, 27 Jan 2022 16:28:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIKdQg+/Bc8uUPgGKFjyaOGpk8EzWytXsB2MhXBRbX4cgCMurkbzfFIj2ZWpE3T2Q8yIdr X-Received: by 2002:a17:907:82a3:: with SMTP id mr35mr4873475ejc.455.1643329721176; Thu, 27 Jan 2022 16:28:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643329721; cv=none; d=google.com; s=arc-20160816; b=UA6uVsxOARs8xgyE4GPc6AYzXH9RqXzcaqVBcMPiBp3KyryfgnBaj1oAbbB4TYBc9w qvY4ENcjMjRcrqjbFI5jfPrTJeWRtqOn1t3mN66SZSajWvTeXqeodXsvXhGOvH/5Kd4H SEmrKbThvq942cukxxhYHocY3Wt84Uirzd5URfoayCfNGFMHM9kO27Tj4VG211qwTuRJ nR4f3AgWR/ViQObzTRH8xdr2eDOBafRz7cXCQPoTMpjetxPnykMZnB5Eu2lR9V9/8cZd MjUqymS2ZmPkX57jVAcHAorb+Iq2w4A0i+7rR+3BuXaRNxE9/2HA5K7rXJk3n+EWXVC6 PmiA== 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=BHlPBlLHMWgltCG1nd1XBcBtkdIKUmS9W6wWCDNmIjU=; b=B27+TqPnnNXIUx7Jn0Gx0fvx42T8GCev51jLcWTdCiGl8LQ6SzuYEteG8jig3b0vrp l0QtcEIhTiMWf0YCYNgmurzOxbwFPoV/vbaqQ+88EegHZ0eaRXEKcff/XZwcFI5qw/ZJ QnWiY4EzC6xOAUxabse3w+QYY7tCDovIzYU1usaxl7qbcZ9FsNOCj/ERTEAOkZOjD4NH kkiyVjFjAGb7UgZTJfY4oUD4VNqYPA0hMAZXz6vlHX1F/aEctnRYlgMGOAcQJBLfydyF O3pptUunjPTwaiSFyvvPFDIRkgnq/6IytFIIM/BT/gi16RhcDr68LH5/rWBzo+TPXix4 FACA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q15si2649097edd.93.2022.01.27.16.28.14; Thu, 27 Jan 2022 16:28:41 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241561AbiA0NJB (ORCPT + 99 others); Thu, 27 Jan 2022 08:09:01 -0500 Received: from foss.arm.com ([217.140.110.172]:60666 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241485AbiA0NJA (ORCPT ); Thu, 27 Jan 2022 08:09:00 -0500 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 78C161063; Thu, 27 Jan 2022 05:09:00 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.14.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 169AE3F766; Thu, 27 Jan 2022 05:08:58 -0800 (PST) Date: Thu, 27 Jan 2022 13:08:46 +0000 From: Mark Rutland To: Steven Rostedt Cc: Sven Schnelle , Yinan Liu , linuxppc-dev@lists.ozlabs.org, Sachin Sant , linux-kernel@vger.kernel.org, ardb@kernel.org, keescook@chromium.org Subject: Re: [powerpc] ftrace warning kernel/trace/ftrace.c:2068 with code-patching selftests Message-ID: References: <944D10DA-8200-4BA9-8D0A-3BED9AA99F82@linux.ibm.com> <20220124114548.30241947@gandalf.local.home> <0fa0daec-881a-314b-e28b-3828e80bbd90@linux.alibaba.com> <20220127074601.41a3773d@rorschach.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220127074601.41a3773d@rorschach.local.home> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2022 at 07:46:01AM -0500, Steven Rostedt wrote: > On Thu, 27 Jan 2022 12:27:04 +0000 > Mark Rutland wrote: > > > Ah, so those non-ELF relocations for the mcount_loc table just mean "apply the > > KASLR offset here", which is equivalent for all entries. > > > > That makes sense, thanks! > > And this is why we were having such a hard time understanding each other ;-) ;) With that in mind, I think that we understand that the build-time sort works for: * arch/x86, becuase the non-ELF relocations for mcount_loc happen to be equivalent. * arch/arm, because there's no dynamic relocaiton and the mcount_loc entries have been finalized prior to sorting. ... but doesn't work for anyone else (including arm64) because the ELF relocations are not equivalent, and need special care that is not yet implemented. So we should have arm and x86 opt-in, but for now everyone else (including arm64, powerpc, s390) should be left with the prior behaviour with the runtime sort only (in case the build-time sort breaks anything, as I mentioned in my other mail). Does that sound about right? In future we might be able to do something much smarter (e.g. adding some preprocessing to use relative entries). I'll take a look at shelf. :) Thanks, Mark. > I started a new project called "shelf", which is a shell interface to > read ELF files (Shelf on a ELF!). > > It uses my ccli library: > > https://github.com/rostedt/libccli > > and can be found here: > > https://github.com/rostedt/shelf > > Build and install the latest libccli and then build this with just > "make". > > $ shelf vmlinux > > and then you can see what is stored in the mcount location: > > shelf> dump symbol __start_mcount_loc - __stop_mcount_loc > > I plan on adding more to include the REL and RELA sections and show how > they affect symbols and such. > > Feel free to contribute too ;-) > > -- Steve