Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715434

Re: [PATCH v4] blktrace: Fix potentail deadlock between delete & sysfs ops

From Bart Van Assche <Bart.VanAssche@wdc.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4] blktrace: Fix potentail deadlock between delete & sysfs ops
Date 2017-08-18 22:20 +0200
Message-ID <ufVUl-8uR-7@gated-at.bofh.it> (permalink)
References <ufVKG-8rE-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 2017-08-18 at 16:01 -0400, Waiman Long wrote:
> [ ... ]
> Instead of using bd_mutex, a new global blktrace mutex is now used
> to protect against concurrent access, creation and destruction of the
> blk_trace structure that is used only in the blktrace.c file. As
> blktrace files will not be frequently accessed, using a global mutex
> should not cause any performance problem.
> [ ... ]
> +/*
> + * The bd_mutex was used previously for protecting blk_trace structure.
> + * That could lead to deadlock with concurrent block device deletion and
> + * sysfs access. So a global blktrace_mutex is now used instead for
> + * protecting the blk_trace structure.
> + *
> + * The references to the opened sysfs or device files should prevent the
> + * underlying block device from being removed.
> + */
> +static DEFINE_MUTEX(blktrace_mutex);

Hello Waiman,

Thanks for having addressed my previous comment. Regarding this patch: sorry
but I don't think it's a good idea to use a global mutex for serializing
accesses to tracing data of a single block device. Global mutexes create
unwanted lock dependencies between different block devices. Additionally, on
multiprocessor systems global mutexes can cause cache line ping-pong between
processors and hence can cause a severe slowdown. Please make blktrace_mutex
per block device instead of global.

Thanks,

Bart.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4] blktrace: Fix potentail deadlock between delete & sysfs ops Waiman Long <longman@redhat.com> - 2017-08-18 22:10 +0200
  Re: [PATCH v4] blktrace: Fix potentail deadlock between delete &  sysfs ops Bart Van Assche <Bart.VanAssche@wdc.com> - 2017-08-18 22:20 +0200
    Re: [PATCH v4] blktrace: Fix potentail deadlock between delete &  sysfs ops Waiman Long <longman@redhat.com> - 2017-08-18 22:40 +0200

csiph-web