Message ID | 20230804124549.2562977-2-zhengyejian1@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:44a:b0:3f2:4152:657d with SMTP id ez10csp245927vqb; Fri, 4 Aug 2023 06:04:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbeq5bphm/iAxw62fK+lWWHQf4UWv1K3umoCzaXwO6HBTCoDxQ3MCZUGVT8Gu8cchk6o70 X-Received: by 2002:a05:6a20:3d84:b0:137:c971:6a0c with SMTP id s4-20020a056a203d8400b00137c9716a0cmr1899898pzi.31.1691154240934; Fri, 04 Aug 2023 06:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691154240; cv=none; d=google.com; s=arc-20160816; b=cybJvRynCvbGqFJBa3vLRiOal62R55EyFao8s+1qcd/kcAWOe35WMEt5KDn7xO8X28 r6fnWttu+LsEVAQCAXhCpHN6XStplkwkBXZ3AGRYdye3aL4JWcBIleG1Q/zgsMfvmVgC Dks4/Y0jj2iY9uK44B9ev+hPlvSOlN58joc/BPQIEkRf50SfrvHbb/XgeJefBgE3N0lO 8jLo5PZa5bloyDLmsjzANfUjOqCUd2DpggWWaxn7/wLNOUZYPhWo7fgqsCkSYImJ0X3y PPYeev8tKPs0+RjzkGsb8wOafa/Z3SSlt2bf2mcEtPHhx0sH2n6pCip+Iv2cp7lvAsDJ jyMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LEVg9wirPEV+VJVrJQ78tfW3hNFiD9W6Lxb0G6/HWQE=; fh=6BCBHd+wd9sM5I7f3nZwXI5uSly3s62mQle808OwsEg=; b=P9j3hHCFSvER3iTikWSBv091cGuM7Mv8aas0y2qerJ+KOeQ6WLulZSW4iQacIGLIM1 Vg8LSp87vXoQmP5+/CS+0ivHbYt9QsIphDTeAtgoyEE1pFyWBNE1Qwt92ttfcrk5XRir 2JMJtlsO1dJMm4smmV60HJtrbFEOSxfAWG+HJmvoWSiqDCCVTyvizPEub7izhBa6RGAj mPMqo+lOhb9XaGXfeJ0wjTN1vXAslDTET6pu5aXVNIGSib5yT7duVEkkAn5hGqOIiDIN LuTTUQ1xVRfQNcDIPrgtEZmTjfVa4jjxnznVwbP5ybd4VMUwz0CfgkTCf9vdratZRFaH TZhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn11-20020a056a00340b00b00661cd40bd67si1617086pfb.314.2023.08.04.06.03.16; Fri, 04 Aug 2023 06:04:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbjHDMqj (ORCPT <rfc822;sukrut.bellary@gmail.com> + 99 others); Fri, 4 Aug 2023 08:46:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbjHDMqa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 4 Aug 2023 08:46:30 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2E1A46B2; Fri, 4 Aug 2023 05:46:28 -0700 (PDT) Received: from dggpeml500012.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RHQRP5mPBz1KC70; Fri, 4 Aug 2023 20:45:21 +0800 (CST) Received: from localhost.localdomain (10.67.175.61) by dggpeml500012.china.huawei.com (7.185.36.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 4 Aug 2023 20:46:26 +0800 From: Zheng Yejian <zhengyejian1@huawei.com> To: <rostedt@goodmis.org>, <mhiramat@kernel.org>, <vnagarnaik@google.com>, <shuah@kernel.org> CC: <linux-kernel@vger.kernel.org>, <linux-trace-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org> Subject: [PATCH 1/2] tracing: Fix cpu buffers unavailable due to 'record_disabled' messed Date: Fri, 4 Aug 2023 20:45:48 +0800 Message-ID: <20230804124549.2562977-2-zhengyejian1@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230804124549.2562977-1-zhengyejian1@huawei.com> References: <20230804124549.2562977-1-zhengyejian1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.175.61] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500012.china.huawei.com (7.185.36.15) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773303749145505185 X-GMAIL-MSGID: 1773303749145505185 |
Series |
tracing: Fix cpu buffers unavailable problem and add its testcase
|
|
Commit Message
Zheng Yejian
Aug. 4, 2023, 12:45 p.m. UTC
Trace ring buffer can no longer record anything after executing like:
# cd /sys/kernel/tracing
# cat tracing_cpumask
fff
# echo 0 > tracing_cpumask
# echo 1 > snapshot
# echo fff > tracing_cpumask
# echo "hello world" > trace_marker
-bash: echo: write error: Bad file descriptor
The root cause is that:
1. After `echo 0 > tracing_cpumask`, 'record_disabled' of cpu buffers
in 'tr->array_buffer.buffer' became 1 (see tracing_set_cpumask());
2. After `echo 1 > snapshot`, 'tr->array_buffer.buffer' is swapped
with 'tr->max_buffer.buffer', then the 'record_disabled' became 0
(see update_max_tr());
3. After `echo fff > tracing_cpumask`, the 'record_disabled' become -1;
Then array_buffer and max_buffer are both unavailable due to value of
'record_disabled' is not 0.
To fix it, enable or disable both array_buffer and max_buffer at the same
time in tracing_set_cpumask().
Fixes: 71babb2705e2 ("tracing: change CPU ring buffer state from tracing_cpumask")
Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
---
kernel/trace/trace.c | 2 ++
1 file changed, 2 insertions(+)
Comments
Hi Zheng, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [cannot apply to rostedt-trace/for-next-urgent] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Zheng-Yejian/tracing-Fix-cpu-buffers-unavailable-due-to-record_disabled-messed/20230804-204751 base: linus/master patch link: https://lore.kernel.org/r/20230804124549.2562977-2-zhengyejian1%40huawei.com patch subject: [PATCH 1/2] tracing: Fix cpu buffers unavailable due to 'record_disabled' messed config: i386-randconfig-r025-20230731 (https://download.01.org/0day-ci/archive/20230805/202308050048.bUnVeBjV-lkp@intel.com/config) compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) reproduce: (https://download.01.org/0day-ci/archive/20230805/202308050048.bUnVeBjV-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202308050048.bUnVeBjV-lkp@intel.com/ All errors (new ones prefixed by >>): >> kernel/trace/trace.c:5280:39: error: no member named 'max_buffer' in 'struct trace_array' ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); ~~ ^ kernel/trace/trace.c:5286:38: error: no member named 'max_buffer' in 'struct trace_array' ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); ~~ ^ 2 errors generated. vim +5280 kernel/trace/trace.c 5260 5261 int tracing_set_cpumask(struct trace_array *tr, 5262 cpumask_var_t tracing_cpumask_new) 5263 { 5264 int cpu; 5265 5266 if (!tr) 5267 return -EINVAL; 5268 5269 local_irq_disable(); 5270 arch_spin_lock(&tr->max_lock); 5271 for_each_tracing_cpu(cpu) { 5272 /* 5273 * Increase/decrease the disabled counter if we are 5274 * about to flip a bit in the cpumask: 5275 */ 5276 if (cpumask_test_cpu(cpu, tr->tracing_cpumask) && 5277 !cpumask_test_cpu(cpu, tracing_cpumask_new)) { 5278 atomic_inc(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); 5279 ring_buffer_record_disable_cpu(tr->array_buffer.buffer, cpu); > 5280 ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); 5281 } 5282 if (!cpumask_test_cpu(cpu, tr->tracing_cpumask) && 5283 cpumask_test_cpu(cpu, tracing_cpumask_new)) { 5284 atomic_dec(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); 5285 ring_buffer_record_enable_cpu(tr->array_buffer.buffer, cpu); 5286 ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); 5287 } 5288 } 5289 arch_spin_unlock(&tr->max_lock); 5290 local_irq_enable(); 5291 5292 cpumask_copy(tr->tracing_cpumask, tracing_cpumask_new); 5293 5294 return 0; 5295 } 5296
On Sat, 5 Aug 2023 00:41:13 +0800 kernel test robot <lkp@intel.com> wrote: > 5276 if (cpumask_test_cpu(cpu, tr->tracing_cpumask) && > 5277 !cpumask_test_cpu(cpu, tracing_cpumask_new)) { > 5278 atomic_inc(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); > 5279 ring_buffer_record_disable_cpu(tr->array_buffer.buffer, cpu); > > 5280 ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); The access to max_buffer requires a: #ifdef CONFIG_TRACER_MAX_TRACE Around them. -- Steve > 5281 } > 5282 if (!cpumask_test_cpu(cpu, tr->tracing_cpumask) && > 5283 cpumask_test_cpu(cpu, tracing_cpumask_new)) { > 5284 atomic_dec(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); > 5285 ring_buffer_record_enable_cpu(tr->array_buffer.buffer, cpu); > 5286 ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); > 5287 } > 5288 } > 5289 arch_spin_unlock(&tr->max_lock);
Hi Zheng, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on rostedt-trace/for-next v6.5-rc4 next-20230804] [cannot apply to rostedt-trace/for-next-urgent] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Zheng-Yejian/tracing-Fix-cpu-buffers-unavailable-due-to-record_disabled-messed/20230804-204751 base: linus/master patch link: https://lore.kernel.org/r/20230804124549.2562977-2-zhengyejian1%40huawei.com patch subject: [PATCH 1/2] tracing: Fix cpu buffers unavailable due to 'record_disabled' messed config: i386-defconfig (https://download.01.org/0day-ci/archive/20230805/202308050601.nsx7Z4CY-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230805/202308050601.nsx7Z4CY-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202308050601.nsx7Z4CY-lkp@intel.com/ All errors (new ones prefixed by >>): kernel/trace/trace.c: In function 'tracing_set_cpumask': >> kernel/trace/trace.c:5280:60: error: 'struct trace_array' has no member named 'max_buffer'; did you mean 'array_buffer'? 5280 | ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); | ^~~~~~~~~~ | array_buffer kernel/trace/trace.c:5286:59: error: 'struct trace_array' has no member named 'max_buffer'; did you mean 'array_buffer'? 5286 | ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); | ^~~~~~~~~~ | array_buffer vim +5280 kernel/trace/trace.c 5260 5261 int tracing_set_cpumask(struct trace_array *tr, 5262 cpumask_var_t tracing_cpumask_new) 5263 { 5264 int cpu; 5265 5266 if (!tr) 5267 return -EINVAL; 5268 5269 local_irq_disable(); 5270 arch_spin_lock(&tr->max_lock); 5271 for_each_tracing_cpu(cpu) { 5272 /* 5273 * Increase/decrease the disabled counter if we are 5274 * about to flip a bit in the cpumask: 5275 */ 5276 if (cpumask_test_cpu(cpu, tr->tracing_cpumask) && 5277 !cpumask_test_cpu(cpu, tracing_cpumask_new)) { 5278 atomic_inc(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); 5279 ring_buffer_record_disable_cpu(tr->array_buffer.buffer, cpu); > 5280 ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); 5281 } 5282 if (!cpumask_test_cpu(cpu, tr->tracing_cpumask) && 5283 cpumask_test_cpu(cpu, tracing_cpumask_new)) { 5284 atomic_dec(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); 5285 ring_buffer_record_enable_cpu(tr->array_buffer.buffer, cpu); 5286 ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); 5287 } 5288 } 5289 arch_spin_unlock(&tr->max_lock); 5290 local_irq_enable(); 5291 5292 cpumask_copy(tr->tracing_cpumask, tracing_cpumask_new); 5293 5294 return 0; 5295 } 5296
Hi Zheng, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on rostedt-trace/for-next v6.5-rc4 next-20230804] [cannot apply to rostedt-trace/for-next-urgent] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Zheng-Yejian/tracing-Fix-cpu-buffers-unavailable-due-to-record_disabled-messed/20230804-204751 base: linus/master patch link: https://lore.kernel.org/r/20230804124549.2562977-2-zhengyejian1%40huawei.com patch subject: [PATCH 1/2] tracing: Fix cpu buffers unavailable due to 'record_disabled' messed config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20230805/202308050731.PQutr3r0-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce: (https://download.01.org/0day-ci/archive/20230805/202308050731.PQutr3r0-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202308050731.PQutr3r0-lkp@intel.com/ All errors (new ones prefixed by >>): kernel/trace/trace.c: In function 'tracing_set_cpumask': >> kernel/trace/trace.c:5280:60: error: 'struct trace_array' has no member named 'max_buffer'; did you mean 'array_buffer'? 5280 | ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); | ^~~~~~~~~~ | array_buffer kernel/trace/trace.c:5286:59: error: 'struct trace_array' has no member named 'max_buffer'; did you mean 'array_buffer'? 5286 | ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); | ^~~~~~~~~~ | array_buffer vim +5280 kernel/trace/trace.c 5260 5261 int tracing_set_cpumask(struct trace_array *tr, 5262 cpumask_var_t tracing_cpumask_new) 5263 { 5264 int cpu; 5265 5266 if (!tr) 5267 return -EINVAL; 5268 5269 local_irq_disable(); 5270 arch_spin_lock(&tr->max_lock); 5271 for_each_tracing_cpu(cpu) { 5272 /* 5273 * Increase/decrease the disabled counter if we are 5274 * about to flip a bit in the cpumask: 5275 */ 5276 if (cpumask_test_cpu(cpu, tr->tracing_cpumask) && 5277 !cpumask_test_cpu(cpu, tracing_cpumask_new)) { 5278 atomic_inc(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); 5279 ring_buffer_record_disable_cpu(tr->array_buffer.buffer, cpu); > 5280 ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); 5281 } 5282 if (!cpumask_test_cpu(cpu, tr->tracing_cpumask) && 5283 cpumask_test_cpu(cpu, tracing_cpumask_new)) { 5284 atomic_dec(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); 5285 ring_buffer_record_enable_cpu(tr->array_buffer.buffer, cpu); 5286 ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); 5287 } 5288 } 5289 arch_spin_unlock(&tr->max_lock); 5290 local_irq_enable(); 5291 5292 cpumask_copy(tr->tracing_cpumask, tracing_cpumask_new); 5293 5294 return 0; 5295 } 5296
On 2023/8/5 09:15, kernel test robot wrote: > Hi Zheng, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on linus/master] > [also build test ERROR on rostedt-trace/for-next v6.5-rc4 next-20230804] > [cannot apply to rostedt-trace/for-next-urgent] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Zheng-Yejian/tracing-Fix-cpu-buffers-unavailable-due-to-record_disabled-messed/20230804-204751 > base: linus/master > patch link: https://lore.kernel.org/r/20230804124549.2562977-2-zhengyejian1%40huawei.com > patch subject: [PATCH 1/2] tracing: Fix cpu buffers unavailable due to 'record_disabled' messed > config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20230805/202308050731.PQutr3r0-lkp@intel.com/config) > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 > reproduce: (https://download.01.org/0day-ci/archive/20230805/202308050731.PQutr3r0-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202308050731.PQutr3r0-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > kernel/trace/trace.c: In function 'tracing_set_cpumask': >>> kernel/trace/trace.c:5280:60: error: 'struct trace_array' has no member named 'max_buffer'; did you mean 'array_buffer'? > 5280 | ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); > | ^~~~~~~~~~ > | array_buffer > kernel/trace/trace.c:5286:59: error: 'struct trace_array' has no member named 'max_buffer'; did you mean 'array_buffer'? > 5286 | ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); > | ^~~~~~~~~~ > | array_buffer > Thank you, robot! I'll fix it in v2 soon. > > vim +5280 kernel/trace/trace.c > > 5260 > 5261 int tracing_set_cpumask(struct trace_array *tr, > 5262 cpumask_var_t tracing_cpumask_new) > 5263 { > 5264 int cpu; > 5265 > 5266 if (!tr) > 5267 return -EINVAL; > 5268 > 5269 local_irq_disable(); > 5270 arch_spin_lock(&tr->max_lock); > 5271 for_each_tracing_cpu(cpu) { > 5272 /* > 5273 * Increase/decrease the disabled counter if we are > 5274 * about to flip a bit in the cpumask: > 5275 */ > 5276 if (cpumask_test_cpu(cpu, tr->tracing_cpumask) && > 5277 !cpumask_test_cpu(cpu, tracing_cpumask_new)) { > 5278 atomic_inc(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); > 5279 ring_buffer_record_disable_cpu(tr->array_buffer.buffer, cpu); >> 5280 ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); > 5281 } > 5282 if (!cpumask_test_cpu(cpu, tr->tracing_cpumask) && > 5283 cpumask_test_cpu(cpu, tracing_cpumask_new)) { > 5284 atomic_dec(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); > 5285 ring_buffer_record_enable_cpu(tr->array_buffer.buffer, cpu); > 5286 ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); > 5287 } > 5288 } > 5289 arch_spin_unlock(&tr->max_lock); > 5290 local_irq_enable(); > 5291 > 5292 cpumask_copy(tr->tracing_cpumask, tracing_cpumask_new); > 5293 > 5294 return 0; > 5295 } > 5296 >
On 2023/8/5 00:51, Steven Rostedt wrote: > On Sat, 5 Aug 2023 00:41:13 +0800 > kernel test robot <lkp@intel.com> wrote: > >> 5276 if (cpumask_test_cpu(cpu, tr->tracing_cpumask) && >> 5277 !cpumask_test_cpu(cpu, tracing_cpumask_new)) { >> 5278 atomic_inc(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); >> 5279 ring_buffer_record_disable_cpu(tr->array_buffer.buffer, cpu); >>> 5280 ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); > > The access to max_buffer requires a: > > #ifdef CONFIG_TRACER_MAX_TRACE > > Around them. > > -- Steve Thanks, Steve, I'll add it in v2. -- Zheng Yejian > >> 5281 } >> 5282 if (!cpumask_test_cpu(cpu, tr->tracing_cpumask) && >> 5283 cpumask_test_cpu(cpu, tracing_cpumask_new)) { >> 5284 atomic_dec(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); >> 5285 ring_buffer_record_enable_cpu(tr->array_buffer.buffer, cpu); >> 5286 ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); >> 5287 } >> 5288 } >> 5289 arch_spin_unlock(&tr->max_lock); >
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index b8870078ef58..691ec4d4cd19 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -5277,11 +5277,13 @@ int tracing_set_cpumask(struct trace_array *tr, !cpumask_test_cpu(cpu, tracing_cpumask_new)) { atomic_inc(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); ring_buffer_record_disable_cpu(tr->array_buffer.buffer, cpu); + ring_buffer_record_disable_cpu(tr->max_buffer.buffer, cpu); } if (!cpumask_test_cpu(cpu, tr->tracing_cpumask) && cpumask_test_cpu(cpu, tracing_cpumask_new)) { atomic_dec(&per_cpu_ptr(tr->array_buffer.data, cpu)->disabled); ring_buffer_record_enable_cpu(tr->array_buffer.buffer, cpu); + ring_buffer_record_enable_cpu(tr->max_buffer.buffer, cpu); } } arch_spin_unlock(&tr->max_lock);