From: Laurentiu Tudor <b10716@freescale.com>
To: <linuxppc-dev@lists.ozlabs.org>, <mpe@ellerman.id.au>
Subject: Re: [PATCH 2/2] powerpc/msi: Use WARN_ON() in msi bitmap selftests
Date: Fri, 10 Oct 2014 11:11:46 +0300 [thread overview]
Message-ID: <543794C2.7010309@freescale.com> (raw)
In-Reply-To: <1412928265-21991-2-git-send-email-mpe@ellerman.id.au>
Hi Michael,
Comment inline.
On 10/10/2014 11:04 AM, Michael Ellerman wrote:
> As demonstrated in the previous commit, the failure message from the msi
> bitmap selftests is a bit subtle, it's easy to miss a failure in a busy
> boot log.
>
> So drop our check() macro and use WARN_ON() instead. This necessitates
> inverting all the conditions as well.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> arch/powerpc/sysdev/msi_bitmap.c | 54 ++++++++++++++++++----------------------
[snip]
>
> /* Free most of them for the alignment tests */
> msi_bitmap_free_hwirqs(&bmp, 3, size - 3);
>
> /* Check we get a naturally aligned offset */
> rc = msi_bitmap_alloc_hwirqs(&bmp, 2);
> - check(rc >= 0 && rc % 2 == 0);
> + WARN_ON(rc < 0 && rc % 2 != 0);
Here and below, shouldn't these be:
WARN_ON(rc < 0 || rc % 2 != 0);
?
> rc = msi_bitmap_alloc_hwirqs(&bmp, 4);
> - check(rc >= 0 && rc % 4 == 0);
> + WARN_ON(rc < 0 && rc % 4 != 0);
> rc = msi_bitmap_alloc_hwirqs(&bmp, 8);
> - check(rc >= 0 && rc % 8 == 0);
> + WARN_ON(rc < 0 && rc % 8 != 0);
> rc = msi_bitmap_alloc_hwirqs(&bmp, 9);
> - check(rc >= 0 && rc % 16 == 0);
> + WARN_ON(rc < 0 && rc % 16 != 0);
> rc = msi_bitmap_alloc_hwirqs(&bmp, 3);
> - check(rc >= 0 && rc % 4 == 0);
> + WARN_ON(rc < 0 && rc % 4 != 0);
> rc = msi_bitmap_alloc_hwirqs(&bmp, 7);
> - check(rc >= 0 && rc % 8 == 0);
> + WARN_ON(rc < 0 && rc % 8 != 0);
> rc = msi_bitmap_alloc_hwirqs(&bmp, 121);
> - check(rc >= 0 && rc % 128 == 0);
> + WARN_ON(rc < 0 && rc % 128 != 0);
>
> msi_bitmap_free(&bmp);
>
> - /* Clients may check bitmap == NULL for "not-allocated" */
> - check(bmp.bitmap == NULL);
> + /* Clients may WARN_ON bitmap == NULL for "not-allocated" */
> + WARN_ON(bmp.bitmap != NULL);
>
> kfree(bmp.bitmap);
> }
> @@ -229,14 +224,13 @@ static void __init test_of_node(void)
> of_node_init(&of_node);
> of_node.full_name = node_name;
>
> - check(0 == msi_bitmap_alloc(&bmp, size, &of_node));
> + WARN_ON(msi_bitmap_alloc(&bmp, size, &of_node));
>
> /* No msi-available-ranges, so expect > 0 */
> - check(msi_bitmap_reserve_dt_hwirqs(&bmp) > 0);
> + WARN_ON(msi_bitmap_reserve_dt_hwirqs(&bmp) <= 0);
>
> /* Should all still be free */
> - check(0 == bitmap_find_free_region(bmp.bitmap, size,
> - get_count_order(size)));
> + WARN_ON(bitmap_find_free_region(bmp.bitmap, size, get_count_order(size)));
> bitmap_release_region(bmp.bitmap, 0, get_count_order(size));
>
> /* Now create a fake msi-available-ranges property */
> @@ -250,11 +244,11 @@ static void __init test_of_node(void)
> of_node.properties = ∝
>
> /* msi-available-ranges, so expect == 0 */
> - check(msi_bitmap_reserve_dt_hwirqs(&bmp) == 0);
> + WARN_ON(msi_bitmap_reserve_dt_hwirqs(&bmp));
>
> /* Check we got the expected result */
> - check(0 == bitmap_parselist(expected_str, expected, size));
> - check(bitmap_equal(expected, bmp.bitmap, size));
> + WARN_ON(bitmap_parselist(expected_str, expected, size));
> + WARN_ON(!bitmap_equal(expected, bmp.bitmap, size));
>
> msi_bitmap_free(&bmp);
> kfree(bmp.bitmap);
>
---
Best Regards, Laurentiu
prev parent reply other threads:[~2014-10-10 8:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-10 8:04 [PATCH 1/2] powerpc/msi: Fix the msi bitmap alignment tests Michael Ellerman
2014-10-10 8:04 ` [PATCH 2/2] powerpc/msi: Use WARN_ON() in msi bitmap selftests Michael Ellerman
2014-10-10 8:11 ` Laurentiu Tudor [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=543794C2.7010309@freescale.com \
--to=b10716@freescale.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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;
as well as URLs for NNTP newsgroup(s).