linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	Jeff Layton <jlayton@poochiereds.net>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] blktrace: Fix potentail deadlock between delete & sysfs ops
Date: Wed, 16 Aug 2017 14:46:42 -0400	[thread overview]
Message-ID: <4841e079-c518-cdff-2fbd-661a9ef36722@redhat.com> (raw)
In-Reply-To: <20170816141749.6c11d14c@gandalf.local.home>

On 08/16/2017 02:17 PM, Steven Rostedt wrote:
> On Wed, 16 Aug 2017 14:14:36 -0400
> Waiman Long <longman@redhat.com> wrote:
>
>>> You also just turned the mutex into a spinlock. What happens if we just
>>> preempted the owner of bdev->bd_mutex and are an RT task with higher
>>> priority? This will turn into a live lock.
>>>  
>>>> +		schedule();
>>>> +	}
>>>>    
>> That is OK because I used schedule() instead of cpu_relax() for
>> inserting delay.
> Please explain to me how that is OK? schedule is a nop if the current
> task is the highest priority task running, and it preempted the owner
> of the lock. Nothing will actually schedule.
>
> -- Steve

I haven't been thinking about RT tasks. You are right that it can be a
problem in this case. I think I will have to revert back to use
mutex_lock() if a RT task is running. Though in this case, the lock
inversion problem will still be there. However, it is highly unlikely
that a RT task will need to read write the block trace sysfs files.

Thanks for the input.

Cheers,
Longman

  reply	other threads:[~2017-08-16 18:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 17:02 [PATCH] blktrace: Fix potentail deadlock between delete & sysfs ops Waiman Long
2017-08-15 23:11 ` Steven Rostedt
2017-08-16 18:14   ` Waiman Long
2017-08-16 18:17     ` Steven Rostedt
2017-08-16 18:46       ` Waiman Long [this message]
2017-08-16 18:59         ` Steven Rostedt
2017-08-16 19:07           ` Waiman Long
2017-08-16 19:14             ` Steven Rostedt
2017-08-16 19:26               ` Waiman Long

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=4841e079-c518-cdff-2fbd-661a9ef36722@redhat.com \
    --to=longman@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bfields@fieldses.org \
    --cc=jlayton@poochiereds.net \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.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).