Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp966175pxb; Tue, 9 Feb 2021 18:15:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyxa/7Dfxi6nlqGaFvvOvCYkVGXI7+0nMUqZ5wjyNi6PSpOwwQTVFFY/vu30Cac9WTPgA9 X-Received: by 2002:a17:906:cc49:: with SMTP id mm9mr664253ejb.450.1612923328700; Tue, 09 Feb 2021 18:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612923328; cv=none; d=google.com; s=arc-20160816; b=LFcxAjQadxBnHFcEQ7YtcZD9IQeKyQJerdZmPxC5bpaZU8kqJa9jxwAiYEjI96w6GM lgOKZEQ0j67PWPtPEotyHLl5Fl8lLmDMeFbVXf+ESqISNNkSsok0l1nXgy/7xMzyU3ha 6mpcGNMKfDUXlAGBsXuvuZ73kwJ/E355YMcJg6s5Lhr0EAtx7z+VWZUaiv5iRxH8fgBt EZQriOt4Uf7bV93YYRFIdu7ynmDop5EE5bWdpaonER95a/72nyTRVv0Fliqf2tUKB176 tdBG/L1KcKub+TRS/fvhUtI7Qc81XdgEM8vYKE6gjRSc/HN0M0CgxSDEi4sSUpb6tJsm NKpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=rPQJZTrg1mOyXDXVX3wmGnneb1R6HB/8qj87QmbUn3A=; b=pHbxNevXMYZk+Wd3tdMdX4fvPrJxuXDCDt/vbHUDoi7/LFotEz33iEwh1zyvY37gDg fyDfyXXayfwTof+SIyC/p2/chCwoWvj+nEvfSCLSsXhb7OdUv3Q8MEIUxVmfHwuVarbn bZLTxy4kQLhlVtZ0kin7SUwETCXHGzw1SlTw2I6d+zWeidmPDYJ9cLzPeuQHsRkQZFjA vMWSl7SqU7O4ep4iPXvE7uXUrNPuxxK5ApucinHm92BKpi5xwrYcR+XYAOV6Z4BeVj3M RBEmY67jxd43vkAoWlqez6C7zOjUuuYu/2alWndx1SpSwHCdboeZmzDKZOHQpJTsLDsL 0VuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jCwTFdSo; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 d1si328018ejj.357.2021.02.09.18.15.02; Tue, 09 Feb 2021 18:15:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=jCwTFdSo; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235290AbhBJCO0 (ORCPT + 99 others); Tue, 9 Feb 2021 21:14:26 -0500 Received: from so15.mailgun.net ([198.61.254.15]:50989 "EHLO so15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235098AbhBJCMb (ORCPT ); Tue, 9 Feb 2021 21:12:31 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1612923128; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=rPQJZTrg1mOyXDXVX3wmGnneb1R6HB/8qj87QmbUn3A=; b=jCwTFdSoFVxzJ8+ls+LF8OpR5qtb0ZpgQAXvbCqO0ZdamyIYxzflPQ5Xw55X5FproHSz36pd Pp0YJZUtY3oLsZlAAH6JXXEN/f/ug1LCfvGnZfTSa1L8AoIF3cTZNgH6+Pj24opI1EvPjYTb XRGIwYy6wq213kQ0wf2YKEq9vHQ= X-Mailgun-Sending-Ip: 198.61.254.15 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= 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-east-1.postgun.com with SMTP id 602340e83919dfb45574f944 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 10 Feb 2021 02:11:52 GMT Sender: wgong=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 1B0D0C43469; Wed, 10 Feb 2021 02:11:52 +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=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, 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 BC40FC433ED; Wed, 10 Feb 2021 02:11:50 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 10 Feb 2021 10:11:50 +0800 From: Wen Gong To: Brian Norris Cc: ath10k , linux-wireless , Steven Rostedt Subject: Re: [PATCH] ath10k: change len of trace_ath10k_log_dbg_dump for large buffer size In-Reply-To: References: <1612839593-2308-1-git-send-email-wgong@codeaurora.org> Message-ID: <19b6ad684a01718c3823f882581fca36@codeaurora.org> X-Sender: wgong@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2021-02-10 03:35, Brian Norris wrote: > + Steven Rostedt > > Hi Wen, > > (Trimming down the description a bit:) > > On Mon, Feb 8, 2021 at 6:59 PM Wen Gong wrote: >> >> Kernel panic every time in kernel when running below case: >> steps: >> 1. connect to an AP with good signal strength >> 2. echo 0x7f > /sys/kernel/debug/ieee80211/phy0/ath10k/pktlog_filter >> 3. echo 0xffff 0 > /sys/kernel/debug/ieee80211/phy0/ath10k/fw_dbglog >> 4. echo 0 > /sys/module/ath10k_core/parameters/debug_mask >> 5. sudo trace-cmd record -e ath10k >> 6. run "iperf -c 192.168.1.1 -u -b 100m -i 1 -t 30" >> 7. kernel panic immeditely >> >> It always crash at trace_event_raw_event_ath10k_xxx, below is 2 >> sample: > ... >> The value of prog in filter_match_preds of >> kernel/trace/trace_events_filter.c >> is overwrite to the content of the UDP packets's content like this >> 0x0039383736353433, it is a invalid address, so crash. > ... >> ath10k_htc_send_bundle_skbs allocate skb with size 49792(1556*32), it >> is bigger than PAGE_SIZE which is normally 4096, then >> ath10k_sdio_write >> call ath10k_dbg_dump to trace the large size skb and corrupt the trace >> data of tracing and lead crash. When disable the TX bundle of SDIO, it >> does not crash, but TX bundle is for improve throughput, so it is >> enabled >> by default. It is useless to call ath10k_dbg_dump to trace the large >> bundled skb, so this patch trace the top part of large bundled skb. > ... >> trace_event_raw_event_ath10k_log_dbg_dump is generated by compiler, it >> call trace_event_buffer_reserve got get a struct pointer *entry, its >> type is trace_event_raw_ath10k_log_dbg_dump which is also generated by >> compiler, trace_event_buffer_reserve of kernel/trace/trace_events.c >> call trace_event_buffer_lock_reserve to get ring_buffer_event. >> >> In function trace_event_buffer_lock_reserve of kernel/trace/trace.c, >> the ring_buffer_time_stamp_abs is false and trace_file->flags is 0x40b >> which is set bit of EVENT_FILE_FL_FILTERED by debugging, so it use the >> temp buffer this_cpu_read(trace_buffered_event), and the buffer size >> is 1 page size which allocatee in trace_buffered_event_enable by >> alloc_pages_node, and then ath10k pass the buffer size > 1 page >> trigger >> overflow and crash. >> >> Based on upper test, try and debugging, pass large buff size to >> function >> trace_ath10k_log_dbg_dump cause crash, and it has ath10k_dbg in >> ath10k_sdio_write to print the length of skb/buffer, it is not >> necessary >> to trace all content of the large skb. > > Is this the same issue noted in this thread? Hi Norris, Yes, but it is not the total same issue. > > [for-next][PATCH 2/2] tracing: Use temp buffer when filtering events > https://lore.kernel.org/lkml/f16b14066317f6a926b6636df6974966@codeaurora.org/ > > It seems like we should still try to get that fixed somehow, even if > the below change is fine on its own (it probably doesn't make sense to > such a large amount of data via tracepoints). It would be unfortunate > for next poor soul to hit the same issues, just because they wanted to > dump a few KB. For ath10k, we do not want to dump content which size > 1024. otherwise it will generate a much big file while collecting log, it make us much hard to analyze the log. so this patch is to dump the top 1024 bytes only, its 1st goal is make log smaller. its 2nd effect is fix the crash issue, > > Brian > >> drivers/net/wireless/ath/ath10k/debug.c | 2 +- >> drivers/net/wireless/ath/ath10k/debug.h | 2 ++ >> 2 files changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/wireless/ath/ath10k/debug.c >> b/drivers/net/wireless/ath/ath10k/debug.c >> index e8250a665433..5433dbdde0e5 100644 >> --- a/drivers/net/wireless/ath/ath10k/debug.c >> +++ b/drivers/net/wireless/ath/ath10k/debug.c >> @@ -2718,7 +2718,7 @@ void ath10k_dbg_dump(struct ath10k *ar, >> >> /* tracing code doesn't like null strings :/ */ >> trace_ath10k_log_dbg_dump(ar, msg ? msg : "", prefix ? prefix >> : "", >> - buf, len); >> + buf, min_t(size_t, len, >> ATH10K_LOG_DUMP_MAX)); >> } >> EXPORT_SYMBOL(ath10k_dbg_dump); >> >> diff --git a/drivers/net/wireless/ath/ath10k/debug.h >> b/drivers/net/wireless/ath/ath10k/debug.h >> index 997c1c80aba7..cec9ba92f28f 100644 >> --- a/drivers/net/wireless/ath/ath10k/debug.h >> +++ b/drivers/net/wireless/ath/ath10k/debug.h >> @@ -11,6 +11,8 @@ >> #include >> #include "trace.h" >> >> +#define ATH10K_LOG_DUMP_MAX 1024 >> + >> enum ath10k_debug_mask { >> ATH10K_DBG_PCI = 0x00000001, >> ATH10K_DBG_WMI = 0x00000002, >> -- >> 2.23.0 >> >> >> _______________________________________________ >> ath10k mailing list >> ath10k@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/ath10k