LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Kohli, Gaurav" <gkohli@codeaurora.org>
To: Tejun Heo <tj@kernel.org>
Cc: gregkh@linuxfoundation.org, nborisov@suse.com,
	akpm@linux-foundation.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] percpu_counter: Remove debug_object_free call twice
Date: Tue, 17 Apr 2018 11:59:44 +0530	[thread overview]
Message-ID: <a9ef4575-bfb9-c854-ea71-0a5e1af97f5d@codeaurora.org> (raw)
In-Reply-To: <20180416214810.GF1911913@devbig577.frc2.facebook.com>

On 4/17/2018 3:18 AM, Tejun Heo wrote:

> On Fri, Apr 13, 2018 at 03:05:03PM +0530, Gaurav Kohli wrote:
>> During percpu_counter destroy, debug_object_free is calling
>> twice which may create race. So removing once instance of call
>> from debug_percpu_counter_deactivate.
> I don't quite follow.  Can you please elaborate how it can be called
> twice?

Hi Tejun,

In percpu_counter_fixup_free function, first call is percpu_counter_destroy -> debug_percpu_counter_deactivate (this will set inactive and free the debug object as well for percpu counter) -> free_percpu (finally freeing the counters).

Below is the code snippet:

         case DEBUG_STATE_ACTIVE:

                 percpu_counter_destroy(fbc); -> first call

                 debug_object_free(fbc, &percpu_counter_debug_descr); -> this will again call the same debug object free, if somehow counters will reinitialize between these two calls.

                 

We are seeing one race condition issue where one object of db list is corrupted and just before object of that corrupted node is percpu_counter, Still i am not sure the reason of race as it is very

difficult to reproduce. But i have found this during code review. Please correct me, if i misunderstood this.

>
> Thanks.
>
>
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

  reply	other threads:[~2018-04-17  6:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13  9:35 [PATCH] percpu_counter: Remove debug_object_free call twice Gaurav Kohli
2018-04-16 21:48 ` Tejun Heo
2018-04-17  6:29   ` Kohli, Gaurav [this message]
2018-08-27  6:56     ` Kohli, Gaurav

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=a9ef4575-bfb9-c854-ea71-0a5e1af97f5d@codeaurora.org \
    --to=gkohli@codeaurora.org \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).