public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: Roland Dreier <rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
	Linux-RDMA <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: About a shortcoming of the verbs API
Date: Sun, 8 Aug 2010 17:51:04 -0600	[thread overview]
Message-ID: <20100808235104.GA32488@obsidianresearch.com> (raw)
In-Reply-To: <AANLkTi=My1aK3VsYejeVeRSqo+7RNMX2x6osGNbBERvx-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Sun, Aug 08, 2010 at 08:16:55PM +0200, Bart Van Assche wrote:
> On Sun, Aug 8, 2010 at 3:38 AM, Jason Gunthorpe
> <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> > [ ... ]
> >
> > No, all hardware pretty much works like this. The general flow is:
> >
> > IRQ happens
> > ?(if level triggered 'ack' the IRQ to the HW, to suppress the level)
> > SW processes
> > SW 'does something' to the HW to cause new IRQs to happen
> > IRQ happens.. repeat..
> >
> > [ ... ]
> 
> You might have missed or forgotten the point that was made in the
> first message of this thread.

Erm, Roland asserted the problem you were thinking about did not exist
in Linux, and I thought you agreed?

http://www.spinics.net/lists/linux-rdma/msg05031.html

Was there something else in that message?

I agree there is some variation in what HW is sensitive to for
generating IRQs, and I do agree that making ib_req_notify_cq an event
sensitive condition (ie a new CQ was added) rather than a state
sensitive call back (ie the CQ is not empty) often requires more
code. But it does not fundamentally make IB any different than every
thing else - and it fits within the general flow I outline above.

Further, the approach you outline in your follow on message for
blkio, has problems.. Look at how IPOIB does NAPI to see how
this must look.

1) ib_req_notify_cq must only be called if you are processing less
   the budget
2) blk_iopoll_complete must be called prior to ib_req_notify_cq, since
   call ib_req_notify_cq can immediately generate an interrupt, and
   that interrupt must see the sched bit as cleared. If
   ib_req_notify_cq races then you have to blkiopoll_reschedual.
   (and maybe continue looping depending on your strategy for
    call blkio_poll_disable elsewhere)
3) The idea you can hand off to normal processing if
   blk_iopoll_sched_prep fails in the ISR does not work for anything
   relying on the non-rentrancy of the blkio_poll call back for
   locking. This seems to describe the SRP driver.

There is no easy way you can switch from processing in a non-ISR
context to processing in an interrupt on the fly.. Each relies on
different implicit locking and switching between those two domains is
ugly. Something like this pseudo-code:

srp_supress_ib_req_notify_cq = 1;
blkio_poll_disable();

// now there will be no more blkio calls, and no more interrupts!

// Neuter the ISR while we are piddling:
set_bit(IOPOLL_F_DISABLE, &iop->state);

// Drain the CQ
poll_again:
while (srp_recv_poll_once())
   ;

// Try to swith back to interrupts!
disable_interrupts();
ret = ib_req_notify_cq(priv->recv_cq,
	               IB_CQ_NEXT_COMP |
                       IB_CQ_REPORT_MISSED_EVENTS));
if (ret) {
   enable_interrupts();
   goto poll_agian;
}

// OK! We will *definately* get an interrupt now!
srp_do_not_use_blkio_poll = 1;
enable_interrupts();

Hope this helps,
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-08-08 23:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=zowawGDjyh+uKve_NiRNMXcrqjAk0hRxGSMOv@mail.gmail.com>
     [not found] ` <AANLkTi=zowawGDjyh+uKve_NiRNMXcrqjAk0hRxGSMOv-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-25 18:54   ` About a shortcoming of the verbs API Bart Van Assche
     [not found]     ` <AANLkTinHRnt-jvy0xBOAPUDGcfx6=V6rkRT3t0Ja52FP-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-26 14:21       ` Steve Wise
     [not found]         ` <4C4D99F8.3090206-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2010-07-26 17:59           ` Bart Van Assche
2010-07-26 19:22       ` Roland Dreier
     [not found]         ` <adamxtejbes.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-27  7:54           ` Or Gerlitz
     [not found]             ` <4C4E90B6.5070002-hKgKHo2Ms0FWk0Htik3J/w@public.gmane.org>
2010-07-28 17:44               ` Roland Dreier
     [not found]                 ` <ada1vanfqn1.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-29  6:27                   ` Or Gerlitz
2010-07-27  8:33           ` Bart Van Assche
     [not found]             ` <AANLkTinYuyCqJ6_wq6GH0vQGAY-mwC=7ZLicBnXO+efB-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-27 16:50               ` Roland Dreier
     [not found]                 ` <adafwz4g98j.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-27 18:03                   ` Bart Van Assche
     [not found]                     ` <AANLkTimAk0k-q1EKjaXOadoXvKXbEN9nAky0w1rjixxB-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-27 18:20                       ` Jason Gunthorpe
     [not found]                         ` <20100727182046.GT7920-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-07-27 19:28                           ` Bart Van Assche
     [not found]                             ` <AANLkTimAS6znoCCw33ipVV-W-e1BJS93Fxzp-oe0jO4u-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-27 20:15                               ` Jason Gunthorpe
2010-07-28 17:42                               ` Roland Dreier
     [not found]                                 ` <ada62zzfqpj.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-28 17:51                                   ` Ralph Campbell
     [not found]                                     ` <1280339513.31421.264.camel-/vjeY7uYZjrPXfVEPVhPGq6RkeBMCJyt@public.gmane.org>
2010-07-28 18:01                                       ` Bart Van Assche
2010-07-28 18:05                                       ` Roland Dreier
     [not found]                                         ` <adask33eb36.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-28 18:11                                           ` Ralph Campbell
2010-07-28 18:16                                           ` Roland Dreier
     [not found]                                             ` <adaocdreal0.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-07-28 19:05                                               ` Ralph Campbell
2010-08-07  7:56                           ` Bart Van Assche
     [not found]                             ` <AANLkTimc3iS8=8ZQ9u8tOLP4-q_e+o0=AncZj-Mbre2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-07 16:32                               ` Roland Dreier
     [not found]                                 ` <adavd7mz8m9.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-08-08 18:19                                   ` Bart Van Assche
     [not found]                                     ` <AANLkTinKsLNoia96AVDA6fP9Es5_2Rq_wTgY=z6wk_FE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-09 14:49                                       ` David Dillow
     [not found]                                         ` <1281365347.4968.5.camel-FqX9LgGZnHWDB2HL1qBt2PIbXMQ5te18@public.gmane.org>
2010-08-09 18:45                                           ` Vladislav Bolkhovitin
     [not found]                                             ` <4C604CB4.5060705-d+Crzxg7Rs0@public.gmane.org>
2010-08-09 18:58                                               ` David Dillow
2010-08-08  1:38                               ` Jason Gunthorpe
     [not found]                                 ` <20100808013822.GA15146-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-08-08 18:16                                   ` Bart Van Assche
     [not found]                                     ` <AANLkTi=My1aK3VsYejeVeRSqo+7RNMX2x6osGNbBERvx-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-08 23:51                                       ` Jason Gunthorpe [this message]
     [not found]                                         ` <20100808235104.GA32488-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-08-09  7:57                                           ` Bart Van Assche

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=20100808235104.GA32488@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=bvanassche-HInyCGIudOg@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox