From patchwork Fri Jul 12 12:19:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 168950 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp830092ilk; Fri, 12 Jul 2019 05:37:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/wKtSqaZV9WRKtz0XN2gACrn+qjoqMdEVkKBsckWoCjkPnqkyOxq9wwQ2oos/ExCDALKQ X-Received: by 2002:a63:7b4d:: with SMTP id k13mr10414750pgn.182.1562935039628; Fri, 12 Jul 2019 05:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935039; cv=none; d=google.com; s=arc-20160816; b=qQ5XUq0FVmjyyPJnvfAL7tJQrEn+6pDksY0tKe9eLINmkvyjyW8GC8PCkwjjGwLXyZ e0omad/ecIIIUnHItIBwj6yGdJv17FUkwe40d7wpiH/rRIqW2PH2YbngSMmXepbRH82o 8gRum5R7B+4Y/z9mVSAH61+o9XFOKw7ghhLcRORC8AjqtrFAUauvwnVtRuUSbAAmfVL+ BeMnlMVSnO/TYvZBbvcEMgclmAamSDGdk9QakJTEmCHm4zAXwrzY/W6mH8ynRVhircAU UzLC8Zsf0Rk2JNIyZmHzTqdZO/Yysucu126tSBGSnkWBopcgybF75YeWhjRZLiwsjV3/ iYqQ== 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 v16si8368635pfi.142.2019.07.12.05.37.15; Fri, 12 Jul 2019 05:37:19 -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 S1729790AbfGLMeu (ORCPT + 29 others); Fri, 12 Jul 2019 08:34:50 -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 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)