public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@sandisk.com>
To: "hare@suse.de" <hare@suse.de>, "axboe@kernel.dk" <axboe@kernel.dk>
Cc: "hch@lst.de" <hch@lst.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"jth@kernel.org" <jth@kernel.org>,
	"hare@suse.com" <hare@suse.com>
Subject: Re: [PATCH] genhd: Do not hold event lock when scheduling workqueue elements
Date: Tue, 31 Jan 2017 00:31:01 +0000	[thread overview]
Message-ID: <1485822639.2669.16.camel@sandisk.com> (raw)
In-Reply-To: <1484732896-22941-1-git-send-email-hare@suse.de>

On Wed, 2017-01-18 at 10:48 +0100, Hannes Reinecke wrote:
> @@ -1488,26 +1487,13 @@ static unsigned long disk_events_poll_jiffies(struct gendisk *disk)
>  void disk_block_events(struct gendisk *disk)
>  {
>         struct disk_events *ev = disk->ev;
> -       unsigned long flags;
> -       bool cancel;
>  
>         if (!ev)
>                 return;
>  
> -       /*
> -        * Outer mutex ensures that the first blocker completes canceling
> -        * the event work before further blockers are allowed to finish.
> -        */
> -       mutex_lock(&ev->block_mutex);
> -
> -       spin_lock_irqsave(&ev->lock, flags);
> -       cancel = !ev->block++;
> -       spin_unlock_irqrestore(&ev->lock, flags);
> -
> -       if (cancel)
> +       if (atomic_inc_return(&ev->block) == 1)
>                 cancel_delayed_work_sync(&disk->ev->dwork);
>  
> -       mutex_unlock(&ev->block_mutex);
>  }

Hello Hannes,

I have already encountered a few times a deadlock that was caused by the
event checking code so I agree with you that it would be a big step forward
if such deadlocks wouldn't occur anymore. However, this patch realizes a
change that has not been described in the patch description, namely that
disk_block_events() calls are no longer serialized. Are you sure it is safe
to drop the serialization of disk_block_events() calls?

Thanks,

Bart.

  reply	other threads:[~2017-01-31  0:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18  9:48 [PATCH] genhd: Do not hold event lock when scheduling workqueue elements Hannes Reinecke
2017-01-31  0:31 ` Bart Van Assche [this message]
2017-01-31 16:15   ` Hannes Reinecke
2017-02-03 12:22     ` Dexuan Cui
2017-02-07  2:23       ` Dexuan Cui
2017-02-07  2:56         ` Bart Van Assche
2017-02-07  3:48           ` Dexuan Cui
2017-02-07  6:29             ` Dexuan Cui
2017-02-07 16:09               ` Jens Axboe
2017-02-08 10:48                 ` Dexuan Cui
2017-02-08 17:43                   ` Boot regression (was "Re: [PATCH] genhd: Do not hold event lock when scheduling workqueue elements") Jens Axboe
2017-02-08 18:03                     ` hch
2017-02-09  7:35                       ` Dexuan Cui
2017-02-09 13:08                         ` hch
2017-02-10 14:49                           ` Dexuan Cui
2017-02-14 13:47                             ` hch
2017-02-14 14:17                               ` Dexuan Cui
2017-02-14 14:28                                 ` hch
2017-02-14 14:46                                   ` Dexuan Cui
2017-02-14 14:51                                     ` hch
2017-02-14 15:54                                       ` Dexuan Cui
2017-02-14 16:34                                         ` hch
2017-02-15 13:51                                           ` Dexuan Cui

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=1485822639.2669.16.camel@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jth@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --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