From patchwork Thu May 30 16:54:24 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: 165445 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1220425ili; Thu, 30 May 2019 09:54:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+k1Jg4BXpMq5JhokAPOiRs3Wv7C0M2UIEwovmS0mF7j8ztlFWMvHWjETa+mhVeOCR6kMi X-Received: by 2002:a17:902:7891:: with SMTP id q17mr4720577pll.236.1559235291952; Thu, 30 May 2019 09:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559235291; cv=none; d=google.com; s=arc-20160816; b=k4r4Ds8b/dh95EebNWRHuOoJ8CpYqawm6XkbvW6VtVxZ26bJsFNZiJw48AoTeucNTz 2ldNNu6GZLxcBm2UCOtUKLZSPr4NkgsovEbZyuxipQmKItEgiHGyYUkNtPHqobWsrLsg 1RSZ/x/3A44gM6ko6ZsPZzBuKrx48l1L1MOL46pvgVUketf28sBpuhFfvkZ2V0BRXzH7 EE2ujMNmL0MeIJcujhuhBpj0OBHZTyIPNDoC3IlWW1b6/+I46hvyjpK79PZFktR0EFo8 91pQ56jkkB/+4oloRJzDnqg4RHEOs3UjPYJx+cKF+EB3Hr8QJNDP2tNlBZvs0LmxLugi 9OdA== 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=UHhkYaJDYV5x1L8i87if343lEhBgHAmyMhsSsW++XOY=; b=ivXL4fO2jTPtNL+xMr1zRbvT1ZlTTU3f4tSfwlH15Rvy+XAbVRFTVvSbZ+C8O/o+Cu YoWX/5zSz0ovNzBiB14fIgLUYmEsYw4U5Y6jXyP+9HhScexIWKdueZqOPYN1KPq+stuc XfStpPj3rqBTWLLaTOmec/ay0h6zSNPKeYav4WtDY0xLT+NrnFTZ9aDjWkSjW/Jtnuj2 XXVcLxvX71mdEBIFo9Mqwadyn2cff6mB2yTeNdIN97hRjcC3SHoApGYS7O2/J5W1+nny /1l1lO1gg7N6KgMdQh51WpUytnQn+1OMjBksHyErUbegXY58wlsJz2oEg1UcfnQIGoeV wgKg== 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 f189si914014pfg.3.2019.05.30.09.54.51; Thu, 30 May 2019 09:54:51 -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 S1726079AbfE3Qyl (ORCPT + 30 others); Thu, 30 May 2019 12:54:41 -0400 Received: from foss.arm.com ([217.140.101.70]:39768 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbfE3Qyk (ORCPT ); Thu, 30 May 2019 12:54:40 -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 755F515AD; Thu, 30 May 2019 09:54:40 -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 422823F5AF; Thu, 30 May 2019 09:54:39 -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, robin.murphy@arm.com, Suzuki K Poulose Subject: [PATCH v3 1/4] coresight: tmc-etr: Do not call smp_processor_id() from preemptible Date: Thu, 30 May 2019 17:54:24 +0100 Message-Id: <1559235267-25232-2-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559235267-25232-1-git-send-email-suzuki.poulose@arm.com> References: <1559235267-25232-1-git-send-email-suzuki.poulose@arm.com> 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 ce0114a..7c81f63 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_NO_NODE : cpu_to_node(event->cpu); etr_perf = kzalloc_node(sizeof(*etr_perf), GFP_KERNEL, node); if (!etr_perf) From patchwork Thu May 30 16:54:25 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: 165446 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1220432ili; Thu, 30 May 2019 09:54:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFoytju8ekcM04gK9WuS67zP/KXpFOq+0zL4aFpSqESfgb4CV/D5BYuI6OVKTX4/4dsyaM X-Received: by 2002:aa7:9212:: with SMTP id 18mr4754327pfo.120.1559235292342; Thu, 30 May 2019 09:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559235292; cv=none; d=google.com; s=arc-20160816; b=PQBNN9bFYJRfmwBt7VJzXiAgbOiHv/T1YnYq5Om0DJJynJ2iL4V/AeEN8QLuw91Dla fWg1osBMC26UdXWcxVv6h78XqGWlIPxAzbvhJAJNm1GbT/fcKXpOoWkcvp3hwKMg03In ZXAOnYwhZ9r3Im5BB99U1qrtk0YTEUZW5YINR9RflDkVesMVAdJ0TPKdlkh0I6/chjNO 9GhUYydtVxNBAkj1shp17u4AI9UlGhhScwIgM5/YdSwaJ7NOsRTOtQq5F+vjU0SFEBIk UVZqJW+8o9do23RkSGyUJ95qZ+irNiIlwD3XvViSiAsRVUE9bgAqpOWoNFREXNTGp3XX rCKw== 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=3cxuBmVrz+alIEaOHH/bws4ch0YZ/E2S6epyTcglB8w=; b=fRg5CTD8z/0iUlWgLgU40n9jljUhLtcVUGwcvCjRF/hMwqqrCRQ2Y83X+IDeWZYb2Z IJxH0IO5LHbt1KvGpGqSUPaRmciV/1mwK/AfiAc5Kks21oTKnuFTqy9mS4T3HdfWOxUv KxfkoVXDh8SoIGdbnMdylPOWsRDJ/4LUscJrGgou2S95HgtcTs0xs8Yw7IRFogDMnLKP dbMBT1phxOaqLhjsJoO5Z+uNpwNlaQII0JGQDpMCGxjFXYBlfHkN74XPdyJi4JlCAY7M ipuoN9zA4r1r0DdeMII01NhVWrKYEMwJaZZl2ltPIYdq0DrErjmUX4HLnf+ulXG8c8IX rMhQ== 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 f189si914014pfg.3.2019.05.30.09.54.52; Thu, 30 May 2019 09:54: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 S1727789AbfE3Qyn (ORCPT + 30 others); Thu, 30 May 2019 12:54:43 -0400 Received: from foss.arm.com ([217.140.101.70]:39780 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727769AbfE3Qym (ORCPT ); Thu, 30 May 2019 12:54:42 -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 E5A2B165C; Thu, 30 May 2019 09:54:41 -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 B21FF3F5AF; Thu, 30 May 2019 09:54:40 -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, robin.murphy@arm.com, Suzuki K Poulose Subject: [PATCH v3 2/4] coresight: tmc-etr: alloc_perf_buf: Do not call smp_processor_id from preemptible Date: Thu, 30 May 2019 17:54:25 +0100 Message-Id: <1559235267-25232-3-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559235267-25232-1-git-send-email-suzuki.poulose@arm.com> References: <1559235267-25232-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We find the current CPU using smp_processor_id() if the event is not bound to a CPU, to find the node for memory allocation. Use the safe numa_node_id() instead, to avoid BUG(). BUG: using smp_processor_id() in preemptible [00000000] code: perf/1743 caller is tmc_alloc_etr_buffer+0x1bc/0x1f0 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 tmc_alloc_etr_buffer+0x1bc/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: 22f429f19c4135d51e9 ("coresight: etm-perf: Add support for ETR backend") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tmc-etr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 7c81f63..5d2bf6d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1184,14 +1184,11 @@ static struct etr_buf * alloc_etr_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; unsigned long size; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); - + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); /* * Try to match the perf ring buffer size if it is larger * than the size requested via sysfs. From patchwork Thu May 30 16:54:26 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: 165447 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1220440ili; Thu, 30 May 2019 09:54:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvBqQqlWVeI13Tl3AhD1pzw0o1H87TJeaVl/t6/pShk+ya5Cjijmz8Ujsa8Dn5ENeCQe+b X-Received: by 2002:a63:4d5d:: with SMTP id n29mr4680453pgl.235.1559235292718; Thu, 30 May 2019 09:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559235292; cv=none; d=google.com; s=arc-20160816; b=dG1Ktguf2ngAPdxWxVOF5Rhg9lhtFALoSdLs/O8Nw8poTj6pA2pe7zs/PcAB2CfaDe pH1WB1XZ7+vDhEjjzbu79d0WQ38bx2nz7nmId+VAH60OKI4BWcA4My62IcYQ83vmM5wJ HiZWj5BMp2LG7JGdyH7OEQWWjKmB3bzBihFMpiSJVWkcE3a5d8x86bWqlbZRwvV/+CF2 WmmQ1LokYK59+0fyFJlTTVCR9eqnMl9eyMMql+j6gmKWlBgJtNPGKJwpvS1bxk2oi1Ny fkwyISXkp0vcn+yjtWRXRJ4io8lFs3A4IeEcY89IVxYaDjkZgq5Fgi6ZVQrzervU8cZ2 eHJw== 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=N5sMMceUKXaWVwuzfKPXkG/XyaX37Rb+rEBE0sEh+kY=; b=ltGqA6ul929pBx1K/+/2pjpvYCJCtcJZQLkF9F3+b67HTPTa0zG7XY8Au5MVR5exT3 U/3IXQYxGxq5Qo1RJg3kQuCzfei9Tz7MRvfj0QA2tbwq9giaMhHq/uEdgTgguimz9TEZ cUPfi1rbqrgB77/f9m4ndk5aooW9AMhmQ7YJXoNQWk2/oJfkdld5MwIyEygJ5SCGRHFn LNuQ39SOaYmFCJHTejAhcetnDTSRIvPHJxkELxd34Mxh2wvhesUvsDCHyG5kCoqsJDwa rqocuZAB0IpYpV2IxPE0YNQF8OX7OXMzUp0bacf3hSywQbsmq9tAiLrpbXQaNUbZFEag fKPw== 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 f189si914014pfg.3.2019.05.30.09.54.52; Thu, 30 May 2019 09:54: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 S1727806AbfE3Qyr (ORCPT + 30 others); Thu, 30 May 2019 12:54:47 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39790 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727788AbfE3Qyn (ORCPT ); Thu, 30 May 2019 12:54:43 -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 6135E341; Thu, 30 May 2019 09:54:43 -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 2E1373F5AF; Thu, 30 May 2019 09:54:42 -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, robin.murphy@arm.com, Suzuki K Poulose Subject: [PATCH v3 3/4] coresight: tmc-etf: Do not call smp_processor_id from preemptible Date: Thu, 30 May 2019 17:54:26 +0100 Message-Id: <1559235267-25232-4-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559235267-25232-1-git-send-email-suzuki.poulose@arm.com> References: <1559235267-25232-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We find the current CPU using smp_processor_id() if the event is not bound to a CPU, to find the node for memory allocation. Use the safe numa_node_id() instead, to avoid BUG(). e.g: BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 caller is tmc_alloc_etf_buffer+0x5c/0x60 CPU: 2 PID: 2544 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 tmc_alloc_etf_buffer+0x5c/0x60 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: 2e499bbc1a929ac ("coresight: tmc: implementing TMC-ETF AUX space API") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index b89e29c..23b7ff0 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -377,12 +377,10 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev, struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - int node, cpu = event->cpu; + int node; struct cs_buffers *buf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); /* Allocate memory structure for interaction with Perf */ buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node); From patchwork Thu May 30 16:54:27 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: 165448 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1220456ili; Thu, 30 May 2019 09:54:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+vK8x609fr1a0RpRH+3ViWE8ARu5oerFwQPMglwbJORPjHcEbCZcrK8xzRLLWyYycHntK X-Received: by 2002:a17:90a:dd42:: with SMTP id u2mr4411651pjv.118.1559235293098; Thu, 30 May 2019 09:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559235293; cv=none; d=google.com; s=arc-20160816; b=CnhhZbIrLvg25wzbZmuVdJNqHsPL1KLaIk3RqLAPqWN/qo5Avq04oP29K/GUC5esug ugF3zIJUIZq63sgADjKlPLdmtJxIHp3mU2K2dt/pOcNoXMoBp9hEOJfglGkMcU7vvXj0 s/qynKk9uzeJuW20mcPkqVg9Ierl3t+3DZV+UHk1oGIsnzz2lD/rYnxNao60mFMmqS3Z 9T7ZibKykGVsL85WG6j6JWVPyuihwzqWjrP7mxcbrfRnKBzVoDj8a08Vml+RJGteroof PlLHqrYEw6PHBjVAzIyKU2SS1VXbK2Vg+ZoECQTdp85b1dPnartu4/BFSJIOJHb2eIlM Krbg== 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=X7Z0JW4egRHpjh2Ky6N8Rym103zzklMAQ0huiECVtgY=; b=DAlBmY2AdcMixTaZkBV+OA2PargAE+5woYTVzARc1dwoMu9+tNY2YGXUo5b8bl/II4 L3fektE081a7qR4fLhKTeW7DaF+pvCOC6u8uDCyuNK1sSQfkmHvVtUVvqzLdhuw9QcAW D90bdZeGkLOYJmo8Np1Wl5bD7AYRyM6DYTJKdaAbhohycx7+a+7MAtYnmcDkm07lmzdc FDD2YliVCa2y/7YEc4IprTt49oX9OUf4ymhDj9bbBTnD+WcUefmB4T4yNQe46jN3pu5o pSHUJtlyCytX2XFUb7FmE32dYK61e6pZ4rujRbJVhvensR/hadiEX2npCj4r4gLBDbUG XjKQ== 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 f189si914014pfg.3.2019.05.30.09.54.52; Thu, 30 May 2019 09:54:53 -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 S1727824AbfE3Qyu (ORCPT + 30 others); Thu, 30 May 2019 12:54:50 -0400 Received: from foss.arm.com ([217.140.101.70]:39800 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727791AbfE3Qyp (ORCPT ); Thu, 30 May 2019 12:54:45 -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 DB8A415AD; Thu, 30 May 2019 09:54:44 -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 9DDE53F5AF; Thu, 30 May 2019 09:54:43 -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, robin.murphy@arm.com, Suzuki K Poulose Subject: [PATCH v3 4/4] coresight: etb10: Do not call smp_processor_id from preemptible Date: Thu, 30 May 2019 17:54:27 +0100 Message-Id: <1559235267-25232-5-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559235267-25232-1-git-send-email-suzuki.poulose@arm.com> References: <1559235267-25232-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We find the current CPU using smp_processor_id() if the event is not bound to a CPU, to find the node for memory allocation. Use the safe numa_node_id() instead, to avoid BUG(). e.g: BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 Fixes: 2997aa4063d97fdb39 ("coresight: etb10: implementing AUX API") Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etb10.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index d5b9ede..3810290 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -374,12 +374,10 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - int node, cpu = event->cpu; + int node; struct cs_buffers *buf; - if (cpu == -1) - cpu = smp_processor_id(); - node = cpu_to_node(cpu); + node = (event->cpu == -1) ? NUMA_NO_NODE : cpu_to_node(event->cpu); buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node); if (!buf)