Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5705045ybl; Tue, 10 Dec 2019 10:08:34 -0800 (PST) X-Google-Smtp-Source: APXvYqwggrsDctFUNgn6mShn7Kdi5HBKeBJYcUzD+PKii2nAgQpQEAAE/SLf3JD74c5KP9ejRhdM X-Received: by 2002:aca:b48a:: with SMTP id d132mr78071oif.111.1576001314687; Tue, 10 Dec 2019 10:08:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576001314; cv=none; d=google.com; s=arc-20160816; b=TW1a1N2tLpj2G/6x8Wc88VghPhDj7A9vzKFlyfDYtJiNQojM1JdCMTebK7woVZT4bD za+1XFxD4H3qAyWs1S9yZXitL5MtirRJRQPon2GeF4Al/Ekn9EBzBJJr3UXSJftagiZ5 FbXQ2T8hlAPK+rv77Cx4RIBY3+coC9Xy5y0oL6azRZ3ifubu1PKVAfFDqHq6XbHGicEB C3L9x8PsBp6OJ9LgnBj+xsNhu+AmNyQGVXDdCpUAOldr4s0TIpq5gkQGdpIl+FJTHDis RfiB4+WaF9YhDg36d4ZQiF5xdAAEdqUvrA9bPsFl+Uw/ZdbI25/c/bcP4+8MJfISldDP qjIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=ej5zHVJ46gFguDpJo2p0qEQYTYjkQo4T7UxAGTynAo0=; b=Mr5Xpkg0n6pqeLF5ZlRf8iCz/66X7YxzLlyuUz9QMNWjFaDNvk9a0HPCaQNCU9oR+l b5IRgq5RRv28SKuqFy2LDO2/ArNPz2PotQTAM7Aos5/hxOek4ARsoJmPIQdElPZ6aSPC eCEOeFZYiouLPP41qtlOHvgZEaKM207jtDlvPFEQ6VPmr/VC+DzenTU9q+wTymkm5cyP iBjkT0EMEu9GXSqHUlqL4ZGKzF+YaK8HjeyvQueIYMH9+nEuiwN78Kd9G4T01g1Xq+C+ S6JLupRoq/jfANjycwG5cAdDDd/OIUHxHbFyYcc6Q6T20a8ZxioEdh5Ckler8eh3DH6s kZFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=BkUbQrGT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si2449819otn.33.2019.12.10.10.08.21; Tue, 10 Dec 2019 10:08:34 -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=@lca.pw header.s=google header.b=BkUbQrGT; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727750AbfLJSGZ (ORCPT + 99 others); Tue, 10 Dec 2019 13:06:25 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:36308 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727652AbfLJSGY (ORCPT ); Tue, 10 Dec 2019 13:06:24 -0500 Received: by mail-qk1-f194.google.com with SMTP id a203so7090051qkc.3 for ; Tue, 10 Dec 2019 10:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ej5zHVJ46gFguDpJo2p0qEQYTYjkQo4T7UxAGTynAo0=; b=BkUbQrGTe2NeMZ1ydN+rHkRp8gFZuTlahiy0oMc0nQR7SczMlE2pdmUqMBDQF0wfOv lY5aQukfs723omxPmof90KoRoLZ2YvVpB5X8n4nz7lyTGe3IGaEpXGZr6syNEkyAu7Ea lzX4NUL0g1dLgfJUzXlRaLcyVktQ81l1J8ywPnwZws0QafJtytTrmmreENsJ1gULy6eP VD6qGIXaEtKwUPpc9u/gyCEvGCfPld8Efn4dVW/39Wkr1zjBYhQlmC9jpqYHjtGPuAwf 6EK3nSSYP5z2gw4YREcu5ebJS3uUB0sI2tAJ+S0tr4DBi7qVTCVF5ptIOK/YwZPhlZGL +u1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ej5zHVJ46gFguDpJo2p0qEQYTYjkQo4T7UxAGTynAo0=; b=ZFNNivtvMKK1If5EPpshKtej5/v4fSUDAHi7HghTTUQ7bNY5AfZx13uUP8v8OFMrNM duqWR5l3jiHcYuty2M4RnE1QQvwIFFRSi3JC7r2rClan3QrchxCVy0/8q3mEmtqtXG/f y9tuAWwYSL2wTq6buPZs7PxOO8lQBpoqoy+3GiP1sYCroNJKl2roFQlkbgaa+/ayI20E kAG8yGiE+lVVcTQOPVuHNreHUCwBzgZYNm41DvyHFu51rJGejMRX0T+x3iwdlNOOXi1R iTHcLgIKZGIZ1G2NPlP5A1EHpBkWrZ3LJgslvECfoldBo1/cN+4jgPG1o51/ZhkGZ3k3 5C4Q== X-Gm-Message-State: APjAAAWDwSfvnDrAYxEEjI+HL8SNIz86qM4pRHTSa/WEas/f0JS7ElNL 4js0RVuhJOGyDUHIvRQeS0cOgw== X-Received: by 2002:a37:6087:: with SMTP id u129mr33281505qkb.219.1576001183308; Tue, 10 Dec 2019 10:06:23 -0800 (PST) Received: from [192.168.1.153] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id c6sm1139390qka.111.2019.12.10.10.06.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Dec 2019 10:06:22 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: [PATCH] x86/resctrl: fix an imbalance in domain_remove_cpu From: Qian Cai In-Reply-To: Date: Tue, 10 Dec 2019 13:06:20 -0500 Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Reinette Chatre , Fenghua Yu , "H. Peter Anvin" , John Stultz , sboyd@kernel.org, Tony Luck , tj@kernel.org, the arch/x86 maintainers , Linux Kernel Mailing List Content-Transfer-Encoding: quoted-printable Message-Id: References: <20191208041318.3702-1-cai@lca.pw> To: Ryan Chen X-Mailer: Apple Mail (2.3601.0.10) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Dec 10, 2019, at 2:55 AM, Ryan Chen wrote: >=20 > Hi Qian, >=20 > On Sun, Dec 8, 2019 at 12:14 PM Qian Cai wrote: >>=20 >> domain_add_cpu() calls domain_setup_mon_state() only when = r->mon_capable >> is true where it will initialize d->mbm_over. However, >> domain_remove_cpu() calls cancel_delayed_work(&d->mbm_over) without >> checking r->mon_capable. Hence, it triggers a debugobjects warning = when >> offlining CPUs because those timer debugobjects are never = initialized. >>=20 > Could you elaborate a little more on the failure symptom? > If I understand correctly, the error you described was due to > r->mon_capable set to false while is_mbm_enabled() returns true? > Which means on this platform rdt_mon_features is non zero? > And in get_rdt_mon_resources() it will invoke rdt_get_mon_l3_config(), > however the only possible failure to do not set r->mon_capable is that = it > failed in dom_data_init() due to kcalloc() failure? Then the logic in > get_rdt_resources() is that it will ignore the return error if rdt = allocate > feature is supported on this platform? If this is the case, the = r->mon_capable > is not an indicator for whether the overflow thread has been created, = right? > Can we simply remove the check of r->mon_capable in domain_add_cpu() = and > invoke domain_setup_mon_state() directly? Actually, domain_add_cpu r->name =3D L3, r->alloc_capable =3D 1, r->mon_capable =3D = 1 domain_add_cpu r->name =3D L3DATA, r->alloc_capable =3D 1, = r->mon_capable =3D 0 domain_add_cpu r->name =3D L3CODE, r->alloc_capable =3D 1, = r->mon_capable =3D 0 rdt_get_mon_l3_config() will only set r->mon_capable =3D 1 for L3. >> ODEBUG: assert_init not available (active state 0) object type: >> timer_list hint: 0x0 >> WARNING: CPU: 143 PID: 789 at lib/debugobjects.c:484 >> debug_print_object+0xfe/0x140 >> Hardware name: HP Synergy 680 Gen9/Synergy 680 Gen9 Compute Module, = BIOS >> I40 05/23/2018 >> RIP: 0010:debug_print_object+0xfe/0x140 >> Call Trace: >> debug_object_assert_init+0x1f5/0x240 >> del_timer+0x6f/0xf0 >> try_to_grab_pending+0x42/0x3c0 >> cancel_delayed_work+0x7d/0x150 >> resctrl_offline_cpu+0x3c0/0x520 >> cpuhp_invoke_callback+0x197/0x1120 >> cpuhp_thread_fun+0x252/0x2f0 >> smpboot_thread_fn+0x255/0x440 >> kthread+0x1e6/0x210 >> ret_from_fork+0x3a/0x50 >>=20 >> Fixes: e33026831bdb ("x86/intel_rdt/mbm: Handle counter overflow") >> Signed-off-by: Qian Cai >> --- >> arch/x86/kernel/cpu/resctrl/core.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/arch/x86/kernel/cpu/resctrl/core.c = b/arch/x86/kernel/cpu/resctrl/core.c >> index 03eb90d00af0..89049b343c7a 100644 >> --- a/arch/x86/kernel/cpu/resctrl/core.c >> +++ b/arch/x86/kernel/cpu/resctrl/core.c >> @@ -618,7 +618,7 @@ static void domain_remove_cpu(int cpu, struct = rdt_resource *r) >> if (static_branch_unlikely(&rdt_mon_enable_key)) >> rmdir_mondata_subdir_allrdtgrp(r, d->id); >> list_del(&d->list); >> - if (is_mbm_enabled()) >> + if (r->mon_capable && is_mbm_enabled()) >> cancel_delayed_work(&d->mbm_over); > Humm, it looks like there are two places within this function > invoked cancel_delayed_work(&d->mbm_over), > why not adding the check for both of them? Here it only check L3, so it will skip correctly for L3DATA and L3CODE to not call cancel_delayed_work(). Recalled the above that only L3 will have r->capable set. if (r =3D=3D &rdt_resources_all[RDT_RESOURCE_L3]) { if (is_mbm_enabled() && cpu =3D=3D d->mbm_work_cpu) { =09= cancel_delayed_work(&d->mbm_over); Hence, r->mon_capable check seems redundant here.