Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp846089ybi; Fri, 12 Jul 2019 05:37:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwg4PRGoYTxvtvqsepsoG4KUNPrUdn19wQTTikZx/s8w82tim0P9a+mq66Kdtlwpq9/cgqk X-Received: by 2002:a63:d84e:: with SMTP id k14mr10652948pgj.234.1562935030105; Fri, 12 Jul 2019 05:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935030; cv=none; d=google.com; s=arc-20160816; b=P/PwwZNznhdIcdU+C9FNIl0jUw6mwzepEZYYr7PZ1PS946SJfSGz6z+mldkEZD68yT C6+b6Vy0nDMB/8xv3fP5zWSALki037DyDzheExy+y1wDUKvNKMfasP+mrL3qGZ/CgY8t 8ce8/XSz95JFVr2Yv31TjREJ7kuXarb93H8OZd0+VfLKMZqevoP025AnJumZhpel6jn/ qLgRokq2gpLPHxdSCLGbgTTEWFLm/BKyPOZVHH3tmKPjGXVXeWc1+pjCMPoQq5b+t7lx xQwtf5oEylLfaPxy2NTljm1jaa2mmjZWE8K+pYFp0kM2iMF1U47qDN9IG/7Lo2DKoamX AE1w== 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=lAgepx2nzmLx67TF00qsEdHj2skmTakuuPNhTugdMeM=; b=DyLGvUG7lWjLv6NQaouL7ZP0/i36ntezysHY/6uoAD6T0beODfdLo3+Ik6/9kEQbU8 sLlN2AzEYzU67EUL/zHUF7BEwjKIYvY0XUfkKpXYAxFiCeGrNW5asnKtNkVs+VuwqSPw uu9eXNlZ8K/cdHsLyyAUSVEflGe9vqPcGr474aXvIdnpqXDX4HqnLi2m6NA7sUjj2c/u t5SLixBCdNJvHSwRtPGa1N/xlscEMQ6KvPTI3SQgME68xh7Pl4Z8IPDxGnj6+sumGaPC X9jx5W899guMlvLMy2EkbeT7ZO659OP22fpHZoNbT8gSRdvcLCqp3mOWYArw+1x6Enh8 6npw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TTTxNfKt; 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 b18si7471649plz.389.2019.07.12.05.36.54; Fri, 12 Jul 2019 05:37:10 -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; dkim=pass header.i=@kernel.org header.s=default header.b=TTTxNfKt; 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 S1729506AbfGLMet (ORCPT + 99 others); Fri, 12 Jul 2019 08:34:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:54886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729213AbfGLMeq (ORCPT ); Fri, 12 Jul 2019 08:34:46 -0400 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 69AE320645; Fri, 12 Jul 2019 12:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934885; bh=QmKnUG+IKIzYAACa0xAZB+0Oimp/n+KJPMPj8GJ7ajc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TTTxNfKt/X6aVAvdBfyzCVFa5JkmFBQS+Y720iqms4DhixSnh/sYmLh6EFvuRBfMu 7gvd9i/qyHZn01HmSB/KnUqUJQI2rpnLKfPbmwSnGfg8O7IHCAOloLLCbVjglEXA+y TJsMcubCV7roMonkN/03Li021sQFQVv7E8bZJ4t0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Suzuki K Poulose Subject: [PATCH 5.2 46/61] coresight: etb10: Do not call smp_processor_id from preemptible Date: Fri, 12 Jul 2019 14:19:59 +0200 Message-Id: <20190712121623.098342297@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121620.632595223@linuxfoundation.org> References: <20190712121620.632595223@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 commit 730766bae3280a25d40ea76a53dc6342e84e6513 upstream. 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 --- drivers/hwtracing/coresight/coresight-etb10.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -373,12 +373,10 @@ static void *etb_alloc_buffer(struct cor 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)