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

Re: [PATCH] x86: enable interrupts around dump_execstate()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 15 Sep 2022 17:43:21 +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=R54Hv3p1A2LG97ycmJp3uzkpF4FYTACcAPHpo/K48iA=; b=aM8KThLDGDLVAaD7EhO8pR9NPQajbThbU7WAP7BC5mD+98pbnBmSNigLOaUpjUPBs3d/gDC9UGBrxYIjtyx2vbSfc0y61frfxrwOzTI1WIrg241yV5WiHaAi14iEIJK4r1gVVZWztlwNs5nYOniXVFgOEpY7z7NfRNTj5qWO04qNsZNQzd/mbjlHCk9TORJ4BoIKYkcVj4RC1ftERVm4+W2sXoXPAG86F4/kVXMmyNh5mcxnm68hNVDmODaHtpDaggc349hjgVmBm8VM2STRjehPtHSVjQmYfV164/xJagW9/rHoQg+vjA78QpEji7xe/2/HmTodINJvyaa/DLsuSA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bsOrZl5FrxHA41IIjT9FXCME7fl1LJPqiOrTVYHAlt6qiKirhwCGxaynIlYU9KlX17sAxBUS7H7buglu+GKgHCp3Lgmm28X3HWujloXyb12XbVWYoCWnuIM9xcQbUh2bs9aDbLE1396YMXspvj0cvBXVowwn8fCWJxCLLIPl+ZA4lod2E3wr9eINNDzNTNNatAOL3nVz7ZQxRi+CCbJjSDmKdHFCeS5uAufaSVxfr5/0zzRR3A9pDasnSbOqzFOJ856X0rZnGyPlJBvAIl3W8i1CrCw993kyfOZycA/RbQ6UJ0w/YZmWY+P7oX8e2UhiPnjWfdTuvT9wDmO5WTTZaw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 15 Sep 2022 15:43:47 +0000
  • Ironport-data: A9a23:JXYSlaoxqjgE/GZvpIoOu1LwFiVeBgzWbkUCkIj8NTMUsmV9RDklARbmC1H/SmUOH6lRJ12Li22o4QS1BUtn7T0DSHuUOmbDA6N/KNYXvgEZKOkUkPTFRcZNoWdCnu9XMzd4FtkxfN4T79Ix/fhR8XW2XWR5YhB9/Plei9QJWo1DInWq7QvhStXeDfXG0b33pwp6WHyZ5NIKAONpfl4n0LwWeWZOhByqbOwbTJKsSXnvhjYKXquFOsrrcAbtrfMYS+q+3bFU6XsUuvsmyGpLofzNdoWZlzxhRrxupRolpBU7z0qulPZzGOr356FOIsrHmprOaFC2E78M6rZHlaUseZp0nwJrsdglEryvS9ejXy2jJzswxUDzxqL2/KCB0WkUIgIPJB24T0KZLvvEGdU7VYtZoX56EwjA7dGvbrECrvLC0Q1rjNtlKj3ARAE7g17BuXJGKFym4TPnQfGuLgD4L90ZVDff6QknKUSo7CYZH1D6SCp9qt4UcSvQWtnGm3Yb6Rw4KFe80b0xrjdWXbA3JWSL+L6Gvdx2jx3CBLW/3X6UO7uPqF9IM8vfqHZ8CauBwjRI6rUJxk9s4SQhcYDhb0/dHpUQMIKkHYUQDCPguR9JrQEA8VNauvB0UUXdAH8M0f2zRN/Fqk5cE/wDnB4WGH/7KFsS278noe30lhAKmM3E3I10IZ5LOCiFp0qCdCQucG5egw/DKLOVylZQhzsAS+l4QozgwdrG7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Kvp+7OMPdupuRP3tCgSVi0G4f9Aa9bac6ECEYT5C0OeTT2cAyFFpL2jIdu3/p7JLOuySJT3KTQLylgkK3f0N57Di4UmvedgnXHvDnvdYjdjTwqD0lnXVW2N2Ij7wNlfP336x64WFci7UbtMuNypjwpwB++8y36OkeKeyzIv14FYnMfT8tB8Smc6+rUDyxxmA/Otmlg576h+dPZ1NsNbzB+8GHGPB2Vt2yFSh2AojmYx/iBsfiyBGg9uz2Xs1FYwA+lU/7R/NCasZV3kvxTfRKmFEsabnUFuz3sh68ERplrDTFyqByXxSkVPefhv0Bm/h2Q41Qn+Z/RsDHxmy2btvZAGxE7WqVZQdxM2LNuZ5uEosr+MDDCcp0cw4g41axAXroxIfaglG0ObVbu2iw3xBWoAj0/qItNWWVVjgeWnUBKVpPApxPJfJAZuYQnKlv39QRS2BMb3GIBKwrybzu7FflCpMI743FOEbD/3D/+Rrpb32k6N+leSblyrlgbaIvN45oizO+HBev4LXuDfLmagrA6g==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Sep 15, 2022 at 10:01:11AM +0200, Jan Beulich wrote:
