All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: "Chen, Jiqian" <Jiqian.Chen@amd.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"Huang, Ray" <Ray.Huang@amd.com>,
	Anthony PERARD <anthony.perard@vates.tech>
Subject: Re: [PATCH v9 5/8] vpci: Refactor vpci_remove_register to remove matched registers
Date: Mon, 4 Aug 2025 17:31:02 +0200	[thread overview]
Message-ID: <aJDSNon2CdBra9yT@macbook.local> (raw)
In-Reply-To: <BL1PR12MB58499F7343CAC0206676E0BBE727A@BL1PR12MB5849.namprd12.prod.outlook.com>

On Thu, Jul 31, 2025 at 06:28:14AM +0000, Chen, Jiqian wrote:
> On 2025/7/30 19:23, Andrew Cooper wrote:
> > On 28/07/2025 6:03 am, Jiqian Chen wrote:
> >> vpci_remove_register() only supports removing a register in a time,
> >> but the follow-on changes need to remove all registers within a range.
> >> So, refactor it to support removing all registers in a given region.
> >>
> >> And it is no issue to remove a non exist register, so remove the
> >> __must_check prefix.
> >>
> >> Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
> >> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
> > 
> > Bisection says this causes an assertion failure in the unit test.
> > 
> > Running /usr/lib/xen/tests/test_vpci
> > Assertion failed: vpci_remove_registers(test_pdev.vpci, 16, 2) (main.c:
> > main: 407)
> > FAILED: /usr/lib/xen/tests/test_vpci
> Thanks Andrew.
> This is because new function vpci_remove_registers() removes all registers inside (offset, offset + size) and returns failure when overlap happens.
> For tools/tests/vpci/main.c, there are layout:
>      *
>      * 32    24    16     8     0
>      *  +------+------+------+------+
>      *  |            r0             | 0
>      *  +------+------+------+------+
>      *  |  r7  |  r6  |  r5  |//////| 4
>      *  +------+------+------+------|
>      *  |///////////////////////////| 8
>      *  +-------------+-------------+
>      *  |/////////////|    r12      | 12
>      *  +------+------+------+------+
>      *  |r16[3]|r16[2]|r16[1]|r16[0]| 16
>      *  +------+------+------+------+
>      *  |    r20[1]   |    r20[0]   | 20
>      *  +-------------+-------------|
>      *  |            r24            | 24
>      *  +------+------+------+------+
>      *  |//////|  r30 |//////|  r28 | 28
>      *  +------+------+------+------+
>      *  |rsvdz |rsvdp | rw1c |  ro  | 32
>      *  +------+------+------+------+
>      *
> As for the last three test cases:
>     VPCI_REMOVE_INVALID_REG(20, 1);
>     This can success as this overlap with r20[0]
>     VPCI_REMOVE_INVALID_REG(16, 2);
>     VPCI_REMOVE_INVALID_REG(30, 2);
>     These two fail as there are r16[0], r16[1] and r30 inside them, so remove success and test cases fail.

Yes, given that vpci_remove_registers() can now remove multiple
handlers in one call those two tests are simply not correct given the
new behavior of the function.

> So, I think we need to change these two test cases to match the new function's logic, like:
> VPCI_REMOVE_INVALID_REG(0, 2);
> VPCI_REMOVE_INVALID_REG(2, 2);

Those two test exactly the same as the (20, 1) call, so I think they
don't add value to the testing.

I would convert them into valid test cases, so:

VPCI_REMOVE_REG(16, 2);
VPCI_REMOVE_REG(30, 2);

Because they now test the new functionality of removing multiple
handlers with a single call (or removing a handler while dealing with
padding on the sides).

Thanks, Roger.


  reply	other threads:[~2025-08-04 15:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28  5:03 [PATCH v9 0/8] Support hiding capability when its initialization fails Jiqian Chen
2025-07-28  5:03 ` [PATCH v9 1/8] vpci/header: Emulate extended capability list for dom0 Jiqian Chen
2025-07-28  5:03 ` [PATCH v9 2/8] vpci: Refactor REGISTER_VPCI_INIT Jiqian Chen
2025-07-29 12:47   ` Roger Pau Monné
2025-07-28  5:03 ` [PATCH v9 3/8] vpci: Hide legacy capability when it fails to initialize Jiqian Chen
2025-07-28  5:03 ` [PATCH v9 4/8] vpci: Hide extended " Jiqian Chen
2025-07-30  9:50   ` Jan Beulich
2025-07-30 10:19     ` Andrew Cooper
2025-07-30 10:24       ` Jan Beulich
2025-07-30 10:42     ` Nicola Vetrini
2025-07-30 10:46       ` Nicola Vetrini
2025-07-31  6:30         ` Chen, Jiqian
2025-07-28  5:03 ` [PATCH v9 5/8] vpci: Refactor vpci_remove_register to remove matched registers Jiqian Chen
2025-07-30 11:23   ` Andrew Cooper
2025-07-31  6:28     ` Chen, Jiqian
2025-08-04 15:31       ` Roger Pau Monné [this message]
2025-07-28  5:03 ` [PATCH v9 6/8] vpci/rebar: Free Rebar resources when init_rebar() fails Jiqian Chen
2025-07-28  5:04 ` [PATCH v9 7/8] vpci/msi: Free MSI resources when init_msi() fails Jiqian Chen
2025-07-28  5:04 ` [PATCH v9 8/8] vpci/msix: Free MSIX resources when init_msix() fails Jiqian Chen
2025-07-29 16:36   ` Roger Pau Monné
2025-07-30  2:52     ` Chen, Jiqian

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=aJDSNon2CdBra9yT@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.