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)