Received: by 10.192.165.148 with SMTP id m20csp5014177imm; Tue, 8 May 2018 20:03:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo1mSJXI/PX8iuqaG1aq8Jn4vO9lf59QsvQ3GmpuS8cVT0rKq9NCsCdBTqujaZbUMaxIJhj X-Received: by 2002:a17:902:bb06:: with SMTP id l6-v6mr44139159pls.255.1525835017159; Tue, 08 May 2018 20:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525835017; cv=none; d=google.com; s=arc-20160816; b=rvLKD4NxyBXcWr68ZRXUHtINf+3CFgguI7qaqIXU8CoGknt7fO3OPx0BB+4A6eVysc gBoHPavBCXcK9eZfDzwwzHa3O+2BukA8kPu9Fzl1S+a+GPalOaZqZl9vYwt+2f0Mi3fy HWL5ahjVV2gmb9ArEi9pWBqMFU3ETK5pGcRHxhmnvjALk8Yb5Ihfh9vuXlt4NYnG4d5v azgoXBid3FXMfFYznq0GdhHgDKvStDQfktQ6BPWRABhHwZsWIDJVD/11cyx9AdYLMkpr At6dMfSQhzA4YCrV/dsRT0VSbUeqjk3eNf3uusjze4SHEAkeK0qmxbLK7Zxbz8JYSCdm SyNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Ry3P6TTpQOFvR6df+aDSCpSZN0eUcNiJfLWyR38I9hQ=; b=gwjMfSTZNdIFA+Tjp2g1ULaoTVwvYtPxNraXNdUdtj3mem1K3G00647ibRKdA29j3N yhjxFGUEolw+ore7wEFoCKXY5Y4FyHCwlLI4WQEhLmU1O3hdOQYF1koGYIsn9V/96d2n 3cSl4ydf7aEL80vICGhmNH82svJSiBM8T8PxmE8UOfY2rhk+Y9UnPfKuDAlZBJoGUWJv 1rLNJbUFrUwS3dxX7U9g1PJPlBKzpwNxJkytuhJT6cBlA7cYzHFBHImj1ZBe5PZZ77OK mvvQ7TQk75wJ4yZNAD4vunv2PuzHBAv8kSo58uogMYaRcUoeMYdt2/MPPDTHNzeT+XbC khGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si13011643pld.188.2018.05.08.20.03.22; Tue, 08 May 2018 20:03:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933653AbeEIDCE (ORCPT + 99 others); Tue, 8 May 2018 23:02:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:40324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932115AbeEIDCD (ORCPT ); Tue, 8 May 2018 23:02:03 -0400 Received: from vmware.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 423D72183F; Wed, 9 May 2018 03:02:02 +0000 (UTC) Date: Tue, 8 May 2018 23:02:00 -0400 From: Steven Rostedt To: Alan Kao Cc: Palmer Dabbelt , Albert Ou , , , "Ingo Molnar" , Greentime Hu , Zong Li Subject: Re: [PATCH] riscv/ftrace: Fix the problem modules cannot find _mcount Message-ID: <20180508230200.69fbf110@vmware.local.home> In-Reply-To: <20180509023605.GB7303@andestech.com> References: <1525749717-384-1-git-send-email-alankao@andestech.com> <20180508091142.12b5231a@gandalf.local.home> <20180509023605.GB7303@andestech.com> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 9 May 2018 10:36:05 +0800 Alan Kao wrote: > This EXPORT_SYMBOL and the _mcount body was inside a > "#ifndef CONFIG_DYNAMIC_FTRACE" section, so if the config has dynamic ftrace > disabled, _mcount is visible. > > For the dynamic ftrace case, there is a code snippet in this file: > > > ENTRY(ftrace_stub) > > #ifdef CONFIG_DYNAMIC_FTRACE > > .global _mcount > > .set _mcount, ftrace_stub > > #endif > > ret > > ENDPROC(ftrace_stub) I missed that, thanks. > > Talking about some bigger issues here, there will be twofold. > > 1. This patch lacks call-site collecting mechanism. > > This feature requires a pattern check in recordmcount.pl. With this, > section __mcount_loc is properly constructed, and the call-sites will be > registered during the loading stage. > > However, the loading will then fail at the first try of make_nop, due to > the instruction check. This is thus the second issue. > > > 2. The instruction check for kernel texts is not applicable to module texts. > > The check expects a call instruction to _mcount, but here it is a call to > the .plt section of the module. After referencing the implementation of arm64, > I think it would need much more work to have make_nop's and make_call's behavior > right. And powerpc64 I believe does something similar (which I think arm64 based it's work from). > > > Quick summary: This patch ensures that a kernel build will not fail because of > the _mcount-missing problem. But ftrace cannot trace loading modules for now > due to the stated reasons. Probably why they had modules break to begin with ;-) -- Steve