[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1.1 2/2] x86/hpet: Don't enable legacy replacement mode unconditionally


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 26 Mar 2021 16:32:15 +0000
  • 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-SenderADCheck; bh=oQ5U4tMoaLd8RQTZdpC454/U83DhRqVaTFixRadeaXU=; b=PFbBXNkChywHTCawLSMCunDa5XQJr5N1rdQqgv1UJM9nSZvg+os3A2ArvDlOMEkLCwR8qRgm94oAbN5vKMFCo3WxqphCgCUb5osujaX18Gr942k0YWJhOZZ/EuS4GRUaSfmbYr8JMikwI/RwsB/c6cjq4ldzX+rSNVSgeSOg5cGDRFle9zJrQjaAOHKoQ5KdK8xh8HIyNXOdT6KBSej6MRXsTrzWHvJfYmt0OZmaj3v/Uo1yHqrJVnKbhDEZkQrdsJuRFQTCxFjMb+pOrWyirySdqLTynpLBz6X+5/FrlMhzj/CWaAewH70r+1AYRKFlb+3wMYo2yZM7tlZFAvG3NQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KZVWHQzPKxTAHqlt8TSzLP0LV90VxK/cs7GLT/ywT0+Yu92HjyNpPD8c73pu+RdPV/SIavC9Ukv6IrRUAMc4N/D7kPXgfOYToWkzZxVys3ttN84SViInaZ+pemRJnH2j8DIs91pzrisNFfQqmyyNz9seX5o4ICfFNHwG84Tjr6dZlvdyRQjzXHm3LXzcjnap0i+ptgaio+SWk6Cg/7icJ/gGvFv4m+nVUQoFXD6lZ+daBiwl9q4XHEgyt//4xaz0c11DH9z1mRE3q0LBKt8ytymeWqEHCl2NCOyxf8mHq2JWq4XhHVH7Ft5WOM7exZ3LAdO3Sm8Iz5wdJrC6xqfR0Q==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Frédéric Pierret <frederic.pierret@xxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 26 Mar 2021 16:32:57 +0000
  • Ironport-hdrordr: A9a23:HNd9Vq6u5F1gf0XeeQPXwWWEI+orLtY04lQ7vn1ZYSd+NuSFis Gjm+ka3xfoiDAXHEotg8yEJbPoexzh3LZPy800Ma25VAfr/FGpIoZr8Jf4z1TbdxHW3tV2kZ 1te60WMrDNJHBnkMf35xS5Gd48wN+BtJuln/va0m0Fd2BXQotLhj0JbzqzOEtwWQVAGN4dHJ 2T+sJIq1ObCAsqR+68AWQIWPWGmsbCk4jobQVDKxks7gSPij3A0s+HLzGz2BACXzRThYoz6G StqX2F2oyPkdGejiXd2Wja8ohMlLLapOdrKcSQhqEuW03RoymyYoAJYczkgBkUp6WV5E8ugJ 3wpX4bTr5OwlfwWk3wnhf3wQnn118Vmgzf4HuVm2Hqr8C8ZB9SMbs5uatjfhHU61UtsbhHuc ohtQLp1OsjMTr6kCvw/NTOXR1x/3DExUYKquIPk2dZFbIXdb45l/1uwGpuDJwCECjmgbpXdt VGMce03oc1TXqndXzD+kFgzNuwN05DZSuucwwpv8yY1CVuh3Zpz0cU79x3pAZwyLsND7ZD/O jKKaJuifVnSdIXd7t0AKM7TdKwEXGle2OCDEuiZXDcUI0XMXPErJD6pJ0z+eGRYZQNiL8/go 7IXl90vXM7EnieR/Gm7dluyFTgU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port-sdr: wFp4xSbeXsrtIx1WXBtPCmVmXMp1GKhxQXYs7qD90+JutwOi2LBCMNokYxTo4rE/nTmaZSO8qk YQbB1e+6idmw4nCIxu9Ygmrvie7ZUOI3yCF2dFP3uy0BHJVpAEO53H328Wg/wNyXpJ14AA+NfL k4OUOFKGcti7hdrtGn34XeVCnOOFJ7Pt9MNgUDQltiiaiVLzbvrRTbQs+t+mitk+SamqmINQB+ dSeyPeBIHBZTiDafV02BCiAbfhq7EZ+izPfOMI2ivy5aqcN/ElBIS5oIfBgX5bl+4uGH+e8WJd 3Qw=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26/03/2021 09:51, Jan Beulich wrote:
