From: James Bottomley <James.Bottomley@SteelEye.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux-SCSI <linux-scsi@vger.kernel.org>,
akpm@linux-foundation.org
Subject: Re: [PATCH v4 1/2] SCSI: Asynchronous event notification infrastructure
Date: Mon, 29 Oct 2007 12:01:55 -0500 [thread overview]
Message-ID: <1193677315.3383.59.camel@localhost.localdomain> (raw)
In-Reply-To: <47260A65.7040008@garzik.org>
On Mon, 2007-10-29 at 12:29 -0400, Jeff Garzik wrote:
> James Bottomley wrote:
> > On Mon, 2007-10-29 at 12:07 -0400, Jeff Garzik wrote:
> >> James Bottomley wrote:
> >>> This still doesn't solve the fundamental corruption problem:
> >>> sdev->event_work has to contain the work entry until the workqueue has
> >>> finished executing it (which is some unspecified time in the future).
> >>> As soon as you drop the sdev->list_lock, the system thinks
> >>> sdev->event_work is available for reuse. If we fire another event
> >>> before the work queue finished processing the prior event, the queue
> >>> will be corrupted.
> >> I think you're misunderstanding the workqueue code? You can call
> >> schedule_work(&sdev->event_work) from anywhere, any time you like, as
> >> many times as you like.
> >
> > OK, take me through it slowly then ... I think schedule_work(work)
> > inserts work->entry onto the workqueue list (in
> > workqueue.c:insert_work()). If the event hasn't fired, it will already
> > be on the list, so adding the same entry to a list twice causes a list
> > corruption problem.
>
> It does a test_and_set_bit() first thing in queue_work(). Similar
> exclusivity logic is found in net device land. Ah, the fun of locking
> without locks that benh grumbles about :)
Ah, OK, sorry ... I was actually looking at __queue_work().
> > Plus, unfortunately, the CC/UA events are going to have to carry extra
> > sense data; they're not simply going to be triggers saying something
> > happened.
>
> OK this is a fair criticism.
>
> If additional data must be carried, then I must ditch the beloved bitmap
> implementation and go back to a list (with associated GFP_ATOMIC alloc).
>
> I will fix this, unless I receive email to the contrary...
Yes, unfortunately, thanks. If all events were a simple number, it's
easy, but the CC/UA events carry data as well.
James
next prev parent reply other threads:[~2007-10-29 17:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-29 14:42 [PATCH v4 0/2] [SCSI] Asynchronous event notification infrastructure Jeff Garzik
2007-10-29 14:42 ` [PATCH v4 1/2] SCSI: " Jeff Garzik
2007-10-29 15:51 ` James Bottomley
2007-10-29 16:07 ` Jeff Garzik
2007-10-29 16:17 ` James Bottomley
2007-10-29 16:29 ` Jeff Garzik
2007-10-29 17:01 ` James Bottomley [this message]
2007-10-29 21:31 ` [PATCH v5 0/2] SCSI asynchronous event notification API Jeff Garzik
2007-10-29 21:31 ` [PATCH v5 1/2] SCSI: add " Jeff Garzik
2007-10-29 21:31 ` [PATCH v5 2/2] libata: Utilize new SCSI event infrastructure Jeff Garzik
2007-10-29 14:42 ` [PATCH v4 " Jeff Garzik
2007-10-29 15:43 ` [PATCH v4 0/2] [SCSI] Asynchronous event notification infrastructure James Bottomley
2007-10-29 15:58 ` Jeff Garzik
2007-10-29 16:10 ` James Bottomley
2007-10-29 16:24 ` Jeff Garzik
2007-10-29 16:34 ` James Bottomley
2007-10-29 16:48 ` Jeff Garzik
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=1193677315.3383.59.camel@localhost.localdomain \
--to=james.bottomley@steeleye.com \
--cc=akpm@linux-foundation.org \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).