[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] x86/hpet: Use another crystalball to evaluate HPET usability
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Tue, 19 Oct 2021 13:30:17 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V74hYCJTI8XNv2qDJ17ZsmmKDEgzk14vxa4bRbPtGZc=; b=ApFjopDXFAiAEz731eodkPzcW6FAfOCjVCA2HpXbIiVHlP5l6oy9HGcjLrCM5s4XBrWXEPbZe0Go1I4rVe7oDbT8t6ow5Xoa7nDB7x3GdCGeFVfyhUxEX5CBMKRXGjZNCTeVmh5fd4qadyFIMboRt2d9Bom2oUJjP4k+QmGuF7+PCjnwpg3gvU8dQuoxLCtHRKV5wT9Vmt4Zn2vP8MRr+40JGls4dQRuCsAU/3sCGp4QuRoYesLbJZzsesJZ083LJ9FYMV3cg1SWYcn5USv8uaI4KzTrKo8FhcbgbVyjYxuW9fMA2zO82MO9Jffl7lgV5CDfIzx5s1f7E4N3smIyTg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YZlMssREYHiCE9ONUVCpewOdKki19Dj3Ay0TVRQJSUY+dVdsMQDsIXG5i3XtCo09TYQq5qORXkbjDrOimkHR9MB87DdBmxuc2N8aTilRWUWW6ERt9pW7pyt2+jfSUaio8/5pIPfAzebmmZtsLqRNnJ1LYCstOAIuekTrs0BQMepFMTKFWyvkxM7VgEKHArzk4OvZy467rU8yCr4KYuPaY1jSkkI25ZQW9GsbzxmIs5Pd/SI38I/Agq4RrekufOeSWxouEvvNnMZtV0u2zlvoP2P0V+Akx5dzk1DADpLQqnDAkzZNgEDsxVKjFCesStsBNNu32s9+1ZSY9N99j9SfiA==
- Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Tue, 19 Oct 2021 11:31:31 +0000
- Ironport-data: A9a23:x+bF9K1i69j+ggoPzfbD5Qt2kn2cJEfYwER7XKvMYLTBsI5bp2YAz mYWC2rVa6vbZTSged93a9nn9kkCv5bVmIJhTAVtpC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkS5PE3oHJ9RGQ74nRLlbHILOCan0ZqTNMEn970Es7wr9h2OaEvPDia++zk YKqyyHgEAfNNw5cagr4PIra9XuDFNyr0N8plgRWicJj5TcypFFMZH4rHomjLmOQf2VhNrXSq 9Avbl2O1jixEx8FUrtJm1tgG6EAaua60QOm0hK6V0U+6/TrS+NbPqsTbZIhhUlrZzqhpd5V9 ucQus2LUSAwApP+t+oTfgcIKnQrVUFG0OevzXmXtMWSywvNcmf2wuUoB0YzVWEa0r8pWycUr 6VecW1TKEDY7w616OvTpu1EnMMsIdOtJIoCknph0SvYHbAtRpWrr6DiuIIAjGps1pwm8fD2b NUaNjEobC/6egwIYHw2N5M4lsGVvyyqG9FfgA3M/vdmi4TJ9yRu1JD9PdyTfcaFLe1Fk0Ddq m/Y8mDRBhABKMfZ2TeD6mirhOLEgWX8Qo16PL+y++NugVaT7ncOExBQXly+ycRVkWbnBYgZc RZNvHNz8+5iryRHU+URQTWCrlq6jEMTCuFINPQG1jOixKT5/VagUz1soiF6VPQqs8o/RDoP3 1CPns/0C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um8rJ9ISuv0uFDzsaE52Ihz0JdDpzeXcGIjWua6BJcK Z1saF81kWdkDksH4mGL0hAe9KGi8zAlZrgbxJDLxk76DOWhTftzLLhCRCX0joXTjsKmN4ZgC f4uj28wp/mn+Cwyxfa2WOWx5NKmOH5wt8GIMCXkMAaJhjllw7tToV8XL+puiwzvYiUmRoXue iJhy1lE9V46nvXcG3wiRzx2zP42DJr0HPmwU/wuwqqneXJABYBT+ZRj4NQdRXUr2A6ustn7a 5N12WF87JKEBLphk3Glpj1fiAvsnDxjWspkOYVgXAae5AZcqVtoYsW+14QOIscHRj99JssHI BVfYDhDc5tABGnhk3izyxSKITGZAV2Iv7GeDlNhiWt6UkUoJgjpHFog/D2nR87hdsAotd/lq L52gkBrsA7ciYsV9MOOA42e7rANoX8e2O+DIusGyWTKEgmAQOHl3el2sR+2AmVEKZ4u6fa3q 6xCW9liQ==
- Ironport-sdr: H9n8eDAfajAdqufTUgJ1IcTgJDsgphXZYAYLRtAM9Aajr3d2j3SZN5TLwsG4DvTsESHT2s8Giw 0Q3UxOjGz5XzM6JI4gwYlzn3RVzYl/PUyiZkGyGIjy5BtgvN0gmhPjrWtdfsqJsvc6no6dOgr4 RmJt9vWe4TFH8GjJVsA+EJyuqMBCQeP+0x6fWvmg5PDOthEHkNpRNDl/fBi8oLGfDWUXy8qRpU vYQoaFE5CdHH6yOBjvYedhkwCB7C2UlQMqMXKn6jDXfMXZFFlXLJRIb/HEmhV9kBuRud0VfT9d lqIN/1HNX+ZXSZyOaGCY5dRa
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, Oct 19, 2021 at 09:07:39AM +0200, Jan Beulich wrote:
> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>
> On recent Intel systems the HPET stops working when the system reaches PC10
> idle state.
>
> The approach of adding PCI ids to the early quirks to disable HPET on
> these systems is a whack a mole game which makes no sense.
>
> Check for PC10 instead and force disable HPET if supported. The check is
> overbroad as it does not take ACPI, mwait-idle enablement and command
> line parameters into account. That's fine as long as there is at least
> PMTIMER available to calibrate the TSC frequency. The decision can be
> overruled by adding "clocksource=hpet" on the Xen command line.
>
> Remove the related PCI quirks for affected Coffee Lake systems as they
> are not longer required. That should also cover all other systems, i.e.
> Ice Lake, Tiger Lake, and newer generations, which are most likely
> affected by this as well.
>
> Fixes: Yet another hardware trainwreck
> Reported-by: Jakub Kicinski <kuba@xxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> [Linux commit: 6e3cd95234dc1eda488f4f487c281bac8fef4d9b]
>
> I have to admit that the purpose of checking CPUID5_ECX_INTERRUPT_BREAK
> is unclear to me, but I didn't want to diverge in technical aspects from
> the Linux commit.
>
> In mwait_pc10_supported(), besides some cosmetic adjustments, avoid UB
> from shifting left a signed 4-bit constant by 28 bits.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Just one comment below.
> ---
> v2: Fully different replacement of "x86: avoid HPET use also on certain
> Coffee Lake H".
>
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -34,6 +34,7 @@
> #include <asm/fixmap.h>
> #include <asm/guest.h>
> #include <asm/mc146818rtc.h>
> +#include <asm/mwait.h>
> #include <asm/div64.h>
> #include <asm/acpi.h>
> #include <asm/hpet.h>
> @@ -395,14 +396,43 @@ static int64_t __init init_hpet(struct p
> }
>
> /*
> - * Some Coffee Lake platforms have a skewed HPET timer once the SoCs
> - * entered PC10.
> + * Some Coffee Lake and later platforms have a skewed HPET timer once
> + * they entered PC10.
> + *
> + * Check whether the system supports PC10. If so force disable HPET
> as
> + * that stops counting in PC10. This check is overbroad as it does
> not
> + * take any of the following into account:
> + *
> + * - ACPI tables
> + * - Enablement of mwait-idle
> + * - Command line arguments which limit mwait-idle C-state support
> + *
> + * That's perfectly fine. HPET is a piece of hardware designed by
> + * committee and the only reasons why it is still in use on modern
> + * systems is the fact that it is impossible to reliably query TSC
> and
> + * CPU frequency via CPUID or firmware.
> + *
> + * If HPET is functional it is useful for calibrating TSC, but this
> can
> + * be done via PMTIMER as well which seems to be the last remaining
> + * timer on X86/INTEL platforms that has not been completely
> wreckaged
> + * by feature creep.
> + *
> + * In theory HPET support should be removed altogether, but there are
> + * older systems out there which depend on it because TSC and APIC
> timer
> + * are dysfunctional in deeper C-states.
> */
> - if ( pci_conf_read16(PCI_SBDF(0, 0, 0, 0),
> - PCI_VENDOR_ID) == PCI_VENDOR_ID_INTEL &&
> - pci_conf_read16(PCI_SBDF(0, 0, 0, 0),
> - PCI_DEVICE_ID) == 0x3ec4 )
> - hpet_address = 0;
> + if ( mwait_pc10_supported() )
> + {
> + uint64_t pcfg;
> +
> + rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, pcfg);
> + if ( (pcfg & 0xf) < 8 )
> + /* nothing */;
> + else if ( !strcmp(opt_clocksource, pts->id) )
> + printk("HPET use requested via command line, but
> dysfunctional in PC10\n");
> + else
> + hpet_address = 0;
Should we print a message that HPET is being disabled?
Thanks, Roger.
|