> On 14.09.2022 16:23, Roger Pau Monné wrote:
> > On Wed, Sep 14, 2022 at 12:13:49PM +0200, Jan Beulich wrote:
> >> On 14.09.2022 11:13, Roger Pau Monné wrote:
> >>> On Wed, Sep 14, 2022 at 10:31:34AM +0200, Jan Beulich wrote:
> >>>> On 14.09.2022 10:14, Jan Beulich wrote:
> >>>>> On 13.09.2022 16:50, Roger Pau Monné wrote:
> >>>>>> On Mon, Dec 13, 2021 at 04:12:55PM +0100, Jan Beulich wrote:
> >>>>>>> show_hvm_stack() requires interrupts to be enabled to avoids 
> >>>>>>> triggering
> >>>>>>> the consistency check in check_lock() for the p2m lock. To do so in
> >>>>>>> spurious_interrupt() requires adding reentrancy protection / handling
> >>>>>>> there.
> >>>>>>
> >>>>>> There's also an ASSERT(!in_irq()) in _percpu_write_lock() that will
> >>>>>> trigger when trying to acquire the p2m lock from spurious_interrupt()
> >>>>>> context, as p2m_lock() -> mm_write_lock() -> _mm_write_lock ->
> >>>>>> percpu_write_lock().
> >>>>>
> >>>>> s/will/may/ since spurious_interrupt() doesn't itself use irq_enter(),
> >>>
> >>> do_IRQ() does call irq_enter(), and that's the caller of
> >>> spurious_interrupt() AFAICT.
> >>
> >> Hmm, you're right. I was mislead by smp_call_function_interrupt()
> >> explicitly using irq_{enter,exit}(). I guess that should have been
> >> removed in b57458c1d02b ("x86: All vectored interrupts go through
> >> do_IRQ()"). I guess I need to either open-code the variant of in_irq()
> >> I'd need, or (perhaps better for overall state) explicitly irq_exit()
> >> before the check and irq_enter() after the call. Thoughts?
> > 
> > Well, it's ugly but it's likely the easier way to get this working.
> 
> Just to clarify - the first of the options I did name is (of course) not
> viable: If we open-coded a local_irq_count() == 1 check here, the
> assertion you named would still trigger.

Oh yes, sorry, I was referring to calling irq_{exit,enter}() around
the show_hvm_stack() call.

I'm slightly worried that this could cause errors with reentrancy in
case we get further interrupts, or even and NMI.

Mutating the environment to make it suitable for what the function
expects seems troublesome in case we get any other interrupts or
exceptions that rely on the state being correct.

But again I cannot see a good way to sort this out short of
introducing an unlocked p2m walker (and related accessors) to use
under this conditions.  I haven't looked myself, but I would expect
this to be a non-trivial amount of work.

Thanks, Roger.



 


Rackspace

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