Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1750652ybl; Sat, 11 Jan 2020 02:04:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyPMCIY+cSUo3sgWTzPFW+EPZc3BnTxkG0Kv+WjS1tHKsOB66tZ/6JAFilWjoJBPopKUK0C X-Received: by 2002:aca:ec93:: with SMTP id k141mr5441803oih.145.1578737089237; Sat, 11 Jan 2020 02:04:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578737089; cv=none; d=google.com; s=arc-20160816; b=meZsgcj/CKiORYqBoJ8nRDjfPSnwagFsostIWefhHViIh+bmTxSaKkwKebFRjs9vLP NJP5tMUTYXbwjEIgfU9lm8vEsO08Biq6yGffCN+wXRgr6XGGMtVl4vihtHbaoNsA6CNm p4M+3TQlfkAyLrGjpDsRRx+4cat0nF3rjjERJIRpNzI6DqbH7s9TGxuN0g44NS6CNHtY 5VXO6QjFbmQIS2HE9XvIX+u0iUpU05Vk9XixX09zg23qBECl0M7P1VxPXkAXZeXbtjL6 RiLXAM+DcFM8CP2V7vn+g5uAh7EBcyouW8BlDrjleF7ZjZvpjcj4x3da82uRt3k75A7y HqEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lB+bHBpFFVm58ITTLCOapkRVF6ebqg/9iGNOi1zw+f4=; b=fFVE7wkJ+JhB+xEv1AEwjsWnj68tY+5n1tAQXyyttJW8jH5tBXjaIH0nN2FhXe5GJU Y3Yn/W/mYs3U8DerfQb0zCwyUlHC1aOoa2LmGc/uFnscnCC0Xme6fs0Um7lyiO8PyKUQ UwS7OXjbu5TchTnTFY9gFRPPetvk4qON3iYU3SQsw2Qhago+ntewaSrbASGhE5HL3Kws 7dnQaz2IjmIn+hXsNc2bOQOdewmgY5jmYOKgY0adYLCgipsvzoZkoTi28gZ/7Jta2pWZ nnqarwlr2Yw6vM59JaMgetR0h2nxSf1pZc+Yc7sRLFaU02HaPvNRn5E8GOe7Zv9I0Vk2 vK/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MXt4vCDP; 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 g26si3547861otj.32.2020.01.11.02.04.38; Sat, 11 Jan 2020 02:04:49 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=MXt4vCDP; 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 S1729362AbgAKKDs (ORCPT + 99 others); Sat, 11 Jan 2020 05:03:48 -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