From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91258C33C9B for ; Tue, 7 Jan 2020 21:07:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BF6E2087F for ; Tue, 7 Jan 2020 21:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431272; bh=W+ewjJ2Jn42luW3zaCJNXkWRnC/jh25sJQvQGYDWDnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uHaxS4+Xh5amgVkAuF320oHWMo6Cg9LchEKB+BIX75B/Ftcyu+zTTuTY8AM1ZdGC0 TtsqFK/iOOSTpalQ1d6Vex10x8O17pwI3085kWcYxD7Wjjuj8QQJZcmK1BUgK6ksHr 4Jvd4SnLmAA6jRSKnPz3EVJfeSaP0ceW5k5nU0J8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729421AbgAGVHv (ORCPT ); Tue, 7 Jan 2020 16:07:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:59358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728208AbgAGVHu (ORCPT ); Tue, 7 Jan 2020 16:07:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A4E522077B; Tue, 7 Jan 2020 21:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431270; bh=W+ewjJ2Jn42luW3zaCJNXkWRnC/jh25sJQvQGYDWDnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WGXoSGflreA51mro/Hp8IGrU1EDbFnFhc+ZXirl+5rKA7pkbRUVdYgrN4woxNvXGn w5Zhf5cy6w0aihUUjPXWQ53m1SX1//qYibdtM3BZExdiSaggXSK/mrkQ4K96wZBdaP RXHXJeRiZi6wP2IDHti/TT6BuQFajW1qQkIS++Xw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Suzuki K Poulose , Sasha Levin Subject: [PATCH 4.19 103/115] coresight: etb10: Do not call smp_processor_id from preemptible Date: Tue, 7 Jan 2020 21:55:13 +0100 Message-Id: <20200107205308.383005810@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Suzuki K Poulose [ Upstream commit 730766bae3280a25d40ea76a53dc6342e84e6513 ] 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 Cc: stable # 4.6+ Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20190620221237.3536-5-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/coresight/coresight-etb10.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 0dad8626bcfb..0a59bf3af40b 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -275,9 +275,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int 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) -- 2.20.1