Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1953605pxa; Sat, 29 Aug 2020 08:53:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHJGNRJfardFrXUn9p+BX3oiZBNJMxXxPWX/gH+ODzrGC8ghtXDn7Bm8FILD2KG4yxviYa X-Received: by 2002:a17:906:2b97:: with SMTP id m23mr4171994ejg.61.1598716426699; Sat, 29 Aug 2020 08:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598716426; cv=none; d=google.com; s=arc-20160816; b=D4NYx+lYKoGiQ/g8Vl62YHwRXsecqOGnYvobFvJO2C8lqQvjTsFVTR71Oi8zIBjPy0 lLmeMrF63KWdj69osDYjbgyCw4CxaDsJ3lr116nlaASAVv8sS6NAv8xlporWmGAbwjzl RgdAfbSTMuZTO1cA14pGrnFTHfAKmp09p+0JoqhYWEenYGjgUEElzph5/wWFjwvQDCw3 bR32DXn4aHHTJpPXcbRFOp9GFVEVhnjyfkGCGKtIf+NLRt0copQuc3LLrBE+tmx+wj8P rGXsyfZP55QmLNesfOYOZXRWOlO6avAX6cwxYU9GwRXiUDH1grVhoB72cPglaTTRJa8s rSxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=w+hd4TjghSShhgFkfzUSoPKt3rG3sRSmRVLXY4b56fM=; b=F5ErvEOXFieAlOZZgZjVFs9MQZHAhLD/vWMJOU3PMjsno8kf6ge0SboKJeyPtmsQ0m 8xkvCmnq95E1f3TMsYa++pIUsmiOzFNCc0NiAtH5sshfSF22NWM9rO3BZOqq/vfcGu3A T6m+0xk08IdhqWg3RbvOZDv8M73r/pfDQ69jH+2bQ+VzfzhCBxQ5Iww+49daEd0wkqJY JAYS/MNj8BI/QTs8EdDMRcKVWQ1sLEODZN+V/JLKxqGVhEpTuuVEii4oXcChlx9JpLpa f55Ug8VtDKXn1vFZ7f9ymxsYAUMqB1NTkVzYpuCIW5mLTLv/GDgx8VswT1Dl2s3OAqXt meMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=svvnXsQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si1855600edq.141.2020.08.29.08.53.23; Sat, 29 Aug 2020 08:53:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=svvnXsQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728373AbgH2Pwt (ORCPT + 99 others); Sat, 29 Aug 2020 11:52:49 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:60342 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728310AbgH2Pwp (ORCPT ); Sat, 29 Aug 2020 11:52:45 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1598716365; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=w+hd4TjghSShhgFkfzUSoPKt3rG3sRSmRVLXY4b56fM=; b=svvnXsQET404vEZtvWLZWBorjLnemIUWUSmoBDND4/5wda26Da6v8fVz+wpXzaFlV+EmXFew 2Kl0AsK8URHZRXMT/qVOnA2W6GwiJGetp89fAOJbxbWQmHOR+MpwpN9aZDia8EnkX+lohiKY jIDG1PVSNClfi2hwci5Xh8tRIkE= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 5f4a79c1bdef49b8a8bf93ef (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 29 Aug 2020 15:52:33 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E4566C433A0; Sat, 29 Aug 2020 15:52:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: wgong) by smtp.codeaurora.org (Postfix) with ESMTPSA id 24B5CC433CA; Sat, 29 Aug 2020 15:52:32 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 29 Aug 2020 23:52:32 +0800 From: Wen Gong To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Alexei Starovoitov , linux-kernel-owner@vger.kernel.org, ath10k@lists.infradead.org, ath11k@lists.infradead.org, abhishekpandit@google.com, briannorris@google.com, drinkcat@google.com, tientzu@google.com Subject: Re: [for-next][PATCH 2/2] tracing: Use temp buffer when filtering events In-Reply-To: <20200828185538.1761f93d@oasis.local.home> References: <20160504135202.422290539@goodmis.org> <20160504135241.308454993@goodmis.org> <20200828184955.6de9b54e@oasis.local.home> <20200828185450.101ebd09@oasis.local.home> <20200828185538.1761f93d@oasis.local.home> Message-ID: X-Sender: wgong@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-08-29 06:55, Steven Rostedt wrote: > On Fri, 28 Aug 2020 18:54:50 -0400 > Steven Rostedt wrote: > >> On Fri, 28 Aug 2020 18:49:55 -0400 >> Steven Rostedt wrote: >> >> > On Fri, 28 Aug 2020 15:53:06 +0800 >> > Wen Gong wrote: >> > >> > > this patch commit id is : 0fc1b09ff1ff404ddf753f5ffa5cd0adc8fdcdc9 which >> > > has upstream. >> > > >> > > how much size is the per cpu buffer? >> > > seems it is initilized in trace_buffered_event_enable, >> > > it is only 1 page size as below: >> > > void trace_buffered_event_enable(void) >> > > { >> > > ... >> > > for_each_tracing_cpu(cpu) { >> > > page = alloc_pages_node(cpu_to_node(cpu), >> > > GFP_KERNEL | __GFP_NORETRY, 0); >> > > If the size of buffer to trace is more than 1 page, such as 46680, then >> > > it trigger kernel crash/panic in my case while run trace-cmd. >> > > After debugging, the trace_file->flags in >> > > trace_event_buffer_lock_reserve is 0x40b while run trace-cmd, and it is >> > > 0x403 while collecting ftrace log. >> > > >> > > Is it have any operation to disable this patch dynamically? >> > >> > It shouldn't be disabled, this is a bug that needs to be fixed. >> > >> > Also, if an event is more than a page, it wont be saved in the ftrace >> > ring buffer, as events are limited by page size minus the headers. >> > >> >> Untested (not even compiled, as I'm now on PTO) but does this patch >> work for you? >> >> -- Steve >> >> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c >> index f40d850ebabc..3a9b4422e7fc 100644 >> --- a/kernel/trace/trace.c >> +++ b/kernel/trace/trace.c >> @@ -2598,7 +2598,7 @@ trace_event_buffer_lock_reserve(struct >> trace_buffer **current_rb, >> (entry = this_cpu_read(trace_buffered_event))) { >> /* Try to use the per cpu buffer first */ >> val = this_cpu_inc_return(trace_buffered_event_cnt); >> - if (val == 1) { >> + if (val == 1 || (len > (PAGE_SIZE - 8))) { > > That was suppose to be: > > if (val == 1 && (len < (PAGE_SIZE - 8))) { > > -- Steve Thanks Steve! If change like this, I think it will fix my issue of crash. Will you commit this change? > >> trace_event_setup(entry, type, flags, pc); >> entry->array[0] = len; >> return entry;