From patchwork Fri May 10 09:31:03 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: 163847 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp2121193ilr; Fri, 10 May 2019 02:31:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKuoNA3zCZVUZDNUQRSYlbAljwOAOyK8kePyu2fKRvW69lr1+PCJLzVZlB1FoNrDTe1lK7 X-Received: by 2002:a17:902:bd91:: with SMTP id q17mr11637010pls.13.1557480682056; Fri, 10 May 2019 02:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557480682; cv=none; d=google.com; s=arc-20160816; b=x/rm14PfeNqWHvSSJ1gxKBfVa/NXCCFoe2JtIURP3EOiLrYuNPisks9eXl3LkKcRPI w1gvYMH9e8++YHrFie6/XjY32p36nzxTXwQwy3sf4PMf6DkflZWn2Cv0TrdoSeLKNnNo +AoJkOfDTbz+gbutzjhI/Jyjl8gHyDMclDkhwcvddloyImBJbVOsH9ziqnmL7Mnu68P9 XLHoHzTiz477Bn2zLXqbmapT0r58qvB0zi9eUxMPj14WnhUtqHfoxxSBVD+XtgZmJSyL Mfap9WB88jkqJyXvk7IEmFkscaw1x1u/Wv0P+ix9ckTT7c7UPjLrauvzO4wVeEIGMjQL K5lw== 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=lS3tz02fEv6NfJMLvvJsHmf4VbpfiR6ExoV5WaG9BSk=; b=e+spYYy02RDPybgT7uWEGsWdNZ7Z0fASZ1JBWp0aJpjQgKvDwtnRTpFj9Jx79m5uEq 3QQV3HifOSDyZ7zDboMJ/otfzk8aLQD3awUFHVCiH3uZcF/IWClUYz6lTcWl3ZW8NI/V XjLE9L+dELJHBMc6kG5w0ao6qTUxbeUGnEScETgP5It5/PyGuaJU5BWGDJ+rXO0PJ7jr iOkHVKJi8omAlzXzGSOUmc2rylRbhyaLmS1J2/mKowG2g8KPXTMEGxkmh1z0/sptekWH 6XIoYEmIssN4+BBsDa/YPlvUQaCj4uDILsxZpIMEQmFJAleEEV6fHoZqdYE0h3dnH3KM 0PBw== 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 36si7167148pgw.281.2019.05.10.02.31.21; Fri, 10 May 2019 02:31:22 -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 S1727390AbfEJJbU (ORCPT + 30 others); Fri, 10 May 2019 05:31:20 -0400 Received: from foss.arm.com ([217.140.101.70]:41152 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727365AbfEJJbT (ORCPT ); Fri, 10 May 2019 05:31:19 -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 D099CA78; Fri, 10 May 2019 02:31:18 -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 B3CF73F738; Fri, 10 May 2019 02:31:17 -0700 (PDT) From: Suzuki K Poulose To: mathieu.poirier@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, Suzuki K Poulose Subject: [PATCH 4/4] coresight: etb10: Do not call smp_processor_id from preemptible Date: Fri, 10 May 2019 10:31:03 +0100 Message-Id: <1557480663-16759-5-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1557480663-16759-1-git-send-email-suzuki.poulose@arm.com> References: <1557480663-16759-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 bdd4fd5..a38b38a 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_node_id() : cpu_to_node(event->cpu); buf = kzalloc_node(sizeof(struct cs_buffers), GFP_KERNEL, node); if (!buf)