Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2313885rwr; Fri, 21 Apr 2023 07:19:14 -0700 (PDT) X-Google-Smtp-Source: AKy350YMEFH2Cj4uEKL7gueOBPa4sus7jAYTxrI33fFjZjXSwvX8Q91nKVOR0PVhf6iBv8JicfuW X-Received: by 2002:a05:6a20:12cc:b0:ee:b7ea:5d9c with SMTP id v12-20020a056a2012cc00b000eeb7ea5d9cmr8251065pzg.0.1682086754114; Fri, 21 Apr 2023 07:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682086754; cv=none; d=google.com; s=arc-20160816; b=O1dzAYTCggy5NS6aWiYFQtrWRHzukXg6MNyGts7SQrT/gukiHIOBZrj/L7CBY06THi aUXsArUwOn+YCG1dp9yYnQ5AkgRRqEomGhnXIFIXk03tFHp3OTVz5Gh5M1dnm3+hh5xo KCBq38KNVqq4sxK9U0x9+M40LFCmWNVwsJpZE77+3WuTf2EYa/sy8oREg0Swm8CG2K6F GHLFDltTRvtyMujSI0eC0NhHo756DJxts2rezWBtZz3Q/vZyNJz5EZG0UKpe8yCasNv6 F6QUb4Bxtu/XJgDrqX/c4Sp6YN2ncfwt4y6lKQ9esSQIQ4K7ykag9u0zEYkQki23mcJf vjjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=pHZMVL6RAnw5G7UfUNTFa5CzwFEHRn1u+l8+oLzhKx4=; b=QOcDv6oLc8GEQ9BQ8aD58loPB2vHapJLcq23WIRobgu1BA8K+C3OJoOP5EuTXvsgDA MkkUn0IDu0i0LTNr/WwbZvQS53vR/7c6hmVtSvCHkWXyfLjXSF4JIWQtjrYgxZUrEUlf RMi2z8vE1h/oWEDUj7H85SAzFJrLlTPMBOUJ4a9ctxfYSrliLVb15+iJmz4+J8RAMDMJ 5fxQM8sokRMeZek3ri+9jtlPlTAlmRkoTml9ulFBhVwtSaPQPzgNMlpvNaBYlIWOgO4l GkK/69PhbZgZxUXpWyYMD7J/AF9zk0Rcnfa0i2jjuw+YJWTvG/SkFZIvCGyfmbidEQFJ K+NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=MfKd7cn5; 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 v10-20020a63610a000000b00513edc81581si4552706pgb.287.2023.04.21.07.19.02; Fri, 21 Apr 2023 07:19:14 -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=MfKd7cn5; 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 S232090AbjDUOSX (ORCPT + 99 others); Fri, 21 Apr 2023 10:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232248AbjDUOSB (ORCPT ); Fri, 21 Apr 2023 10:18:01 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C523012C9C for ; Fri, 21 Apr 2023 07:17:59 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-b98ef5b557fso1821614276.2 for ; Fri, 21 Apr 2023 07:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682086679; x=1684678679; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pHZMVL6RAnw5G7UfUNTFa5CzwFEHRn1u+l8+oLzhKx4=; b=MfKd7cn5Uub1nNM2RiV3ISktGqpLP5EyFHMUPTILCfI1qopVg8PNxzIa5VZ+WVXZcx YZQQ69rym1OqIQnu263AjZ26mfrN9dRc/O+yt9qJlZr0OQWY7+sFU45p712eZ73X/pq+ 4Nuhsixxps7DcDhS8ICV53xkgX4iMhzzYLMYV6mG4O4qavIN7UXl1yLnU6UYwzdbAfEJ XNoVRfO8lEMNDiQ7idtMdbVoXBEUHQvqduc/A77nuADM4Lw/KkA2p6bc2WIgZsi3U3N/ trNTBvt2RGd59HStffaZOaFrM5q5/qYO3yTC7XGOJfGCsPSLoeWY96CWcfKm4Xj9mPLG QXQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682086679; x=1684678679; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pHZMVL6RAnw5G7UfUNTFa5CzwFEHRn1u+l8+oLzhKx4=; b=WG7eALEQKF6SLx/ZrIdyfuA+tAipUWPXX/1tQhEjdNttEulfZBQDDMvQLnhTeRsmns UvLfI9Om67+Z01AdoxnhHxdGl64u21ZPL32AqDW1rePDh97OR4sLWxav12Mlipq82xNu jcxv+rRwEcddbJUUA2GRqhmWYE/fbycJbOQfT+FvtC946OdvC2wxkYmqMXKZhhZZQ9/h 8TZZutdVU3Qogzo+Bph4qDi7V8HAQTnvZWzHAyn5PBDq4ndMjTLNWPJTP+Ou9FFiGOFK O7IcwYAFz3PwZC6UFIrOGjvVOgzNS8Fpvfmh+sdzQWtwXsAb3cI3vupbzd6/UWRnDS+T zmGA== X-Gm-Message-State: AAQBX9c1twgwXiy/Px/UdHL0JdNC1nSt+vS+/nS8jlSBGGLKV+5RZUrE dKEhJe5myFnazbWfrJcKuYb2fz1RUlL7EtHxsw== X-Received: from peternewman0.zrh.corp.google.com ([2a00:79e0:9d:6:c801:daa2:428c:d3fc]) (user=peternewman job=sendgmr) by 2002:a81:ae68:0:b0:533:8f19:4576 with SMTP id g40-20020a81ae68000000b005338f194576mr1440134ywk.0.1682086679114; Fri, 21 Apr 2023 07:17:59 -0700 (PDT) Date: Fri, 21 Apr 2023 16:17:19 +0200 In-Reply-To: <20230421141723.2405942-1-peternewman@google.com> Mime-Version: 1.0 References: <20230421141723.2405942-1-peternewman@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230421141723.2405942-6-peternewman@google.com> Subject: [PATCH v1 5/9] x86/resctrl: Call mon_event_count() directly for soft RMIDs From: Peter Newman To: Fenghua Yu , Reinette Chatre Cc: 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, Peter Newman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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: X-Mailing-List: linux-kernel@vger.kernel.org There is no point in using IPIs to call mon_event_count() when it is only reading software counters from memory. When RMIDs are soft, mon_event_read() just calls mon_event_count() directly. Signed-off-by: Peter Newman --- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 9 ++++++++- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/monitor.c | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c index b44c487727d4..b2ed25a08f6f 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -534,7 +534,14 @@ void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, rr->val = 0; rr->first = first; - smp_call_function_any(&d->cpu_mask, mon_event_count, rr, 1); + if (rdt_mon_soft_rmid) + /* + * Soft RMID counters reside in memory, so they can be read from + * anywhere. + */ + mon_event_count(rr); + else + smp_call_function_any(&d->cpu_mask, mon_event_count, rr, 1); } int rdtgroup_mondata_show(struct seq_file *m, void *arg) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 256eee05d447..e6ff31a4dbc4 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -115,6 +115,7 @@ struct rmid_read { extern bool rdt_alloc_capable; extern bool rdt_mon_capable; +extern bool rdt_mon_soft_rmid; extern unsigned int rdt_mon_features; extern struct list_head resctrl_schema_all; diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index 3671100d3cc7..bb857eefa3b0 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -57,6 +57,11 @@ static struct rmid_entry *rmid_ptrs; */ bool rdt_mon_capable; +/* + * Global boolean to indicate when RMIDs are implemented in software. + */ +bool rdt_mon_soft_rmid; + /* * Global to indicate which monitoring events are enabled. */ -- 2.40.0.634.g4ca3ef3211-goog