From: Jason Gunthorpe <jgg@ziepe.ca>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
Joao Martins <joao.m.martins@oracle.com>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommufd/selftest: Fix dirty_bitmap tests
Date: Mon, 20 Nov 2023 21:39:37 -0400 [thread overview]
Message-ID: <20231121013937.GH10140@ziepe.ca> (raw)
In-Reply-To: <BN9PR11MB52768448A70C9B3CCB2CDE3D8CB7A@BN9PR11MB5276.namprd11.prod.outlook.com>
On Fri, Nov 17, 2023 at 03:15:25AM +0000, Tian, Kevin wrote:
> > From: Robin Murphy <robin.murphy@arm.com>
> > Sent: Friday, November 17, 2023 1:44 AM
> >
> > On 16/11/2023 5:28 pm, Joao Martins wrote:
> > > On 16/11/2023 16:52, Robin Murphy wrote:
> > >> The ASSERT_EQ() macro sneakily expands to two statements, so the loop
> > >> here needs braces to ensure it captures both and actually terminates the
> > >> test upon failure.
> > >
> > > Ugh
> > >
> > >> Where these tests are currently failing on my arm64
> > >> machine, this reduces the number of logged lines from a rather
> > >> unreasonable ~197,000 down to 10. While we're at it, we can also clean
> > >> up the tautologous "count" calculations whose assertions can never fail
> > >> unless mathematics and/or the C language become fundamentally broken.
> > >>
> > >> Fixes: a9af47e382a4 ("iommufd/selftest: Test
> > IOMMU_HWPT_GET_DIRTY_BITMAP")
> > >> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> > >
> > > I was going to say that the second assert is useful, but we are already test
> > the
> > > number of bits we set against what the mock domain set after
> > > mock_domain_set_dirty(). So the second is redundantly testing the same,
> > and can
> > > be removed as you are doing. Thanks for fixing this.
> >
> > Yeah, it's still effectively just counting half the number of loop
> > iterations executed, but since there's no control flow that could exit
> > the loop early and still reach the assertion, it must always be true
> > following the previous assertion that out_dirty == nr == nbits/2.
> >
> > > I would suggest the subject to:
> > >
> > > iommufd/selftest: Fix _test_mock_dirty_bitmaps()
> > >
> > > Because dirty-bitmap tests seems to imply the whole fixture, which covers
> > more
> > > than the bitmaps.
> >
> > Sure, that sounds reasonable. Jason, Kevin, would you want a v2 for that
> > or could it be fixed up when applying?
> >
>
> Jason can help fix it when applying.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Done
Thanks,
Jason
prev parent reply other threads:[~2023-11-21 1:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 16:52 [PATCH] iommufd/selftest: Fix dirty_bitmap tests Robin Murphy
2023-11-16 17:28 ` Joao Martins
2023-11-16 17:43 ` Robin Murphy
2023-11-17 3:15 ` Tian, Kevin
2023-11-21 1:39 ` Jason Gunthorpe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231121013937.GH10140@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=iommu@lists.linux.dev \
--cc=joao.m.martins@oracle.com \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox