[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 19 Oct 2021 14:08:38 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=kCdjDF8YVZif6oyeX01pU0Njxv+3yqCRWQgr37al+KY=; b=mHW1f8HzhAORCKG+BD0awCdV5nxo+x0/Q1LR5mQj5ZxLb5MrcmagnFxvT9HU5RxNH3vw42ywKqRVq0DLleWttSMuEShHjDNSzYLx0y5ChlADkj1fBY41alCyEeHoQ8uilQ7EBp1OG5UqcLaJVjKd7v2jhkWbLMl773kAei+BQamENAQixAxibzmUir+lyc/Os4j+164mOBpsG8Mo4Y0OMRwwT4XK++YZ9XHZ6Lf7BRW0m1WLR8bO8Jpf0CzHmeXrj6LwuKiLOtA4z1H0y1lPnBpBb9ncNeq/SGEAFM0Yixt+2pyoMJIcDFwh7K4mObv5dkaHdX0EnyOXgGpT8Y0N+Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j3tKPMadIpgwYskPYlpHv6HCEWmjYYppeA/uOs66YZA5LdsK8Vfo0oASSpzPCrlF+LkLkOK37A1564VclX9Mmjrg8MkbT4Kj5TOF0gftuoLwXDMXQePlPNm4rjoDUoeuywyoLK/fjjJVeBfeR2SDqUXSKIZZ7EHdektoQUcn2h0c2fArXFtuDwt0kf5M8BaHKxXC542Mx43HWMx4cFiHOLzPE3PUgRNm6lUz9CTmt3yD/wwTcemAkvjLzL413EjX5+hD82f6Tpi7ENJj7wmbOW9zeyKZV8Ym4cXxE4Dq3gw39JoJ/xIAHypyUjSVj1603ydqL5LaVpw2kF2/LgRIIA==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 19 Oct 2021 12:08:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.10.2021 13:30, Roger Pau Monné wrote:
> 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>

Thanks.

>> @@ -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?

There is one, and it was even visible in patch context that you
did strip from your reply:

         if ( !hpet_address )
             printk("Disabling HPET for being unreliable\n");

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.