From nobody Thu May 9 06:25:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1706130009; cv=none; d=zohomail.com; s=zohoarc; b=emfm7Tmdc/eT+EjAb78+o+kHQPuYpg1b9YPfvT2p1jM2U9qLaAmGwTUNWxGd/t5NMgruRQAlwgg22lg8wmw3gcuKdhhO24HWaDhOFYDWg4jo0i9EXcHVti395Nojtzq2J4/cNTXSSB/wCj7xfAk8tU0T7SI7bmapO0536Ejevcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706130009; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yUrmZO37v19vw6177GV1p1vq04J3q1Ohle6m53SQw+Q=; b=BWjB4LnDHT2cN51IvCOF6ymIYBcCrT/TtV5IUyj5uwJf5dRKwG/oLq4UYktdV32Wn9Mzy+8Zek7/xkmvhW6+RQXHojT2QEIAmL89u6fZl8hPxTOg7TKRk3RHeueGvCQthzcFyqru2srLEzzWawz8OpAslANrE2wHWlgD5iH/7dY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1706130009371322.56409506517707; Wed, 24 Jan 2024 13:00:09 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.671238.1044499 (Exim 4.92) (envelope-from ) id 1rSkLf-0007FG-8v; Wed, 24 Jan 2024 20:59:51 +0000 Received: by outflank-mailman (output) from mailman id 671238.1044499; Wed, 24 Jan 2024 20:59:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rSkLf-0007F9-5X; Wed, 24 Jan 2024 20:59:51 +0000 Received: by outflank-mailman (input) for mailman id 671238; Wed, 24 Jan 2024 20:59:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rSkLe-0006yg-KC for xen-devel@lists.xenproject.org; Wed, 24 Jan 2024 20:59:50 +0000 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [2607:f8b0:4864:20::135]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 826c774d-bafb-11ee-9b0f-b553b5be7939; Wed, 24 Jan 2024 21:59:49 +0100 (CET) Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3619e804f3aso22487495ab.2 for ; Wed, 24 Jan 2024 12:59:48 -0800 (PST) Received: from pm2-ws13.praxislan02.com (207-172-141-204.s8906.c3-0.slvr-cbr1.lnh-slvr.md.cable.rcncustomer.com. [207.172.141.204]) by smtp.gmail.com with ESMTPSA id d3-20020ac80603000000b004260b65b4f7sm4643391qth.97.2024.01.24.12.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 12:59:45 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 826c774d-bafb-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706129987; x=1706734787; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yUrmZO37v19vw6177GV1p1vq04J3q1Ohle6m53SQw+Q=; b=E3sApGUTKeAwNnndLJa9mIUuFmiRVnRbeZGOHA41K9Xj5masF2IwYFjejAzF2LPVdV jD/Yj1ecWSAh/9iVY8vCnjwwVIBBu4x8A9PCYo42qwEDl6OPJAYKDUlhZQBb9rID70UM NofQzt9ZU/6XiuXDCO4OPHs6QbFF6M8I5P5mCD9o3pCdERxHTj7IH3p1fvJUHa9VjKtB OCmVXQivnBKUYz+0S8puLaqyy/wiZxxj46Mtrkjp2SV0W5C56zmkwKaDWTV34m9CtftD Re41uRj1dLqqJivAYLnPzGtaQryrwlhKIfySeg48VSGU6jiBwQvP45P2GWYJ1+NA/ezc T8TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706129987; x=1706734787; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yUrmZO37v19vw6177GV1p1vq04J3q1Ohle6m53SQw+Q=; b=OHHdET7ENNTFCUJZdW2c8zJ1MNbUdI6ltmjcVNGcu29pe8rlgbIl5Y01AZ2JmFOeY3 I6uUv1HAE3ej7CpO3E+rSQIEDCkGQaz8Dp4ikE3A9PztorjWRTFtW77YJqmK3qkm/kkk z1M964gTeUqrMSnn5uep54k9eYyBwF9tJss7ryqECK+nzzNMitTpD+5I6g2xHzUTzev8 CKxJlWf4tlsx5yNahvthQxVfjvUDNylOvB7NzjErec2onVweo4+PlCBffDDiOZN/RJ/G QAQAur+QksGeCTXN3xXDDsq35VR1vFW81TaangOd0fezoJU4JrDfXi1j4mFXmsiYBKdx xT8g== X-Gm-Message-State: AOJu0YytOBfgKp83od6q0OmSCJ4JWhXvxcD1aBUz4+PKEYlPHLOY11Zi j4tFcS6pi+mSY11lZJeuUSIOCBas/M029GLkSTjaDRlWl8P7AupztFB81Qmq X-Google-Smtp-Source: AGHT+IEHzyqRfHJmmh4174x8bgg177aZWQxWxvguQ+KgBd8RXILpqaRpZRkTTLapoQS2Fec8QSnzPQ== X-Received: by 2002:a05:6e02:1210:b0:361:a0ba:ad09 with SMTP id a16-20020a056e02121000b00361a0baad09mr40784ilq.12.1706129986876; Wed, 24 Jan 2024 12:59:46 -0800 (PST) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Jan Beulich Subject: [PATCH v2 1/2] pmstat: Limit hypercalls under HWP Date: Wed, 24 Jan 2024 15:59:21 -0500 Message-ID: <20240124205922.67266-2-jandryuk@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124205922.67266-1-jandryuk@gmail.com> References: <20240124205922.67266-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1706130010853100001 Content-Type: text/plain; charset="utf-8" When HWP is active, the cpufreq P-state information is not updated. In that case, return -EOPNOTSUPP instead of bogus, incomplete info. Similarly, set_cpufreq_para() is not applicable when HWP is active. Many of the options already checked the governor and were inaccessible, but SCALING_MIN/MAX_FREQ was still accessible (though it would do nothing). Add an ealier HWP check to handle all cases. Signed-off-by: Jason Andryuk Reviewed-by: Jan Beulich --- v2: Use -EOPNOTSUPP in both places xen/drivers/acpi/pmstat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c index 85097d463c..86588ddd42 100644 --- a/xen/drivers/acpi/pmstat.c +++ b/xen/drivers/acpi/pmstat.c @@ -66,6 +66,8 @@ int do_get_pm_info(struct xen_sysctl_get_pmstat *op) return -ENODEV; if ( !cpufreq_driver.init ) return -ENODEV; + if ( hwp_active() ) + return -EOPNOTSUPP; if ( !pmpt || !(pmpt->perf.init & XEN_PX_INIT) ) return -EINVAL; break; @@ -329,6 +331,9 @@ static int set_cpufreq_para(struct xen_sysctl_pm_op *op) if ( !policy || !policy->governor ) return -EINVAL; =20 + if ( hwp_active() ) + return -EOPNOTSUPP; + switch(op->u.set_para.ctrl_type) { case SCALING_MAX_FREQ: --=20 2.43.0 From nobody Thu May 9 06:25:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1706130014; cv=none; d=zohomail.com; s=zohoarc; b=k6hgYi3W1u1Fcs6SP76XX1FMGv7cUGtMnO8atS861vHPze4zVOZZRUAMMfVNxAdOOQLDi7zpj4bB+uTNgin6M9jwm37F/+sHSII5D8/N1UhuiPxuc8Tzb9FM4VVqVRvAseLwOCsZRnzzhvbkjjH0zszjLakrgv6EA8RZN85UJm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706130014; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BthpWTlw2BkiPY7xlL82j899+I8S9+DzigRUVf0kQtA=; b=HK9P90N8q6hz15IntCUrm+pHHlh5Us/0evTUYgIb/T6m1Sggod5dh094S4Ggr++I6AcRdU9JuwnkdZc+kV+o1ectBoTJCuCb2ucb6DBN0XHJKwpLxJhdaqU3V84ySli4+diOSQ+mzjS0ghwMuv6jp76t9TgQi+yiWgXk6BFcy1M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1706130014791841.3091624545541; Wed, 24 Jan 2024 13:00:14 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.671239.1044509 (Exim 4.92) (envelope-from ) id 1rSkLj-0007Wn-GW; Wed, 24 Jan 2024 20:59:55 +0000 Received: by outflank-mailman (output) from mailman id 671239.1044509; Wed, 24 Jan 2024 20:59:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rSkLj-0007Wa-DD; Wed, 24 Jan 2024 20:59:55 +0000 Received: by outflank-mailman (input) for mailman id 671239; Wed, 24 Jan 2024 20:59:54 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rSkLi-0006yg-8Y for xen-devel@lists.xenproject.org; Wed, 24 Jan 2024 20:59:54 +0000 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [2607:f8b0:4864:20::82f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 84a4d3a3-bafb-11ee-9b0f-b553b5be7939; Wed, 24 Jan 2024 21:59:52 +0100 (CET) Received: by mail-qt1-x82f.google.com with SMTP id d75a77b69052e-42a446cb1baso15500591cf.0 for ; Wed, 24 Jan 2024 12:59:52 -0800 (PST) Received: from pm2-ws13.praxislan02.com (207-172-141-204.s8906.c3-0.slvr-cbr1.lnh-slvr.md.cable.rcncustomer.com. [207.172.141.204]) by smtp.gmail.com with ESMTPSA id d3-20020ac80603000000b004260b65b4f7sm4643391qth.97.2024.01.24.12.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 12:59:50 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 84a4d3a3-bafb-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706129990; x=1706734790; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BthpWTlw2BkiPY7xlL82j899+I8S9+DzigRUVf0kQtA=; b=AXZz6knApLhe/YDur+gQV/1/s4/5WeHOkxnosC1b7Tw7jUt81u09RWMiZNp0YLIrgD EglE6JNlfPRMWdHHNpsJmYTEu3M/EEbdVTm/gmIdi2RNJVjQA0JJx3aFZFU4NRR7OOnK 8IOioxtVZfdeshf+dR4BmCL0zEjtGpcJXtaEYf2K+QdGwe/qAKI/0iMY3L6/VvrArxqN qfSXLODtRyGtoqhUpJ3wyskWu3BJHr4p/aXdykudwPjHsTf/HfOwZ/+LAyPSi9vz40hE 1e8hqQXnfBlnz0PUpqVA5X/tmrkRp2rJj710HOj4rpA12mEcOwSXDPbdEEaa2Lh6VRcw 3idw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706129990; x=1706734790; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BthpWTlw2BkiPY7xlL82j899+I8S9+DzigRUVf0kQtA=; b=JvQ+1rmyZ9JzQxcYT6qaSMFmVNjgEG0H9nd4FSXJ6l/45MYx/vkY5h1PgNgij9Jujc bQjZGDS4HewFJwW/zBIlPA4LjyiVnzgCXU8buARSVB67hRifCYvNnTPN+pIBb171gMmZ FH851tkLzUXNr0mFcf51Q3VmzmXeSbOKRkcuU6Inl8ATIfAYOF+XOAE4QmS2YbhK3cBL VoDWFRLrAdIZfYDNOf8ZETCNViD2RUqYz6TyF32Hg58heJelBdSKNY4gEoaRDS5N+zHx Ypo7VrdlsYWxofSef/9ByEaO5rpmg94x7eJCNBjB0LnRwQ/EGN3QjjOrKQvIzt4X7GB8 jP6w== X-Gm-Message-State: AOJu0Yy+DZ7ubjEfS94szcK0x2DvQAkjJZA6XdK9bBIfv1e0pL9Tkm3v 6xIIbOM0QorwllzOGen87QAVDBIVuRJdEbnWS9aiq5jCZDoqCzco2nmd4Vkw X-Google-Smtp-Source: AGHT+IEL1N+v8/fKPf+QXUL4GVjzna7A1Yy/9ub/38bNbJfUs/Q8gv0AwbvyW/uXPcE7s0Sw9GJOuQ== X-Received: by 2002:a05:622a:138e:b0:42a:5dc5:fdc8 with SMTP id o14-20020a05622a138e00b0042a5dc5fdc8mr1387749qtk.63.1706129990612; Wed, 24 Jan 2024 12:59:50 -0800 (PST) From: Jason Andryuk To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , Wei Liu , Anthony PERARD Subject: [PATCH v2 2/2] xenpm: Print message for disabled commands Date: Wed, 24 Jan 2024 15:59:22 -0500 Message-ID: <20240124205922.67266-3-jandryuk@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124205922.67266-1-jandryuk@gmail.com> References: <20240124205922.67266-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1706130016869100001 Content-Type: text/plain; charset="utf-8" xenpm get-cpufreq-states currently just prints no output when cpufreq is disabled or HWP is running. Have it print an appropriate message. The cpufreq disabled one mirros the cpuidle disabled one. cpufreq disabled: $ xenpm get-cpufreq-states Either Xen cpufreq is disabled or no valid information is registered! Under HWP: $ xenpm get-cpufreq-states P-State information not supported. Try get-cpufreq-average or start. Also allow xenpm to handle EOPNOTSUPP from the pmstat hypercalls. EOPNOTSUPP is returned when HWP is active in some cases and allows the differentiation from cpufreq being disabled. Signed-off-by: Jason Andryuk --- v2: New tools/misc/xenpm.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c index d982482a3f..79c618590b 100644 --- a/tools/misc/xenpm.c +++ b/tools/misc/xenpm.c @@ -362,7 +362,15 @@ static int show_pxstat_by_cpuid(xc_interface *xc_handl= e, int cpuid) =20 ret =3D get_pxstat_by_cpuid(xc_handle, cpuid, &pxstatinfo); if ( ret ) + { + if ( ret =3D=3D -ENODEV ) + fprintf(stderr, + "Either Xen cpufreq is disabled or no valid informatio= n is registered!\n"); + else if ( ret =3D=3D -EOPNOTSUPP ) + fprintf(stderr, + "P-State information not supported. Try get-cpufreq-a= verage or start.\n"); return ret; + } =20 print_pxstat(cpuid, &pxstatinfo); =20 @@ -382,9 +390,11 @@ void pxstat_func(int argc, char *argv[]) { /* show pxstates on all cpus */ int i; - for ( i =3D 0; i < max_cpu_nr; i++ ) - if ( show_pxstat_by_cpuid(xc_handle, i) =3D=3D -ENODEV ) + for ( i =3D 0; i < max_cpu_nr; i++ ) { + int ret =3D show_pxstat_by_cpuid(xc_handle, i); + if ( ret =3D=3D -ENODEV || ret =3D=3D -EOPNOTSUPP ) break; + } } else show_pxstat_by_cpuid(xc_handle, cpuid); @@ -432,7 +442,7 @@ static uint64_t *sum, *sum_cx, *sum_px; =20 static void signal_int_handler(int signo) { - int i, j, k; + int i, j, k, ret; struct timeval tv; int cx_cap =3D 0, px_cap =3D 0; xc_cputopo_t *cputopo =3D NULL; @@ -473,7 +483,8 @@ static void signal_int_handler(int signo) } } =20 - if ( get_pxstat_by_cpuid(xc_handle, 0, NULL) !=3D -ENODEV ) + ret =3D get_pxstat_by_cpuid(xc_handle, 0, NULL); + if ( ret !=3D -ENODEV && ret !=3D -EOPNOTSUPP ) { px_cap =3D 1; for ( i =3D 0; i < max_cpu_nr; i++ ) --=20 2.43.0