> On 25.03.2021 18:21, Andrew Cooper wrote:
>> --- a/docs/misc/xen-command-line.pandoc
>> +++ b/docs/misc/xen-command-line.pandoc
>> @@ -1274,9 +1274,42 @@ supported. See docs/misc/arm/big.LITTLE.txt for more 
>> information.
>>  When the hmp-unsafe option is disabled (default), CPUs that are not
>>  identical to the boot CPU will be parked and not used by Xen.
>>  
>> +### hpet (x86)
>> +    = List of [ <bool> | broadcast=<bool> | legacy-replacement=<bool> ]
>> +
>> +    Applicability: x86
> If this is the more modern form to express this information, then the
> (x86) I did put on the sub-title line should imo be dropped.

Oops yes.

>
>> +Controls Xen's use of the system's High Precision Event Timer.  By default,
>> +Xen will use an HPET when available and not subject to errata.  Use of the
>> +HPET can be disabled by specifying `hpet=0`.
>> +
>> + * The `broadcast` boolean is disabled by default, but forces Xen to keep
>> +   using the broadcast for CPUs in deep C-states even when an RTC interrupt 
>> is
>> +   enabled.  This then also affects raising of the RTC interrupt.
>> +
>> + * The `legacy-replacement` boolean allows for control over whether Legacy
>> +   Replacement mode is enabled.
>> +
>> +   Legacy Replacement mode is intended for hardware which does not have an
>> +   8025 PIT, and allows the HPET to be configured into a compatible mode.
> 8254 ?

I did spot and fix that...

>
>> @@ -1922,14 +1924,38 @@ static void __init check_timer(void)
>>             vector, apic1, pin1, apic2, pin2);
>>  
>>      if (pin1 != -1) {
>> +        bool hpet_changed = false;
>> +
>>          /*
>>           * Ok, does IRQ0 through the IOAPIC work?
>>           */
>>          unmask_IO_APIC_irq(irq_to_desc(0));
>> +    retry_ioapic_pin:
>>          if (timer_irq_works()) {
>>              local_irq_restore(flags);
>>              return;
>>          }
>> +
>> +        /*
>> +         * Intel chipsets from Skylake/ApolloLake onwards can statically 
>> clock
>> +         * gate the 8259 PIT.  This option is enabled by default in slightly
> 8254?

but failed to spot this one.  (It was an error from the original
patch).  Fixed.

>
>> +         * later systems, as turning the PIT off is a prerequisite to 
>> entering
>> +         * the C11 power saving state.
>> +         *
>> +         * Xen currently depends on the legacy timer interrupt being active
>> +         * while IRQ routing is configured.
>> +         *
>> +         * If the user hasn't made an explicit option, attempt to 
>> reconfigure
> s/option/choice/ or s/made/given/?
>
>> +         * the HPET into legacy mode to re-establish the timer interrupt.
>> +         */
>> +        if ( opt_hpet_legacy_replacement < 0 &&
>> +             !hpet_changed && hpet_enable_legacy_replacement_mode() )
>> +        {
>> +            printk(XENLOG_ERR "..no 8254 timer found - trying HPET Legacy 
>> Replacement Mode\n");
>> +            hpet_changed = true;
>> +            goto retry_ioapic_pin;
>> +        }
>> +
>>          clear_IO_APIC_pin(apic1, pin1);
>>          printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
>>                 "IO-APIC\n");
> As mentioned on irc already, I'm somewhat concerned by doing this change
> first (and also not undoing it if it didn't work). An AMD Turion based
> laptop I was using many years ago required one of the other fallbacks to
> be engaged, and hence I'd expect certain other (old?) systems to be
> similarly affected. Sadly (for the purposes here) I don't have this
> laptop anymore, so wouldn't be able to verify whether the above actually
> breaks there.

Turion is K8, so very obsolete these days.  If it doesn't have an
IO-APIC, its even less likely to have an HPET.

Even if it does have an HPET, there isn't anything to suggest that
legacy replacement mode is broken.

Would you prefer me to undo the change?  Its not easy - we have the boot
time config stashed, but if it was periodic before, the accumulator is
broken because we can never read that value back out.

> As a minor remark, I find the "goto" based approach not very nice (we've
> been generally saying we consider "goto" okay largely for simplification
> of error handling, to avoid having many [partly] redundant function exit
> paths), but I can see how using for() or while() or do/while() would
> make the code larger and require deeper indentation.

Actually there is rather less to repeat than I was expecting.  I think
it is reasonable to take out the goto.

I don't think we want to multiply this with all fallback modes.  The
issue we're fixing here (new systems don't have a PIT) is orthogonal to
the rest of the fallback chain here which is looking for PIC/APIC problems.

~Andrew




 


Rackspace

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