Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752788AbdGXUYX (ORCPT ); Mon, 24 Jul 2017 16:24:23 -0400 Received: from smtprelay0161.hostedemail.com ([216.40.44.161]:37641 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751878AbdGXUYR (ORCPT ); Mon, 24 Jul 2017 16:24:17 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2771:2901:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3871:3872:3874:4250:4321:4362:5007:6261:7875:7903:10004:10400:10848:10967:11026:11232:11658:11914:12043:12050:12663:12740:12760:12895:13069:13071:13138:13231:13311:13357:13439:14096:14097:14180:14181:14659:14721:21060:21080:21627:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: cap64_7c7c448c5f44a X-Filterd-Recvd-Size: 1853 Date: Mon, 24 Jul 2017 16:24:10 -0400 From: Steven Rostedt To: Chunyu Hu Cc: mingo@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: Fix trace_pipe_raw read panic Message-ID: <20170724162410.5932cb28@vmware.local.home> In-Reply-To: <1500880866-1177-1-git-send-email-chuhu@redhat.com> References: <1500880866-1177-1-git-send-email-chuhu@redhat.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1043 Lines: 30 Hi Chunyu, Thanks for the patch. I'm currently traveling, and will have little time to test it. Hopefully I can get to it sometime this week. -- Steve On Mon, 24 Jul 2017 15:21:06 +0800 Chunyu Hu wrote: > per_cpu trace directories and files are created for all possible cpus, > but only the cpus which have ever been on-lined have their own per cpu > ring buffer (allocated by cpuhp threads). While trace_buffers_open, the > open handler for trace file 'trace_pipe_raw' is always trying to access > field of ring_buffer_per_cpu, and would panic with the NULL pointer. > > Align the behavior of trace_pipe_raw with trace_pipe, that returns -NODEV > when openning it if that cpu does not have trace ring buffer. > > Reproduce: > cat /sys/kernel/debug/tracing/per_cpu/cpu31/trace_pipe_raw > (cpu31 is never on-lined, this is a 16 cores x86_64 box) > > Tested with: > 1) boot with maxcpus=14, read trace_pipe_raw of cpu15. > Got -NODEV. > 2) oneline cpu15, read trace_pipe_raw of cpu15. > Get the raw trace data.