Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp108328ybl; Tue, 7 Jan 2020 15:09:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwDXTjXNsI0Sd9Hmz1WPSV1kefa2uffvOGVmcZJK2LKLeFjanYttpJFiyy3ayMDEYyoZ/O9 X-Received: by 2002:a9d:1c95:: with SMTP id l21mr1953130ota.271.1578438572544; Tue, 07 Jan 2020 15:09:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578438572; cv=none; d=google.com; s=arc-20160816; b=IiOs0FVMk/YWzRv0wFw74ZyT8yIalsjck/3d4+px5xMwe7S2d1vPN26HHU441AB637 tDV/Gs9RwrZO/BxzaL5Kpb9oHTiC+qxy2N05xqF84g1+tHBDSJ6vBBNcUAWdEax4BpY0 65Q9BRfNRzc+FGras8kjT1hKLfNid6zLs9wfUrUnLk2Hl9aQEcChg1X2u1nCEmn+PRuP 5POzpfu9XPFJ3nG+UauXQ7v8t/5Gv81J+Pn0YBJUyVOWClZqXtQ5L1Ang6sC7SfI9VWI gvWvi42N5DePZo8xN/X/PELRSIX66qKFeI7/yrH8vW+rGHNsXfprqpGi3ed6ejgvdWS8 Rhng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Me8p44OHEqgPZhBG5+FV+ac90SFtMdoqaV35MndRxEM=; b=RyjQicwXwYy8CyxZ1+jnruFHk3D6qRyTXMzLq9Q15TXsv6kV4iWxVfzBc+6ikqvIG9 Udfh/SwUuztuXyYfEMgBq9DJ1Koi7PRWGeYd/oza2rR224WNMEtCd7zXjmcx2Mxv+9V4 3Ln68ydRZ4EfvEenhaS2BvZBzeMtqo1ge0E4seRjuH2uvJLFjJcG0DOXUzMzLBib2++y HkkOZlz3xIeJl9XXnLiA9zgAsdVmtVJs3D4vpu/4vc+O418gkplm04njAnsVp7tngN4x vrZPj44/AJWiPcvAJpjJpKy3TjUX8BYw6fv4B2IYnXoRKTrj3KkuzQeB+tcpjTq58CUs qhlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hijSl3ni; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j16si741463otq.23.2020.01.07.15.09.21; Tue, 07 Jan 2020 15:09:32 -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=@gmail.com header.s=20161025 header.b=hijSl3ni; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727259AbgAGXI2 (ORCPT + 99 others); Tue, 7 Jan 2020 18:08:28 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:36011 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727074AbgAGXI2 (ORCPT ); Tue, 7 Jan 2020 18:08:28 -0500 Received: by mail-oi1-f193.google.com with SMTP id c16so1045920oic.3; Tue, 07 Jan 2020 15:08:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Me8p44OHEqgPZhBG5+FV+ac90SFtMdoqaV35MndRxEM=; b=hijSl3niO27gP0mmOWLLGPyLQ/8rPj0i20vGWj9ly71XDolju6F7wLF7A7Ik+ZC83h swkbBGXVTGn9gohkiEboOfEH020Ec5WdI4pmvCQq6/KxbtL9k43I6iOKdp88GFDWd4FX QhuxWOKC/SPlfIm3xI2cHzUnH9XnPsz0QGbgRtUCSjKdIb08ounyAllVl1fohUuTMMSJ 0lhEH4CxBSi55Gw2A4at7k9eWixIHo5IjWtFRMTIgb8bRxW8GMednbYcF4isUZzKSojO j/MB7dluxUvu8kwKmqwfLSdlmDw+D5noZVHBpWR+uUfp+Mp+uKOBPYQPLwn1B4GaT/bv rJ4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Me8p44OHEqgPZhBG5+FV+ac90SFtMdoqaV35MndRxEM=; b=DMV8GCbvYIkg2Feil2hzwmi9yqbRT6pu4KTYxsBOkygRb/ll27A7LTA9yM/5ocESoe lklVhlBftwMSqtJzDImM2HMIGdp+Af5iGeuKjhc2pJH3mx7HF3tyRM7ZrhKI+ul15sf+ moUxERa50JBdZE62AoXqg7lfGJ+EvZLnE4ek0t8tmM/6gGBQ0uWNeTNxfryw4IVrNLVp TUp4bEz3ptpYwUMlYMZbLJHm3u0YP0d5w9raXx8cPUBn/BZGCs9trbwEDMUNktQd1mbl ATO6/Oh9lJ1p3E1hoJlWqsZK1rx5GzIg/owo/V5HbuTQBVlG5m19YtxzHX+b8uru4W11 BLaQ== X-Gm-Message-State: APjAAAWbMB/GBTy6dmy/a9D2p3GfLYj6H134kUw0hBAurkUs5Tu0GRNb 4f+MCQlYAMHcTreyDmo3MXc= X-Received: by 2002:a54:4896:: with SMTP id r22mr760564oic.30.1578438507108; Tue, 07 Jan 2020 15:08:27 -0800 (PST) Received: from ubuntu-m2-xlarge-x86 ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id n25sm454794oic.6.2020.01.07.15.08.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Jan 2020 15:08:26 -0800 (PST) Date: Tue, 7 Jan 2020 16:08:25 -0700 From: Nathan Chancellor To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Mathieu Poirier , Suzuki K Poulose , Sasha Levin Subject: Re: [PATCH 4.14 65/74] coresight: tmc-etf: Do not call smp_processor_id from preemptible Message-ID: <20200107230825.GA26430@ubuntu-m2-xlarge-x86> References: <20200107205135.369001641@linuxfoundation.org> <20200107205228.054429793@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200107205228.054429793@linuxfoundation.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 07, 2020 at 09:55:30PM +0100, Greg Kroah-Hartman wrote: > From: Suzuki K Poulose > > [ Upstream commit 024c1fd9dbcc1d8a847f1311f999d35783921b7f ] > > 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 > caller is tmc_alloc_etf_buffer+0x5c/0x60 > CPU: 2 PID: 2544 Comm: perf Not tainted 5.1.0-rc6-147786-g116841e #344 > Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Feb 1 2019 > Call trace: > dump_backtrace+0x0/0x150 > show_stack+0x14/0x20 > dump_stack+0x9c/0xc4 > debug_smp_processor_id+0x10c/0x110 > tmc_alloc_etf_buffer+0x5c/0x60 > etm_setup_aux+0x1c4/0x230 > rb_alloc_aux+0x1b8/0x2b8 > perf_mmap+0x35c/0x478 > mmap_region+0x34c/0x4f0 > do_mmap+0x2d8/0x418 > vm_mmap_pgoff+0xd0/0xf8 > ksys_mmap_pgoff+0x88/0xf8 > __arm64_sys_mmap+0x28/0x38 > el0_svc_handler+0xd8/0x138 > el0_svc+0x8/0xc > > Use NUMA_NO_NODE hint instead of using the current node for events > not bound to CPUs. > > Fixes: 2e499bbc1a929ac ("coresight: tmc: implementing TMC-ETF AUX space API") > Cc: Mathieu Poirier > Signed-off-by: Suzuki K Poulose > Cc: stable # 4.7+ > Signed-off-by: Mathieu Poirier > Link: https://lore.kernel.org/r/20190620221237.3536-4-mathieu.poirier@linaro.org > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: Sasha Levin > --- > drivers/hwtracing/coresight/coresight-tmc-etf.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c > index 336194d059fe..329a201c0c19 100644 > --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c > +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c > @@ -308,9 +308,7 @@ static void *tmc_alloc_etf_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); This breaks the build on 4.14 (and I believe 4.19 from the looks of it) because the event variable is not available without commit a0f08a6a9fee ("coresight: Communicate perf event to sink buffer allocation functions") from upstream. I am not sure how this should be fixed (either backporting the above commit or changing this one somehow) but it should be dropped in the meantime. Cheers, Nathan