[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ping: [PATCH] x86/xstate: reset cached register values on resume
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Thu, 21 Oct 2021 15:44:27 +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=1V3W6thCWTMKPgbT153Lf3fvyqIStFPaYavshmnXRc0=; b=V2rd1hGKqr8XrCpXKtl0AMKRlULdZoIXPuONiw5Bq4rccGjprHEiZXr3tiYouQMPq3OhrslKnRxfD30xLH+cNh9QpAu/ow00h2CmuG4Su8tPheV2KQziXMaI5whOurNcEr5WlYacVW6MLv9Loi2OSNOg/xKOVkKqVvwH2lhMdpV+Q/+ecZUVj3oqMN27YGTG/JeZvlbHah+n7s7j+DMJIEEKNM9Cef1zMgDX8CiXoL3LniPZ1fK4N3Qx16PCTfbN+YAvDsX9hXqtCTaUWC7qMrhhQmLFabq1FbtCGtKKGg7YbUfIQ8NNwiSfOCWHcanFNUMrfvBSHkBl5WRerHdrsg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aa4t0YHCb+CCEVOnlbE0OMFhtT8yU2Ciszexxkm2vshwM4/nk0WdB0kxRFuHMMnE5WG73FmIcJFcZivit3MQuASeg4s9kyiYc1gsnjt57NwduAF8OjYVTgsMrxYtOQSo7yRewYLpyLIDHebZsrIlE2EYJX9J1SLD/hUzQ5QEr5tHrTpWBprOSKPIHsbK0yeqvs1meTklCArE7xWNspxv64w8GJ6Q/S2jqLaQKLZNv/iwr/5iU2GN4S6XeQhOtQUkpq77Ur6A0/pWb60catSIz/hmg6gDuIumeNCZuXanqDTDFiRhGZEOKb3cOImkbvtgqwnfznVnxavudMsOZ4jGsQ==
- Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
- Delivery-date: Thu, 21 Oct 2021 13:45:17 +0000
- Ironport-data: A9a23:lgwmnK/6lBJ1K0kk0NoXDrUDFnmTJUtcMsCJ2f8bNWPcYEJGY0x3y WIbUDrQbqyMY2f0LdgjOtzgp0NS65aEmt9hG1E/rSw8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhGmeIdA970Ug6wrZj29Yx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhX0 O9kuqWgdz0ZJ4KUpsMtfCJ8HSBxaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguw5K8bmJsUHs2xIxjDFF/c2B5vERs0m4PcFgWhs3JERRZ4yY eI8ODxuTBHybCZsGXk2NMwCoM2Wp3ngJmgwRFW9+vNsvjm7IBZK+KjgNp/Zd8KHQe1Rn12Ev STW8mLhGBYYOdeDjz2f/RqEh/DNtTP2XpoIE7+1/eIsh0ecrkQWAQcTXEG2otG4jFC/QNNVL 0EI+isoorM2/UbtRd74NzW6qnO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pOeYIsimQD101hICG9E/bo9P xG88536faZslossRMb8+xoSZPhfZq0z/ccirX5W43MYOCMggqVxe9Zg7ff/w==
- Ironport-sdr: xGuOyD9paJCAlaZEVzqBD955AJo93agTlmHSefSNYwt6UIqLbxV9ZSKv2MIRC4aqc5EaRTC3qQ Gn+5nBMDxGEZUDqQTzIAXE8r6v/2Ff0jOuvQRePPB105rW+P+DHlO4cPEdw8XFSRDQZPPZrh4j sfsrPScGkIUl+LgTk6AwS9R9SGhgihEJt2yIZb6kW3oGp+ebXxb9S3RxKnD5YLE+BhsRXJasJn jQ9zaRrjfx62Mj0qbv81fiLMf7Oi5FielnaqLhx42B7izLs2tyMREMOFvOdRUwRLXXWfBvkFcf Ygu7YsQ8JVHXlvmZAYxbvZUZ
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Mon, Oct 18, 2021 at 10:21:28AM +0200, Jan Beulich wrote:
> On 24.08.2021 23:11, Andrew Cooper wrote:
> > On 18/08/2021 13:44, Andrew Cooper wrote:
> >> On 18/08/2021 12:30, Marek Marczykowski-Górecki wrote:
> >>> set_xcr0() and set_msr_xss() use cached value to avoid setting the
> >>> register to the same value over and over. But suspend/resume implicitly
> >>> reset the registers and since percpu areas are not deallocated on
> >>> suspend anymore, the cache gets stale.
> >>> Reset the cache on resume, to ensure the next write will really hit the
> >>> hardware. Choose value 0, as it will never be a legitimate write to
> >>> those registers - and so, will force write (and cache update).
> >>>
> >>> Note the cache is used io get_xcr0() and get_msr_xss() too, but:
> >>> - set_xcr0() is called few lines below in xstate_init(), so it will
> >>> update the cache with appropriate value
> >>> - get_msr_xss() is not used anywhere - and thus not before any
> >>> set_msr_xss() that will fill the cache
> >>>
> >>> Fixes: aca2a985a55a "xen: don't free percpu areas during suspend"
> >>> Signed-off-by: Marek Marczykowski-Górecki
> >>> <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> >> I'd prefer to do this differently. As I said in the thread, there are
> >> other registers such as MSR_TSC_AUX which fall into the same category,
> >> and I'd like to make something which works systematically.
> >
> > Ok - after some searching, I think we have problems with:
> >
> > cpu/common.c:47:DEFINE_PER_CPU(struct cpuidmasks, cpuidmasks);
> > cpu/common.c:120:static DEFINE_PER_CPU(uint64_t, msr_misc_features);
> > msr.c:35:DEFINE_PER_CPU(uint32_t, tsc_aux);
> > xstate.c:36:static DEFINE_PER_CPU(uint64_t, xcr0);
> > xstate.c:79:static DEFINE_PER_CPU(uint64_t, xss);
> >
> > There is also:
> >
> > traps.c:100:DEFINE_PER_CPU(uint64_t, efer);
> >
> > which we *almost* handle correctly, but fail to update the cache on the
> > BSP out of S3.
> >
> >
> > For the APIC, I think we have issues with:
> >
> > irq.c:1083:static DEFINE_PER_CPU(struct pending_eoi,
> > pending_eoi[NR_DYNAMIC_VECTORS]);
> >
> > because we don't defer S3 until all pending EOIs are complete.
>
> As your planned more extensive rework appears to not have made much
> progress yet, may I suggest that we go with Marek's fix for 4.16,
> with the one adjustment I suggested alongside giving my R-b?
I think that's the only viable solution in order to avoid shipping a
broken 4.16 so we should go ahead with it.
Thanks, Roger.
|