linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@arm.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Cc: Saravana Kannan <saravanak@google.com>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	Felipe Balbi <balbi@kernel.org>, Mark Brown <broonie@kernel.org>,
	Ferry Toth <fntoth@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Peter Ujfalusi <peter.ujfalusi@ti.com>,
	Android Kernel Team <kernel-team@android.com>, nd <nd@arm.com>
Subject: Re: [PATCH v3] driver core: Break infinite loop when deferred probe can't be satisfied
Date: Thu, 26 Mar 2020 13:48:33 +0000	[thread overview]
Message-ID: <73f75a7d-dd5d-30d3-0acc-549d87a5ab1c@arm.com> (raw)
In-Reply-To: <20200326115730.GQ1922688@smile.fi.intel.com>



On 26/03/2020 11:57, Andy Shevchenko wrote:
> On Thu, Mar 26, 2020 at 09:39:40AM +0100, Rafael J. Wysocki wrote:
>> On Wed, Mar 25, 2020 at 11:09 PM Saravana Kannan <saravanak@google.com> wrote:
>>> On Wed, Mar 25, 2020 at 5:51 AM Andy Shevchenko
>>> <andriy.shevchenko@linux.intel.com> wrote:
> 
>>>> Yes, it's (unlikely) possible (*), but it will give one more iteration per such
>>>> case. It's definitely better than infinite loop. Do you agree?
>>>
>>> Sorry I wasn't being clear (I was in a rush). I'm saying this patch
>>> can reintroduce the bug where the deferred probe isn't triggered when
>>> it should be.
>>>
>>> Let's take a simple execution flow.
>>>
>>> probe_okay is at 10.
>>>
>>> Thread-A
>>>    really_probe(Device-A)
>>>      local_probe_okay_count = 10
>>>      Device-A probe function is running...
>>>
>>> Thread-B
>>>    really_probe(Device-B)
>>>      Device-B probes successfully.
>>>      probe_okay incremented to 11
>>>
>>> Thread-C
>>>    Device-C (which had bound earlier) is unbound (say module is
>>> unloaded or a million other reasons).
>>>    probe_okay is decremented to 10.
>>>
>>> Thread-A continues
>>>    Device-A probe function returns -EPROBE_DEFER
>>>    driver_deferred_probe_add_trigger() doesn't do anything because
>>>      local_probe_okay_count == probe_okay
>>>    But Device-A might have deferred probe waiting on Device-B.
>>>    Device-A never probes.
>>>
>>>> *) It means during probe you have _intensive_ removing, of course you may keep
>>>> kernel busy with iterations, but it has no practical sense. DoS attacks more
>>>> effective in different ways.
>>>
>>> I wasn't worried about DoS attacks. More of a functional correctness
>>> issue what I explained above.
>>
>> The code is functionally incorrect as is already AFAICS.
>>
>>> Anyway, if your issue and similar issues can be handles in driver core
>>> in a clean way without breaking other cases, I don't have any problem
>>> with that. Just that, I think the current solution breaks other cases.
>>
>> OK, so the situation right now is that commit 58b116bce136 has
>> introduced a regression and so it needs to be fixed or reverted.  The
>> cases that were previously broken and were unbroken by that commit
>> don't matter here, so you cannot argue that they would be "broken".
>>
>> It looks to me like the original issue fixed by the commit in question
>> needs to be addressed differently, so I would vote for reverting it
>> and starting over.
> 
> I think Saravana's example is not fully correct as I had responded to his mail.
> I would like to hear Grant, but seems he is busy with something and didn't reply.

Sadly I don't look much like a kernel developer these days. The last 
code change I committed to the kernel was over 4 years ago.

g.

  reply	other threads:[~2020-03-26 13:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 17:57 [PATCH v3] driver core: Break infinite loop when deferred probe can't be satisfied Andy Shevchenko
2020-03-25  3:29 ` Saravana Kannan
2020-03-25 12:51   ` Andy Shevchenko
2020-03-25 22:08     ` Saravana Kannan
2020-03-26  8:39       ` Rafael J. Wysocki
2020-03-26  9:45         ` Peter Ujfalusi
2020-03-26 12:03           ` Andy Shevchenko
2020-03-26 13:45             ` Grant Likely
2020-03-26 14:23               ` Andy Shevchenko
2020-03-26 11:57         ` Andy Shevchenko
2020-03-26 13:48           ` Grant Likely [this message]
2020-03-26 18:45         ` Saravana Kannan
2020-03-26 11:54       ` Andy Shevchenko
2020-03-26 14:46         ` Grant Likely
2020-03-26 19:55         ` Saravana Kannan
2020-03-26 15:01     ` Grant Likely
2020-03-26 15:20       ` Grant Likely
2020-03-26 16:31       ` Andy Shevchenko
2020-03-26 16:39         ` Greg KH
2020-03-26 18:06           ` Grant Likely
2020-03-27  8:03             ` Greg KH
2020-03-27 12:37               ` Grant Likely
2020-03-27 12:51                 ` Greg KH
2020-06-08  9:17         ` Marco Felsch
2020-06-08 11:11           ` Andrzej Hajda
2020-06-09  6:45             ` Marco Felsch
2020-06-09  7:30               ` Saravana Kannan
2020-06-09  9:27               ` Andrzej Hajda
2020-06-09 12:10                 ` Marco Felsch
2020-06-09 13:02                   ` Andrzej Hajda
2020-06-09 13:16                   ` Mark Brown
2020-06-08 11:13           ` Andy Shevchenko
2020-06-08 11:59             ` Marco Felsch
2020-06-08 12:11               ` Andy Shevchenko

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=73f75a7d-dd5d-30d3-0acc-549d87a5ab1c@arm.com \
    --to=grant.likely@arm.com \
    --cc=a.hajda@samsung.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=balbi@kernel.org \
    --cc=broonie@kernel.org \
    --cc=fntoth@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nd@arm.com \
    --cc=peter.ujfalusi@ti.com \
    --cc=rafael@kernel.org \
    --cc=saravanak@google.com \
    /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).