Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7300675rwl; Thu, 23 Mar 2023 02:15:57 -0700 (PDT) X-Google-Smtp-Source: AK7set8BkRV0G1LO89n//A5vJJpNz2CJpEqco3NJEMpytVOJLWdrZnQGaNtAAUBwmqTjfH4b9E1i X-Received: by 2002:a05:6402:48c:b0:4fa:ad62:b1a0 with SMTP id k12-20020a056402048c00b004faad62b1a0mr8431039edv.41.1679562956959; Thu, 23 Mar 2023 02:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679562956; cv=none; d=google.com; s=arc-20160816; b=b7lJevXuHVk93Z8d/U50+C16Md7VjcMEDdLwR29JS986eESU03vR6I2T/gHs/RKzqg lEkdfKdkYzt1sBKg8OT3nqQ6OdaMRKMiRBAGWiN8l9AZqgp7CaU+OpstfYSzNbH3j6RW KIpTIBleXWjnHPvr0nLRstYeOHd67V6dOrOYATEnSOrKSycjwReX4DmjzYP6Rexag0hk tfT4uWmnVn4uvGnQoYeQ1jJUPm2S1ypuJhjV37itfcI3Vmn9lE6IhwNOAObPnJGnLHyy KlWtv3+F4dszC2twKW+KWRR739JBy5pVdx1hHw1nEJuo7cfEWwbKtOnwqdq3ajyBhwp2 ipRg== 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=ByZB1dfpBLtRSxR4wsct9Rq4cdr9+sGmdoakL+D6enU=; b=dFA4NOvSGIWi60VEPX7rv+vItoCBgaQ31YVUWGgbEHFLBTx8aDD0O3g0qJIL+mudmn 6cRC+X8c7NxeQb/MMjFh3enXrcJI/6u3Pa9NjZEcpplQ9FhsDqVCgNe26a1jEn2QTEwv +6RtK0cJnfg1D3ue5dyUpGt0oAFq/GxRiDQn1n87znnpRZv/UyEZCzyx2O5RtaCqQ5nz O7As8SIffPNVbFdKAjk6wp1D6ToKL1KlB/1Nr0Y6ZRXIGMJOF47sdBf5fk8LE2Z7qCZQ niLYU0R2qAdodSsVQ19Pr2O/3e5CdNPAudPsRjsE7wPFIvm+8ZGWY5D4O5NHf8Ol1DQ/ VXPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=iN4k2v09; 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 vo10-20020a170907a80a00b00931f078ce63si10829994ejc.278.2023.03.23.02.15.33; Thu, 23 Mar 2023 02:15:56 -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=20210112 header.b=iN4k2v09; 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 S229875AbjCWJJ6 (ORCPT + 99 others); Thu, 23 Mar 2023 05:09:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbjCWJJV (ORCPT ); Thu, 23 Mar 2023 05:09:21 -0400 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6D276B8 for ; Thu, 23 Mar 2023 02:09:19 -0700 (PDT) Received: by mail-qt1-x82a.google.com with SMTP id x1so25753345qtr.7 for ; Thu, 23 Mar 2023 02:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679562558; 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=ByZB1dfpBLtRSxR4wsct9Rq4cdr9+sGmdoakL+D6enU=; b=iN4k2v093EH2wRtAGHgKQHcyCb0UcLnGPIRyMhAJ7F7+eR6HqMaOd7shNGBW+Dy+Qb L03DkTJZcB3APXNEHS0LEJPsHIO/yiJl3FhxvUfav1mD04iy10MsuDdxO+Cr+8+zH5Qn SWRKeSnim0idtWVYh4B6ttEIqldnquUCRsAG6SKdzmzj6LZy5a+yKFxReA2rtHkvmS+T c4Uirl5eERJAhUF/iCpamCSf4VaYC0sLGUk+gCNStDAZOxnJyzVgzOOMr08sUf+0vrpe pWutZQ3YTMhkP/crDSILGU9x2kTHEWeewATPFS0xMaovrLUO5gbSBHCWafgh7aNFc368 zOjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679562558; 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=ByZB1dfpBLtRSxR4wsct9Rq4cdr9+sGmdoakL+D6enU=; b=sbl7sh9P29uY5Fl5UgNt2hb9iHCmWas0L06++9T7Vxg/iMPZkkt1tk6W3/n997h1t+ 3GTVGHGF4DSttOqr66omX6GrJ7B7lVB0dfuMbigCdkKay3OJzW+XfAQrxRcbQ+XdbXYt 0rPYfvAlgcnlszjDFdIy1YyKF1uAws6FbOXCdEfWpCRmifFdHW4ma9BC9O5vJXXIKjHv 3+sGo7pVIaGWDNiqCz2rZyqRsKH2D4vSd6W7C+H245Qs1gdphIFi5+q+IH/tzhlb1Mwv iLwGCjhZ5HSPybmWCXoo0z1+5VDC13jCs3MnVlKKrt//fRIrpDRuImE5ysGapAeeMZJL lSbw== X-Gm-Message-State: AO0yUKUQcNYFRsOAy71S9QnALwr8l62bbU2WcVkbNHm+5ymcrxblQk1g l99KFYto/cZPVCef9SR7dsg90IlAPgHK4lB/tK+xxw== X-Received: by 2002:a05:622a:2c1:b0:3e0:755f:c0e5 with SMTP id a1-20020a05622a02c100b003e0755fc0e5mr2323439qtx.9.1679562558382; Thu, 23 Mar 2023 02:09:18 -0700 (PDT) MIME-Version: 1.0 References: <20230320172620.18254-1-james.morse@arm.com> <20230320172620.18254-10-james.morse@arm.com> In-Reply-To: From: Peter Newman Date: Thu, 23 Mar 2023 10:09:07 +0100 Message-ID: Subject: Re: [PATCH v3 09/19] x86/resctrl: Queue mon_event_read() instead of sending an IPI To: James Morse Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, xingxin.hx@openanolis.org, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-15.7 required=5.0 tests=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,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 Wed, Mar 22, 2023 at 3:07=E2=80=AFPM Peter Newman wrote: > On Mon, Mar 20, 2023 at 6:27=E2=80=AFPM James Morse = wrote: > > > > x86 is blessed with an abundance of monitors, one per RMID, that can be > > As I explained earlier, this is not the case on AMD. > > > read from any CPU in the domain. MPAMs monitors reside in the MMIO MSC, > > the number implemented is up to the manufacturer. This means when there= are > > fewer monitors than needed, they need to be allocated and freed. > > > > Worse, the domain may be broken up into slices, and the MMIO accesses > > for each slice may need performing from different CPUs. > > > > These two details mean MPAMs monitor code needs to be able to sleep, an= d > > IPI another CPU in the domain to read from a resource that has been sli= ced. > > This doesn't sound very convincing. Could mon_event_read() IPI all the > CPUs in the domain? (after waiting to allocate and install monitors > when necessary?) No wait, I know that isn't correct. As you explained it, the remote CPU needs to sleep because it may need to atomically acquire, install, and read a CSU monitor. It still seems possible for the mon_event_read() thread to do all the waiting (tell remote CPU to program CSU monitor, wait, tell same remote CPU to read monitor), but that sounds like more work that I don't see a lot of benefit to doing today. Can you update the changelog to just say the remote CPU needs to block when installing a CSU monitor? Thanks! -Peter