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=unavailable 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 3BBBBC33CA3 for ; Sat, 11 Jan 2020 10:03:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09A4320848 for ; Sat, 11 Jan 2020 10:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578737030; bh=TTK2Fus7mMkr6fxMhauBcG0OZlbuna8uqsLg7oz+J4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NhlQINUAxn4707WfGk3cdsMZFMHahjsQ0u0ROpreCZ56pposUm/BjVJ0UVs4ndYKw E/bP9R1pTw3rpKsu6o0Bysw4m0/8pgCcVgPZns2s1bSrcFS7Ar9MqVkBwcvydk/ZeA zXtKe8V21eEphCQjysITuV3QqFxxs1j7lEASCFtM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729468AbgAKKDt (ORCPT ); Sat, 11 Jan 2020 05:03:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:35412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728832AbgAKKDs (ORCPT ); Sat, 11 Jan 2020 05:03:48 -0500 Received: from localhost (unknown [62.119.166.9]) (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 6E18320866; Sat, 11 Jan 2020 10:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578737027; bh=TTK2Fus7mMkr6fxMhauBcG0OZlbuna8uqsLg7oz+J4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MXt4vCDPKvXZDDA4rMtu7wWom6+JyVo5bnvHYW5/9VbGOn6684NIKjNcdBJYxblI9 5aiPCYROElIMPDRarxBPoQkdk4LL3xlU3zeiOhh+oXtry6vjU9VSNNtVFHxdnlPONc EgqHY2MXpt0TVvDNs6GwNg1RJpOk5aVlogBbK3WA= 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.9 48/91] coresight: etb10: Do not call smp_processor_id from preemptible Date: Sat, 11 Jan 2020 10:49:41 +0100 Message-Id: <20200111094903.179722226@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094844.748507863@linuxfoundation.org> References: <20200111094844.748507863@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 ace55385b26f..245c32b52355 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -279,9 +279,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