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

Re: [PATCH for-4.17?] x86/paging: return -EINVAL for paging domctls for dying domains


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 8 Nov 2022 17:43:37 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EAOnpEUk1S6xyXv4yVWt+017AJFu5D88A2OWknZHIkU=; b=JVEEiGY8yA2WHKhOSUkJpYGdgvsMxAORnluwi9wFiBtxXQHzbfyNQynYacCeg2kmK+ylNKMGmUfhI5PRmyQ1BKSW4DjeQmkOnogp9m3R7iaWo6jtbMWk9vcqT8F6/19OI6lSIWqGUeTP6q/oNIO1mVy2mIBplavuRg9yYXGE3F/9QFNUau8fds7HN2odVHb2noaANUFIPOz91PXzFUDQ5BwGYXn8oiqzXavm661cVUzuRYpeFWCZ7u+yxRAaduwX/VfB3al4EdA8FSgXIcOp69cmhdx7E2mapSog4w4iK9DanDcX//bBHADh6Uq1JplGRtOt6w6e7H+bO19E1irivw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DkHB0k4AfccOIjp3/R4cOfRsXr6kyNVugl/4fFUJ6PBSsmWEuLhIq3GsFE8nYgglsX4h/h3tjlJHaPxA7CeZX2Bd453PCgBjAZl8HA1NkMn4kEy3nWkmAitRwXO7eXimQpx2ZiXxe2WHSmh92HEdPx/5SdfCB5AfhWBdRiluM/yJLzfJCuGltLEWgjxYyfOV2W+QW7s9WpO9yHu+MpzbtcmrOhOi8I2tNaAsO6aUEMigVK9lzHsqhdXeF5cMNF075qnJFaL6ttLoBT9YbH+Dr3+3jNO5Pxt3MsYL2etpA9j/33ngbYArRDJ+e/aRghVB248OuiuJdqqwH2l4fgDo8A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Henry.Wang@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Edwin Török <edvin.torok@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 08 Nov 2022 16:43:58 +0000
  • Ironport-data: A9a23:oCy70a0/gZks4HKiLfbD5eBwkn2cJEfYwER7XKvMYLTBsI5bpzZVn 2AeWjjXPayLMWD1LdAnOYjn9R5S68CExtFqSABqpC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK5ULSfUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS9nuDgNyo4GlC5wVmNagR1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfJGRe+ cAmDRs2NEqO3+KY7K2kDdVNr5F2RCXrFNt3VnBI6xj8VK5jbbWdBqLA6JlfwSs6gd1IEbDGf c0FZDFzbRPGJRpSJlMQD5F4l+Ct7pX9W2QA9BTJ+uxqsy6KlFQZPLvFabI5fvSQQspYhACAr 3/u9GXlGBAKcteYzFJp91r82rOXwHOlCer+EpXn2LlQnVmIyFA+BTkJDgq8qN/oyUGxDoc3x 0s8v3BGQbIJ3E6hQ8T5Xha4iGWZpRNaUN1Ve8Ua5QeX2+zr6gCWLmEeS3hKb9lOnNAybSwn0 BmOhdyBLSxitviZRGyQ8p+QrCiuIm4FIGkafygGQAAZpd75r+kOYgnnS99iFOu5i4PzEDSpm zSS9nFm3/MUkNIB0Li98RbfmTWwq5PVTwkzoALKQmai6QA/b4mgD2C11WXmAT97BN7xZjG8U LIswaByMMhm4UmxqRGw
  • Ironport-hdrordr: A9a23:r81St668wtPebfaBKgPXwS2BI+orL9Y04lQ7vn2ZFiY5TiXIra qTdaogviMc6Ax/ZJjvo6HkBEClewKlyXcV2/hpAV7GZmXbUQSTTL2KgbGSoAEIXheOjdK1tp 0QD5SWaueAamSS5PySiGfYLz9j+qjgzEnBv5ai854Hd3APV0gP1XYaNu7NeXcGPjWuSKBJY6 a0145inX6NaH4XZsO0Cj0sWPXCncTCkNbDbQQdDxAqxQGShXfwgYSKWiSw71M7aXdi0L0i+W /Kn0jQ4biiieiyzlv523XI55pbtdP9wp9oBdCKiOISNjLw4zzYErhJavmnhnQYseuv4FElnJ 3lpAohBd167zfrcmS8sXLWqnvd+Qdrz0Wn5U6TgHPlr8C8bik9EdB9iYVQdQacw1Y8vflnuZ g7kl6xht5yN1ftjS7979/HW1VBjUyvu0cvluYVkjh2TZYeUrlMtoYSlXklWqvoJBiKp7zPLd MeQv01vJ1tABKnhjHizyJSKeWXLzgO9kzseDlDhiSXuwIm70yRgXFoh/D3pU1wha7Ve6M0mN gsDZ4Y6o2mbvVmGJ6VV91xNfefOyjqfS/mFl60DBDOKJwnUki926Ifpo9FrN2XRA==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Nov 08, 2022 at 05:14:40PM +0100, Jan Beulich wrote:
> On 08.11.2022 12:38, Roger Pau Monne wrote:
> > Like on the Arm side, return -EINVAL when attempting to do a p2m
> > operation on dying domains.
> > 
> > The current logic returns 0 and leaves the domctl parameter
> > uninitialized for any parameter fetching operations (like the
> > GET_ALLOCATION operation), which is not helpful from a toolstack point
> > of view, because there's no indication that the data hasn't been
> > fetched.
> 
> While I can see how the present behavior is problematic when it comes
> to consuming supposedly returned data, ...
> 
> > --- a/xen/arch/x86/mm/paging.c
> > +++ b/xen/arch/x86/mm/paging.c
> > @@ -694,9 +694,10 @@ int paging_domctl(struct domain *d, struct 
> > xen_domctl_shadow_op *sc,
> >  
> >      if ( unlikely(d->is_dying) )
> >      {
> > -        gdprintk(XENLOG_INFO, "Ignoring paging op on dying domain %u\n",
> > +        gdprintk(XENLOG_INFO,
> > +                 "Tried to do a paging domctl op on dying domain %u\n",
> >                   d->domain_id);
> > -        return 0;
> > +        return -EINVAL;
> >      }
> 
> ... going from "success" to "failure" here has a meaningful risk of
> regressing callers. It is my understanding that it was deliberate to
> mimic success in this case (without meaning to assign "good" or "bad"
> to that decision).

I would assume that was the original intention, yes, albeit the commit
message doesn't go into details about why mimicking success is
required, it's very well possible the code relying on this was xend.

> Can you instead fill the data to be returned in
> some simple enough way? I assume a mere memset() isn't going to be
> good enough, though (albeit public/domctl.h doesn't explicitly name
> any input-only fields, so it may not be necessary to preserve
> anything). Maybe zeroing ->mb and ->stats would do?

Hm, it still feels kind of wrong.  We do return errors elsewhere for
operations attempted against dying domains, and that seems all fine,
not sure why paging operations need to be different in this regard.
Arm does also return -EINVAL in that case.

So what about postponing this change to 4.18 in order to avoid
surprises, but then taking it in its current form at the start of the
development window, as to have time to detect any issues?

> As a minor remark: _If_ you're changing the printk(), then please
> also switch to using %pd.

I've considered this, but then printing: "Tried to do a paging domctl
op on dying domain dX" felt kind of repetitive to me because of the
usage of domain and dX in the same sentence.  Anyway, will adjust.

Thanks, Roger.



 


Rackspace

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