From patchwork Thu Jun 6 16:16:47 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: 165989 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp8996567ili; Thu, 6 Jun 2019 09:17:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOIZcwVnMEcRk+V/udb3QExc4eokACs09h7QqV94SAK1oqQ13Wx8GFJmNwftH28ECpq4mK X-Received: by 2002:a62:1dd0:: with SMTP id d199mr1267008pfd.257.1559837828090; Thu, 06 Jun 2019 09:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559837828; cv=none; d=google.com; s=arc-20160816; b=FE/n5CkhUqciCbRDiGMYnqGxL2m100Z6uyQWzFUVEjS6Ak7WPQ8K8lSrDOb709Pc+c /EkTeAurbwVWcYqHtBMycARk/QP+mnZpjJy9iBHFtfzz8vjdjq3x4x02+L+kdmzfwRF5 wTpvJEsKVqGDv/r3BMqGeTV7DDnjgc3fxliAlUi5+aSOTHHVeIux4Jd1ssnWf4Rjoua7 NqdLsDMZnULRk7kSoVfI7mV9Y58RSdftyMSH11u/kM7cRUf50gTMib4SKoFIGCxaM1xl QqF/19F2vWEy2QtzRYyY1xPjFGqdV08o9lUhnERdI7hr2Iie/QUSCCmYUqSLHziSlkYT F3MA== 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=fv4+CWwSrlq/tM2GI4FYUUdc1C49J+dp5GW97PKfkkY=; b=NhOiOp9XRAERcshPjkUDgQZZTtqUn/HFTIUFIeIXPRrW78vp9EMGBi1+iaaxMn0Om3 OlyKQ23gAWLTRKM0XM6DdPyKF5acsNxmDE22vfEXDk6wNIJYwNcsGdxMs2dg2h8eSHt1 y9/xhNs5Sn1WpshebA7S5XwtNvsR2ec5/mCGa7yRRryaLwI8jg8CuOMgLaWUlpEWygs4 Bw/iPExM6GEs6UIy372cLwYzQ0kb4B0GY8CN7hgLWrftGuBeO0NWin7hpITAKRxx0eq/ ziAwC0kFAwbYSOkP0tCert9zglh5XXmKrEESDaNIRx3yzW+N7oiglqb3mhW3dsx9ok/s QJWg== 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 x10si2382097pfj.93.2019.06.06.09.17.07; Thu, 06 Jun 2019 09:17:08 -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 S1729708AbfFFQRG (ORCPT + 30 others); Thu, 6 Jun 2019 12:17:06 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:49844 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729671AbfFFQRE (ORCPT ); Thu, 6 Jun 2019 12:17:04 -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 8D07EA78; Thu, 6 Jun 2019 09:17:04 -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 A05EF3F690; Thu, 6 Jun 2019 09:17:03 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, Suzuki K Poulose Subject: [PATCH v4 4/4] coresight: etb10: Do not call smp_processor_id from preemptible Date: Thu, 6 Jun 2019 17:16:47 +0100 Message-Id: <1559837807-15447-5-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559837807-15447-1-git-send-email-suzuki.poulose@arm.com> References: <1559837807-15447-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 During a perf session we try to allocate buffers on the "node" associated with the CPU the event is bound to. If it is not bound to a CPU, we use the current CPU node, using smp_processor_id(). However this is unsafe in a pre-emptible context and could generate the splats as below : BUG: using smp_processor_id() in preemptible [00000000] code: perf/2544 Use NUMA_NO_NODE hint instead of using the current node for events not bound to CPUs. 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)