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

Re: [PATCH for-4.22] xen/pdx: fix off-by-one index in offset mask calculation


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 9 Jun 2026 11:14:52 +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=arcselector10001; 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=ZV7KmSeTuJVAnHZ9Dcqyvz4GbFhJkaHDoiujCVrTNno=; b=pvXe7VquhYrg8u9hO2+jP++XETQTtifMc4rccuzzEf3KIzaY95juK3BscgVf80/8XO+/a0KGmF6p/keOKwZBFB9N1Iqf0S7Ljqau0dI2jdqTVc6sB+xKWrv/w/t55ZL/BhdrrT+mxGZgSwrUZdR3muiyF/oEK6UD4gtNhqZIa6HP+JUIoBoeyC85riBcAQg/U+dQywezOTe+S657YFwG48vZgPlETwPwp0i1DV7wAr4oQ6TliMjL1hZ5vaffGt3zo65AxY607H8TA/ljRxLeWDBPxes507z9NMjcPiL33GQH0jxsJAIFZ21+1JZebj3ibELql0vuYMsNa5OAij41iA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PCXP6+nOgQs8T1o9LUAs/NR4ADLthiBZJIEh85N8sITV2AFm1xzrPgj5aHr5tgRE9gr0DMrJwOIMOWnZk++XCFLnU/V8aaAY6E98IUNkihI9balyNEukur2gdnlJztb+97/0QYtx80YtWtk2EwZ/oTSla/SQg6Tj+2LwqPrHl5o7Ymh+fle2U/vaaADg17jG4I4eI/e2TElsGG0I71LfaF3o8HsdKLQmrXbu31oMlm2Q78WMpRhDZ+Ol9jGfIPusiv5CfIUMP57pv1xsuAMxfVYjAPc3CMDZmz8HTegEeUKwUKx/JMOuXL9Ngi+E8MxCgFFZp8llkPLM4PhKMNF13w==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Tue, 09 Jun 2026 09:15:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Jun 09, 2026 at 09:59:37AM +0100, Andrew Cooper wrote:
> On 09/06/2026 9:53 am, Roger Pau Monne wrote:
> > Adjust the mask calculation in case the last range is merged with the
> > previous one, as then the mask must be calculated from the previous range,
> > which the current one has been merged into.
> >
> > Instead of fixing the off-by-one in place, move the calculation of the bit
> > change mask to the next loop, after the ranges have been merged.  This
> > simplifies the logic by consolidating mask calculation in a single place,
> > possibly making it less error prone in the future.
> >
> > Also add a test case that triggers the bug being fixed by this commit.
> >
> > Fixes: c5c45bcbd6a1 ("pdx: introduce a new compression algorithm based on 
> > region offsets")
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 
> > diff --git a/tools/tests/pdx/test-pdx.c b/tools/tests/pdx/test-pdx.c
> > index d783186577ef..ba57f1793011 100644
> > --- a/tools/tests/pdx/test-pdx.c
> > +++ b/tools/tests/pdx/test-pdx.c
> > @@ -191,6 +191,20 @@ int main(int argc, char **argv)
> >              },
> >              .compress = false,
> >          },
> > +        /*
> > +         * 2s Dell R740, merging of ranges causes mask differences in PDX
> > +         * offset mode.  Useful for checking mask calculations.
> 
> What's the 2s here?  If it is what I think it is, I'd suggest "Dell
> R740, dual socket,"

Yes, it's what you think it is.  I've used "2s" in existing comments,
but I'm perfectly fine with spelling it out.

Thanks, Roger.



 


Rackspace

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