mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peter T. Breuer" <ptb@it.uc3m.es>
To: "linux kernel" <linux-kernel@vger.kernel.org>
Subject: Re: what's the semaphore in requests for?
Date: Sun, 29 Jul 2001 00:34:08 +0200 (MET DST)	[thread overview]
Message-ID: <200107282234.f6SMY8421363@oboe.it.uc3m.es> (raw)
In-Reply-To: From (env: ptb) at "Jul 24, 2001 01:39:33 am"

"A month of sundays ago ptb wrote:"
> What's the semaphore field in requests for?  Are driver writers supposed
> to be using it?

It seems nobody knows.

> The reason I ask is that I've been chasing an smp bug in a block driver
> of mine for a week.  The bug only shows up in 2.4 kernels (not in same
> code under 2.2.18) and only with smp ("nosmp" squashes it).  It only

I've made more progress in seeking this bug.  The test is
just dd if=/dev/mine of=/dev/null bs=4k over 2GB of data.

2 processors + 1 userspace helper daemon on device = no bug 
2 processors + 2 userspace helper daemon on device = bug  (lockup)
1 processors + 1 userspace helper daemon on device = no bug 
1 processors + 2 userspace helper daemon on device = no bug 

Seeing this, I added a semaphore that forces the helper daemons to
exclude each other as they enter the kernel in their ioctl calls.
Still the lockup occurred with two processors and two daemons.

IMO that's impossible.  With the semaphore, the daemons should have
behaved like one daemon, since they don't maintain any state.  They just
run in two threads instead of one.  I was careful to lock the entire
daemon interaction cycle with the kernel (a get and an ack ioctl) into
one atomic unit with the semaphore, not just exclude simultaneous entry.

OK .. so let's treat this as an opportunity to learn something more
about the kernel.

I believe the above data indicates that the act of doing an ioctl
may prompt activity in the kernel request function, perhaps as the
scheduler triggers the helper daemon process on the way in to the
kernel. And perhaps that leads to the kernel request function for
the device running twice simultaneously? It runs when the device
unplugs, surely, and never any other time?

I've been through adding spinlocks to exclude the kernel request
function and the helper daemon ioctls on shared resources. Surely
if there were a problem there I'd see it with 2 cpus and 1 helper
daemon!

Peter


             reply	other threads:[~2001-07-28 22:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-28 22:34 Peter T. Breuer [this message]
2001-07-30  8:24 ` Jens Axboe
2001-07-30 14:14   ` Peter T. Breuer
  -- strict thread matches above, loose matches on Subject: below --
2001-08-03 23:37 Peter T. Breuer
2001-07-31 18:45 Peter T. Breuer
2001-07-23 23:39 Peter T. Breuer
2001-07-24  7:44 ` Jens Axboe

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=200107282234.f6SMY8421363@oboe.it.uc3m.es \
    --to=ptb@it.uc3m.es \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®