From patchwork Wed Aug 14 10:41:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 171259 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp645524ily; Wed, 14 Aug 2019 03:41:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqynBY5Mp2Sagudr/NRRG3gLVgf37YmHrkGe2s2/LqzXuBKiFb/j9Hgy/vSQ4lrbzn0x088c X-Received: by 2002:a17:902:7686:: with SMTP id m6mr42196239pll.239.1565779312042; Wed, 14 Aug 2019 03:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565779312; cv=none; d=google.com; s=arc-20160816; b=pYWX5IngaSt3UyeM+AvmhRmhGO2CLG+hEF2oO5jGiLL6JBkOzXvEquv68NP3fdwdSs Y+QvypyTIUqyWvLDM36Xy9OkXhH+gsoc8kAz62I45wa65iyDcjCFobPWViLlzXZ2OW9n trComgNvGBIcqOvDmn+jG/UB2rRF4wYUM9q/ExKDuvILKA5M6lavx5DORXgMpYBB/XDQ COq9gO2Ldg/TqHFxhesu3gg650W7dzj+3eqQqScdxE4QASecwu73lKJ3zy8RZGy5mfsx L423dfsIoL9FpqUeRxVO6GzkMAeAM320J32TaIMqiY0pLr97gRdKBMHyXytHdexQln2g wnOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=STwRrp6FO8bML5SY3a+cNpBO8zs0tXXXaHQIkQKcLpU=; b=IDRuHRbbNimJE3G3/cCeKZNSoeY6o9fijZ9DdkMYfqhkdS9Z3+xJjNwmZ6nFjXmQcV dfPB8yISOg+fK687Id/m82XuD58tR4KCLm/VhhPkc1zz8Chu4Dx6qg7A4DRiIxV22dNg lhODcJSLTJ+nFMWXyU2oDlF5yBblx/0gz63uUUlQ8ms+C9pmvyO0ui2S/DMur50LqKky UMv40tZY+jzlEzBtVeVRoLndAQZ6kBjchRWE9zGG9purOpSnDVZDDfnUfa78P/uKQQum KKy14n7ugsmV8HSixDC0AGOUuuwwpD8tAUkHqQmTy9BM4u7rAroUMMmLKJYEDI170VxD ksBQ== 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 67si71503363pfv.74.2019.08.14.03.41.51; Wed, 14 Aug 2019 03:41:52 -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 S1727424AbfHNKlu (ORCPT + 28 others); Wed, 14 Aug 2019 06:41:50 -0400 Received: from foss.arm.com ([217.140.110.172]:51906 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbfHNKlt (ORCPT ); Wed, 14 Aug 2019 06:41:49 -0400 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 EB6AE28; Wed, 14 Aug 2019 03:41:48 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 210CD3F706; Wed, 14 Aug 2019 03:41:47 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: ak@linux.intel.com, akpm@linux-foundation.org, bigeasy@linutronix.de, bp@suse.de, catalin.marinas@arm.com, davem@davemloft.net, hch@lst.de, kan.liang@intel.com, mark.rutland@arm.com, mingo@kernel.org, peterz@infradead.org, riel@surriel.com, will@kernel.org Subject: [PATCH 4/9] arm/perf: correctly check for kthreads Date: Wed, 14 Aug 2019 11:41:26 +0100 Message-Id: <20190814104131.20190-5-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190814104131.20190-1-mark.rutland@arm.com> References: <20190814104131.20190-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The arm perf_callchain_user() functions looks at current->mm, apparently to determine whether the thread is a kthread without any valid user context. In general, a non-NULL current->mm doesn't imply that current is a kthread, as kthreads can install an mm via use_mm(), and so it's preferable to use is_kthread() to determine whether a thread is a kthread. For consistency, let's use is_kthread() here. Signed-off-by: Mark Rutland Cc: Will Deacon Cc: Ingo Molnar Cc: Peter Zijlstra --- arch/arm/kernel/perf_callchain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/arch/arm/kernel/perf_callchain.c b/arch/arm/kernel/perf_callchain.c index 3b69a76d341e..5c920f2c46a8 100644 --- a/arch/arm/kernel/perf_callchain.c +++ b/arch/arm/kernel/perf_callchain.c @@ -71,7 +71,7 @@ perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs perf_callchain_store(entry, regs->ARM_pc); - if (!current->mm) + if (is_kthread(current)) return; tail = (struct frame_tail __user *)regs->ARM_fp - 1;