[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a14c4f64ff3e029a76c85d064146e6c303c96bb.camel@sipsolutions.net>
Date: Fri, 22 Apr 2022 15:41:51 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Mukesh Ojha <quic_mojha@...cinc.com>, linux-kernel@...r.kernel.org
Cc: tglx@...utronix.de, sboyd@...nel.org, rafael@...nel.org
Subject: Re: [PATCH] devcoredump : Serialize devcd_del work
On Tue, 2022-04-19 at 15:57 +0530, Mukesh Ojha wrote:
> In following scenario(diagram), when one thread X running dev_coredumpm() adds devcd
> device to the framework which sends uevent notification to userspace
> and another thread Y reads this uevent and call to devcd_data_write()
> which eventually try to delete the queued timer that is not initialized/queued yet.
>
> So, debug object reports some warning and in the meantime, timer is initialized
> and queued from X path. and from Y path, it gets reinitialized again and
> timer->entry.pprev=NULL and try_to_grab_pending() stucks.
>
> To fix this, introduce mutex to serialize the behaviour.
>
> cpu0(X) cpu1(Y)
>
> dev_coredump() uevent sent to userspace
> device_add() =========================> userspace process Y reads the uevents
> writes to devcd fd which
> results into writes to
>
> devcd_data_write()
> mod_delayed_work()
> try_to_grab_pending()
> del_timer()
> debug_assert_init()
> INIT_DELAYED_WORK
> schedule_delayed_work
>
Wouldn't it be easier to simply schedule this before adding it to sysfs
and sending the uevent?
johannes
Powered by blists - more mailing lists