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

Re: Ping: [PATCH 2/4] x86/ACPI: fix S3 wakeup vector mapping


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 29 Dec 2020 11:54:03 +0100
  • 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=rZut+Qh9XgHimERJvc5H7uE+N+wrnwXWN4ncZvqxiIU=; b=Gwd5JB1efTHhRMw41Sowr49aaG0+CeiuKrOsfLTcf32fDTtekyHuijwFT3YsN1TzV9FnPLaNh1BVDGI98Vpg7ffMN42dGosIpe3RA+2hjF7C864hqQLix6bfbHw/W3JL2bzIb2A8MPiLJMVgdrZLU2zCJttl489g++ovNRXnMOmEUsR8V0a4glv4ciI5sv7G/KXUEAPuQXSxMbKRIUdtEuOozbidRBhKsCZAXuM1n4NhvWDriTXPyUaYJ0+rUi0IVU4Ksh3C32ykqeeqsNwbqKYow06PofN5dJs//YluI6/klH4N4ji91L5zh7ADu7gBiIw4VF+gfnRzQTe47qe8Tg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OOQbiJ84TJp4xv+lVYlY40jzYtfb3c+PPSbtvC8n3zbOOW+04Ms4Pbrl/dKNxWvKluROkz4m2QrhTKVM2fMKAEAJ/1zCSGHF9/MayMM7GsLj12/O2hnbkOsPKLAE1J0i1zqW3xDI+gAYR0vGGusvFZsWDk3nY3Rfbdh3MAQZ84pSn87zPJm9DBxFtGrVfuide86ggz/LsN7/Mu30qaQFtMXAMahKCxm8pmhKww4xIiBxM/Li509n41Mn/sDLtBJRGOP4NJwo5Phwb0PpEgBTkKSZojYZX1gd0A3R+TqCcFUIfV76/SMxM4+X3Oy33SeT2L8Jmhl+tMxHhOzT1P///Q==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Tue, 29 Dec 2020 10:54:15 +0000
  • Ironport-sdr: M5+AZBmv/tvFfhg+qCnei6Wgc2MWOBK8L8bfcRHpnsvZdLf3kTjW9pU2lin9Ps73Rc1pbeE4MG jv4N32oFPxseUfvrd1rMr8nLN5MuF9PY8hLKOMY4E6/LH5cxyyOAVxM6O2e2T31bRRyBGRPXTY t6Gok2MmVjzGJmQ3W5U7+NT7YGK7pa0cGn8WA/NBnY3HNad0fYRge4S2kOq9k147PzUYINOKX6 vmL1smEj6ov1aqv/QrjOc/WNug0AEubtPZJK8LYLlro5nB2iTQzIcEAURagF5unr4koYfRYzP8 y2s=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Dec 23, 2020 at 04:09:07PM +0100, Jan Beulich wrote:
> On 30.11.2020 14:02, Jan Beulich wrote:
> > On 24.11.2020 12:04, Jan Beulich wrote:
> >> On 23.11.2020 17:14, Andrew Cooper wrote:
> >>> On 23/11/2020 16:07, Roger Pau Monné wrote:
> >>>> On Mon, Nov 23, 2020 at 04:30:05PM +0100, Jan Beulich wrote:
> >>>>> On 23.11.2020 16:24, Roger Pau Monné wrote:
> >>>>>> On Mon, Nov 23, 2020 at 01:40:12PM +0100, Jan Beulich wrote:
> >>>>>>> --- a/xen/arch/x86/acpi/power.c
> >>>>>>> +++ b/xen/arch/x86/acpi/power.c
> >>>>>>> @@ -174,17 +174,20 @@ static void acpi_sleep_prepare(u32 state
> >>>>>>>      if ( state != ACPI_STATE_S3 )
> >>>>>>>          return;
> >>>>>>>  
> >>>>>>> -    wakeup_vector_va = __acpi_map_table(
> >>>>>>> -        acpi_sinfo.wakeup_vector, sizeof(uint64_t));
> >>>>>>> -
> >>>>>>>      /* TBoot will set resume vector itself (when it is safe to do 
> >>>>>>> so). */
> >>>>>>>      if ( tboot_in_measured_env() )
> >>>>>>>          return;
> >>>>>>>  
> >>>>>>> +    set_fixmap(FIX_ACPI_END, acpi_sinfo.wakeup_vector);
> >>>>>>> +    wakeup_vector_va = fix_to_virt(FIX_ACPI_END) +
> >>>>>>> +                       PAGE_OFFSET(acpi_sinfo.wakeup_vector);
> >>>>>>> +
> >>>>>>>      if ( acpi_sinfo.vector_width == 32 )
> >>>>>>>          *(uint32_t *)wakeup_vector_va = bootsym_phys(wakeup_start);
> >>>>>>>      else
> >>>>>>>          *(uint64_t *)wakeup_vector_va = bootsym_phys(wakeup_start);
> >>>>>>> +
> >>>>>>> +    clear_fixmap(FIX_ACPI_END);
> >>>>>> Why not use vmap here instead of the fixmap?
> >>>>> Considering the S3 path is relatively fragile (as in: we end up
> >>>>> breaking it more often than about anything else) I wanted to
> >>>>> make as little of a change as possible. Hence I decided to stick
> >>>>> to the fixmap use that was (indirectly) used before as well.
> >>>> Unless there's a restriction to use the ACPI fixmap entry I would just
> >>>> switch to use vmap, as it's used extensively in the code and less
> >>>> likely to trigger issues in the future, or else a bunch of other stuff
> >>>> would also be broken.
> >>>>
> >>>> IMO doing the mapping differently here when it's not required will end
> >>>> up turning this code more fragile in the long run.
> >>>
> >>> We can't enter S3 at all until dom0 has booted, as one detail has to
> >>> come from AML.
> >>>
> >>> Therefore, we're fully up and running by this point, and vmap() will be
> >>> fine.
> >>
> >> That's not the point of my reservation. The code here runs when the
> >> system already isn't "fully up and running" anymore. Secondary CPUs
> >> have already been offlined, and we're around the point where we
> >> disable interrupts. Granted when we disable them, we also turn off
> >> spin debugging, but I'd still prefer a path that's not susceptible
> >> to IRQ state. What I admit I didn't pay attention to is that
> >> set_fixmap(), by virtue of being a thin wrapper around
> >> map_pages_to_xen(), similarly uses locks. IOW - okay, I'll switch
> >> to vmap(). You're both aware that it, unlike set_fixmap(), can
> >> fail, aren't you?
> > 
> > Would at least one of the two of you please explicitly reply to
> > this last question, clarifying that you're indeed okay with this
> > new possible source of S3 entry failing?
> 
> I think we want to get this regression addressed, but without the
> explicit consent of at least one of you that introducing a new
> error source to the S3 path is indeed okay I'd prefer not to
> prepare and then send v2. I expect there's going to be some code
> churn (not the least because acpi_sleep_prepare() currently
> returns void), and I'd rather avoid doing the conversion work
> just to then be told to go back to the previous approach.

Since this is a fix for a regression I think we should just take it in
order to avoid delaying any more, so I've Acked the patch.

My preference however would be for this to use vmap. Could the mapping
be established in acpi_fadt_parse_sleep_info instead of having to map
and unmap every time in acpi_sleep_prepare?

The physical address where the wakeup vector resides doesn't change
AFAICT, so it would be fine to keep the mapping.

Thanks, Roger.



 


Rackspace

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