From: "Michael S. Tsirkin" <mst@mellanox.co.il>
To: Roland Dreier <roland@topspin.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: Re: [openib-general] [PATCH][5/18] InfiniBand/mthca: add needed rmb() in event queue poll
Date: Thu, 13 Jan 2005 11:45:32 +0200 [thread overview]
Message-ID: <20050113094532.GA31298@mellanox.co.il> (raw)
In-Reply-To: <20051121347.vxtR3merv690zIQY@topspin.com>
Hello!
Quoting r. Roland Dreier (roland@topspin.com) "[openib-general] [PATCH][5/18] InfiniBand/mthca: add needed rmb() in event queue poll":
> Add an rmb() between checking the ownership bit of an event queue
> entry and reading the contents of the EQE. Without this barrier, the
> CPU could read stale contents of the EQE before HW writes the EQE but
> have the read of the ownership bit reordered until after HW finishes
> writing, which leads to the driver processing an incorrect event. This
> was actually observed to happen when multiple completion queues are in
> heavy use on an IBM JS20 PowerPC 970 system.
>
> Also explain the existing rmb() in completion queue poll (there for
> the same reason) and slightly improve debugging output.
>
> Signed-off-by: Roland Dreier <roland@topspin.com>
>
> --- linux/drivers/infiniband/hw/mthca/mthca_cq.c (revision 1437)
> +++ linux/drivers/infiniband/hw/mthca/mthca_cq.c (revision 1439)
> @@ -1,5 +1,5 @@
> /*
> - * Copyright (c) 2004 Topspin Communications. All rights reserved.
> + * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
> *
> * This software is available to you under a choice of one of two
> * licenses. You may choose to be licensed under the terms of the GNU
> @@ -391,6 +391,10 @@
> if (!next_cqe_sw(cq))
> return -EAGAIN;
>
> + /*
> + * Make sure we read CQ entry contents after we've checked the
> + * ownership bit.
> + */
> rmb();
>
> cqe = get_cqe(cq, cq->cons_index);
> @@ -768,7 +772,8 @@
> u32 *ctx = MAILBOX_ALIGN(mailbox);
> int j;
>
> - printk(KERN_ERR "context for CQN %x\n", cq->cqn);
> + printk(KERN_ERR "context for CQN %x (cons index %x, next sw %d)\n",
> + cq->cqn, cq->cons_index, next_cqe_sw(cq));
> for (j = 0; j < 16; ++j)
> printk(KERN_ERR "[%2x] %08x\n", j * 4, be32_to_cpu(ctx[j]));
> }
> --- linux/drivers/infiniband/hw/mthca/mthca_eq.c (revision 1437)
> +++ linux/drivers/infiniband/hw/mthca/mthca_eq.c (revision 1439)
> @@ -1,5 +1,5 @@
> /*
> - * Copyright (c) 2004 Topspin Communications. All rights reserved.
> + * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
> *
> * This software is available to you under a choice of one of two
> * licenses. You may choose to be licensed under the terms of the GNU
> @@ -240,6 +240,12 @@
> int set_ci = 0;
> eqe = get_eqe(eq, eq->cons_index);
>
> + /*
> + * Make sure we read EQ entry contents after we've
> + * checked the ownership bit.
> + */
> + rmb();
> +
> switch (eqe->type) {
> case MTHCA_EVENT_TYPE_COMP:
> disarm_cqn = be32_to_cpu(eqe->event.comp.cqn) & 0xffffff;
Since we are using the eqe here, it seems that read_barrier_depends
shall be sufficient (as well as in the cq case)?
However, I see that read_barrier_depends is a nop on ppc, and the
comment indicates that problems were seen on ppc 970.
What gives? do I misunderstand what a dependency is?
MST
next prev parent reply other threads:[~2005-01-13 9:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-12 21:47 [PATCH][0/18] InfiniBand: updates for 2.6.11-rc1 Roland Dreier
2005-01-12 21:47 ` [PATCH][1/18] InfiniBand/IPoIB: use correct static rate in IpoIB Roland Dreier
2005-01-12 21:47 ` [PATCH][2/18] InfiniBand/mthca: trivial formatting fix Roland Dreier
2005-01-12 21:47 ` [PATCH][3/18] InfiniBand/mthca: support RDMA/atomic attributes in QP modify Roland Dreier
2005-01-12 21:47 ` [PATCH][4/18] InfiniBand/mthca: clean up allocation mapping of HCA context memory Roland Dreier
2005-01-12 21:47 ` [PATCH][5/18] InfiniBand/mthca: add needed rmb() in event queue poll Roland Dreier
2005-01-12 21:47 ` [PATCH][6/18] InfiniBand/core: remove debug printk Roland Dreier
2005-01-12 21:47 ` [PATCH][7/18] InfiniBand: make more code static Roland Dreier
2005-01-12 21:47 ` [PATCH][8/18] InfiniBand/core: set byte_cnt correctly in MAD completion Roland Dreier
2005-01-12 21:47 ` [PATCH][9/18] InfiniBand/core: add QP number to work completion struct Roland Dreier
2005-01-12 21:47 ` [PATCH][10/18] InfiniBand/core: add node_type and phys_state sysfs attrs Roland Dreier
2005-01-12 21:48 ` [PATCH][11/18] InfiniBand/mthca: clean up computation of HCA memory map Roland Dreier
2005-01-12 21:48 ` [PATCH][12/18] InfiniBand/core: fix handling of 0-hop directed route MADs Roland Dreier
2005-01-12 21:48 ` [PATCH][13/18] InfiniBand/core: add more parameters to process_mad Roland Dreier
2005-01-12 21:48 ` [PATCH][14/18] InfiniBand/core: add qp_type to struct ib_qp Roland Dreier
2005-01-12 21:48 ` [PATCH][15/18] InfiniBand/core: add ib_find_cached_gid function Roland Dreier
2005-01-12 21:48 ` [PATCH][16/18] InfiniBand: update copyrights for new year Roland Dreier
2005-01-12 21:48 ` [PATCH][17/18] InfiniBand/ipoib: move structs from stack to device private struct Roland Dreier
2005-01-12 21:48 ` [PATCH][18/18] InfiniBand/core: rename handle_outgoing_smp Roland Dreier
2005-01-13 9:45 ` Michael S. Tsirkin [this message]
2005-01-13 15:32 ` [openib-general] [PATCH][5/18] InfiniBand/mthca: add needed rmb() in event queue poll 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=20050113094532.GA31298@mellanox.co.il \
--to=mst@mellanox.co.il \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
--cc=roland@topspin.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;
as well as URLs for NNTP newsgroup(s).