Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp780499rwd; Tue, 16 May 2023 07:39:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7hyGOJPSbPIPiz5NiCBPFlCmppT1DlpVAh8wgcVT1+g/nMFcZ0z1bPxbt1Dzkwwqcm7YJ+ X-Received: by 2002:a05:6a00:2451:b0:646:b944:4e1d with SMTP id d17-20020a056a00245100b00646b9444e1dmr34095775pfj.32.1684247984481; Tue, 16 May 2023 07:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684247984; cv=none; d=google.com; s=arc-20160816; b=WmO1zZPfl4X9H0l3S6JgNw6sbPBPlYf6POyyv7RxhpJJxEqVKuKgS9qENn//NhVfMy rZeR2sMOY1m+ane39L9Vo8dY3lXdreHK3LAhxNTeHcqd8RS+weGwgW0wXs4ZXIPKyClD Le7dvPTeF31isc9+RLPbAPaGM11QJiiaEO5nCiAS97J97ACVAJryz8co0bVeKbFDsjY9 z+oXB69N393NtyVyxeP2gvtzJl4gwsC8ITdWPFcPo3Zjb9IBdWQsVumqmwWMJSpNc69e v8cvqDc+Q1jDlZLWzjVANWsQdGk2CALabumNiGWKA+zy3HJElUpoS5SUl0KU2BkwTYl5 LPaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=AayuNIhRTV03xRUzarJZPTHvJp4e+UHEoTcw79g1j40=; b=EXGDbvoaeoxw8w2+D81GBeISGoG5mBD+jSh7+HzfcDoM67evkmOR/CJQsVdMZxGM4w W76Z9Pn6CzOyz8jMBo3X4VjCYHvOlb/hF+sVR0AqHUOCi2onz2hdG3BxYpJYbO6eJD2/ cbYzFvvcZNXOP5zpmkgbnTS/S38YlW98eMpeci1vy+QSIG8P7quPqsvhOStj+AAfVUWy 4iHd2gOXZq78RfrKFXMaGOVivIA7BxmcYNeVG5ZHgESxq5+f61hLJLDBCViat9oe4ndW lKhI09mFd2xfdidsAbW/aH7K/gH271zyfzyj5C0kiZQt+cAasX8f0ZNwJx3BDHLELez0 /3fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=kwqcHYdk; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020aa79f4d000000b0062d781f1f87si19256050pfr.355.2023.05.16.07.39.29; Tue, 16 May 2023 07:39:44 -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; dkim=pass header.i=@google.com header.s=20221208 header.b=kwqcHYdk; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233883AbjEPO2E (ORCPT + 99 others); Tue, 16 May 2023 10:28:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233839AbjEPO17 (ORCPT ); Tue, 16 May 2023 10:27:59 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E8427EEB for ; Tue, 16 May 2023 07:27:58 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-3f38824a025so1820001cf.0 for ; Tue, 16 May 2023 07:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684247277; x=1686839277; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AayuNIhRTV03xRUzarJZPTHvJp4e+UHEoTcw79g1j40=; b=kwqcHYdkL7rFl3g+642wuNa0GbUpjcFfyO1NjDeeVfYnNMJJy+TmSlotRBJFoo+837 fqwQh5q8TdPYkbp/aMYqqFj/hNh3GFABRAc2z8CZyOGRY9E4tfq4R1C65QWVeQ15fbHs /mCTPJ9hj2OYCuUKB/kbmLEBNJgEFWZnUFmRHyHprjObjtBL4zc1bznF91aXPHBKoUkt B2/uhY2SPwQAJWacDXOAQvgy9lHF0VnF4ModaPbrtACRA2NtqkkJO7ZFCfcyLXUGjo38 Rr3e8DwslXe4gh8uyDIh9BtCL1nuJ2Vo91dyLeC+f5lC5UuWwtHchIOtFxMNghfglnEm FYmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684247277; x=1686839277; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AayuNIhRTV03xRUzarJZPTHvJp4e+UHEoTcw79g1j40=; b=LtTO0A/kfuBVjhyfzBc6SrAQHe565HhPtFajlYvfps6KSDyq9hmopTLSVNSb6bp5tw pCoHu3loNHRVW7vkY261assIYwu6cXdNg4at1nEWPdiw5SOs00eelDPY/2G4xbPaShG5 z7S16sNC+z0Pm2tq2VXKCu0I+5qh2p2w6IAK2s4EWVEIyJCbpsZL0iKksXGXc7C7uHnz YSLkNEQkcmuYGNUQCG/0py6pjkpT9d9uHX8QjEz5a4BswTQMQB9HlcIJzp74Kx0IHtBb B/JhVMPOPahruMD1zdXOPI8Qw9e0YWvbSYZBHDyT6wVlEJajFnMYTwbvm/dmTx0DfNLi olgQ== X-Gm-Message-State: AC+VfDwfhnzSl5fJNPRoWJzKmcntOawP8atUsMhtS1EqE3Ttud7wSnem mpfzDKCaJSkt+9NhypLeDRFjg6znG7sbuDTIhqFMSw== X-Received: by 2002:ac8:7dcb:0:b0:3f5:2006:50f1 with SMTP id c11-20020ac87dcb000000b003f5200650f1mr341722qte.12.1684247277584; Tue, 16 May 2023 07:27:57 -0700 (PDT) MIME-Version: 1.0 References: <20230421141723.2405942-1-peternewman@google.com> <20230421141723.2405942-4-peternewman@google.com> <38b9e6df-cccd-a745-da4a-1d1a0ec86ff3@intel.com> In-Reply-To: From: Peter Newman Date: Tue, 16 May 2023 16:27:46 +0200 Message-ID: Subject: Re: [PATCH v1 3/9] x86/resctrl: Add resctrl_mbm_flush_cpu() to collect CPUs' MBM events To: Reinette Chatre Cc: Fenghua Yu , Babu Moger , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Stephane Eranian , James Morse , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 16, 2023 at 4:18=E2=80=AFPM Peter Newman wrote: > According to cpu_hotplug.rst, the startup callbacks are called before > a CPU is started and the teardown callbacks are called after the CPU > has become dysfunctional, so it should always be safe for a CPU to > access its own data, so all I need to do here is avoid walking domain > lists in resctrl_mbm_flush_cpu(). > > However, this also means that resctrl_{on,off}line_cpu() call > clear_closid_rmid() on a different CPU, so whichever CPU executes > these will zap its own pqr_state struct and PQR_ASSOC MSR. Sorry, I read the wrong section. I was looking at PREPARE section callbacks. ONLINE callbacks are called on the CPU, so calling clear_closid_rmid() is fine. It says the offline callback is called from the per-cpu hotplug thread, so I'm not sure if that means another context switch is possible after the teardown handler has run. To be safe, I can make resctrl_mbm_flush_cpu() check to see if it still has its domain state. -Peter