From: Roland Dreier <rdreier@cisco.com>
To: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH 1/7] mlx4: Added interrupts test support
Date: Thu, 01 Oct 2009 20:32:08 -0700 [thread overview]
Message-ID: <adaeipmqxmv.fsf@cisco.com> (raw)
In-Reply-To: <4AC4BD9A.2050101@mellanox.co.il> (Yevgeny Petrilin's message of "Thu, 01 Oct 2009 16:32:58 +0200")
This feels like a pretty risky thing to do while the device might be
handling all sorts of other traffic at the same time. Are you sure
there are no races you expose here? Have you actually seen cases where
the interrupt test during initialization works but then this test
catches a problem? (My experience has been that if any MSI-X interrupts
work from a device, then they'll all work)
> +/* A test that verifies that we can accept interrupts on all
> + * the irq vectors of the device.
> + * Interrupts are checked using the NOP command.
> + */
> +int mlx4_test_interrupts(struct mlx4_dev *dev)
> +{
> + struct mlx4_priv *priv = mlx4_priv(dev);
> + int i;
> + int err;
> +
> + err = mlx4_NOP(dev);
> + /* When not in MSI_X, there is only one irq to check */
> + if (!(dev->flags & MLX4_FLAG_MSI_X))
> + return err;
> +
> + /* A loop over all completion vectors, for each vector we will check
> + * whether it works by mapping command completions to that vector
> + * and performing a NOP command
> + */
> + for (i = 0; !err && (i < dev->caps.num_comp_vectors); ++i) {
> + /* Temporary use polling for command completions */
you want the adverb form here: "Temporarily"
> + mlx4_cmd_use_polling(dev);
> +
> + /* Map the new eq to handle all asyncronous events */
"asynchronous"
> + err = mlx4_MAP_EQ(dev, MLX4_ASYNC_EVENT_MASK, 0,
> + priv->eq_table.eq[i].eqn);
> + if (err) {
> + mlx4_warn(dev, "Failed mapping eq for interrupt test\n");
> + mlx4_cmd_use_events(dev);
> + break;
> + }
> +
> + /* Go back to using events */
> + mlx4_cmd_use_events(dev);
> + err = mlx4_NOP(dev);
You could simplify the code a bit by moving the mlx4_cmd_use_events() to
before where you test err, ie:
err = mlx4_MAP_EQ(...);
mlx4_cmd_user_events(dev);
if (err)
mlx4_warn(dev, ...)
else
err = mlx4_NOP(dev);
> + }
> +
> + /* Return to default */
> + mlx4_MAP_EQ(dev, MLX4_ASYNC_EVENT_MASK, 0,
> + priv->eq_table.eq[dev->caps.num_comp_vectors].eqn);
> + return err;
> +}
next prev parent reply other threads:[~2009-10-02 3:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 14:32 [PATCH 1/7] mlx4: Added interrupts test support Yevgeny Petrilin
2009-10-02 3:32 ` Roland Dreier [this message]
2009-10-02 5:27 ` David Miller
2009-10-05 11:16 ` Yevgeny Petrilin
2009-10-05 16:18 ` Roland Dreier
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=adaeipmqxmv.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=yevgenyp@mellanox.co.il \
/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).