From patchwork Fri May 3 16:04:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 163327 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp780113ill; Fri, 3 May 2019 09:04:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpzVUIdi0hYCDbcrmvvb8G1r+P6Ulnu2LvfVhelTZCw8F0ZKszzGS3z0n2MNCNIrPk9PfQ X-Received: by 2002:a63:8741:: with SMTP id i62mr11190595pge.313.1556899478105; Fri, 03 May 2019 09:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556899478; cv=none; d=google.com; s=arc-20160816; b=R0MoEhtzZ6RjSTtD0nXj94clUwPLuObg9fvJkkDyJrlTTg88gXxRK9Myj+kimhrbU+ nkr8hSmBiqeYreZnwQ/M6xTtzTmvNRWLh9jGVKR6f7tZSZUZqPDjsUQP9ff/1KR4ZFdc PCNN+qZcr0JDRsYGfUu/elJ8lwpEZu/PFfTnv4kQHcNITreAq8S9QC6i0Nx3YplCC92L CJpwWEmP2k82pVCbuRR51FWOfU+2gQz/Dfg0VjpM4D2S1JIanp5xFhAEadBjxRuB1Dt3 X9LeKeoSiRQkBFpGFyb5nWtKFf/vi9BX4URtESQfb14F9TL5zDgvGsmHIqyqZ2tchsuc CsZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=NPabAkHH2wE/XyFUr+kCZaGnKZWE96JWbJuNaLNCsYs=; b=C92Tl0aXWqLF6jQDv4wtTtHMZ0owqT+n02Q7aZPPW02WqfVN4qnJ6NFmU4CAmSJLwC 6L6Gk7cRZKqvUeMlpUgeBpu1FRpd5JU3Q32/sRlr5FO/AxYwsMwAWuNhGA4uOWLjYPvC c3IzVR+A3fdalfaAjFZgCjR2ubvUmZsB7mGqeacFx3AW+z3d55m6SsVBU9RixiMWHcm8 IXGzQ4MNsy74/hHDA/Ir36Lc+oHewb/BeTyoOc95OpFINvrOD2yUtzVWLD726Yaz51jl bXrBPc1iutqZpz3hW3Kv+LCOSYwwpQZ4LNx62rpt9DGszf/sDMgGYBo9L8H1oMNTdhrh CBYA== 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 f10si2589712pgv.589.2019.05.03.09.04.37; Fri, 03 May 2019 09:04:38 -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 S1728424AbfECQEg (ORCPT + 30 others); Fri, 3 May 2019 12:04:36 -0400 Received: from foss.arm.com ([217.140.101.70]:36362 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbfECQEg (ORCPT ); Fri, 3 May 2019 12:04:36 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5619B374; Fri, 3 May 2019 09:04:35 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3AB533F557; Fri, 3 May 2019 09:04:34 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, Suzuki K Poulose Subject: [PATCH 1/2] coresight: Do not call smp_processor_id() from preemptible Date: Fri, 3 May 2019 17:04:18 +0100 Message-Id: <1556899459-27785-1-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of using smp_processor_id() to figure out the node, use the numa_node_id() for the current CPU node to avoid splats like : BUG: using smp_processor_id() in preemptible [00000000] code: perf/1743 caller is alloc_etr_buf.isra.6+0x80/0xa0 CPU: 1 PID: 1743 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 Call trace: dump_backtrace+0x0/0x150 show_stack+0x14/0x20 dump_stack+0x9c/0xc4 debug_smp_processor_id+0x10c/0x110 alloc_etr_buf.isra.6+0x80/0xa0 tmc_alloc_etr_buffer+0x12c/0x1f0 etm_setup_aux+0x1c4/0x230 rb_alloc_aux+0x1b8/0x2b8 perf_mmap+0x35c/0x478 mmap_region+0x34c/0x4f0 do_mmap+0x2d8/0x418 vm_mmap_pgoff+0xd0/0xf8 ksys_mmap_pgoff+0x88/0xf8 __arm64_sys_mmap+0x28/0x38 el0_svc_handler+0xd8/0x138 el0_svc+0x8/0xc Fixes: 855ab61c16bf70b646 ("coresight: tmc-etr: Refactor function tmc_etr_setup_perf_buf()") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 793639f..74578bd 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1323,13 +1323,11 @@ static struct etr_perf_buffer * tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, struct perf_event *event, int nr_pages, void **pages, bool snapshot) { - int node, cpu = event->cpu; + int node; struct etr_buf *etr_buf; struct etr_perf_buffer *etr_perf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1)? numa_node_id() : cpu_to_node(event->cpu); etr_perf = kzalloc_node(sizeof(*etr_perf), GFP_KERNEL, node); if (!etr_perf)