All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Vasily Averin <vvs@virtuozzo.com>,
	cgel.zte@gmail.com, akpm@linux-foundation.org
Cc: shakeelb@google.com, rdunlap@infradead.org, dbueso@suse.de,
	unixbhaskar@gmail.com, chi.minghao@zte.com.cn, arnd@arndb.de,
	linux-kernel@vger.kernel.org, Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] ipc/sem: do not sleep with a spin lock held
Date: Wed, 22 Dec 2021 18:06:25 +0100	[thread overview]
Message-ID: <4d786a02-1560-25ed-4603-8419672ec044@colorfullife.com> (raw)
In-Reply-To: <02171384-9d1e-19fa-5fa1-5f84b720a03e@virtuozzo.com>

Hi Vasily,

On 12/22/21 16:50, Vasily Averin wrote:
> On 22.12.2021 18:31, Vasily Averin wrote:
>> On 22.12.2021 14:45, Manfred Spraul wrote:
>>> Hi Minghao,
>>>
>>> On 12/22/21 09:10, cgel.zte@gmail.com wrote:
>>>> From: Minghao Chi <chi.minghao@zte.com.cn>
>>>>
>>>> We can't call kvfree() with a spin lock held, so defer it.
>> I'm sorry, but I do not understand why exactly we cannot use kvfree?
>> Could you explain it in more details?
> Got it,
> there is cond_resched() called in __vfree() -> __vunmap()
>
> However I'm still not sure that in_interrupt() is used correctly here.

I see three different topics:

- is the current code violating the API? I think yes, thus there is a 
bug that needs to be fixed.

- Where is __vunmap() sleeping? Would it be possible to make __vunmap() 
safe to be called when owning a spinlock?

- should kvfree() use vfree() [i.e. unsafe when owning a spinlock] or 
vfree_atomic [i.e. a bit slower, but safe]


As we did quite many s/kfree/kvfree/ changes, perhaps just switching to 
vfree_atomic() is the best solution.

@Andrew: What would you prefer?

In addition, if we do not use vfree_atomic(): Then I would propose to 
copy the might_sleep_if() from vfree() into kvfree()

--

     Manfred


  reply	other threads:[~2021-12-22 17:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22  8:10 [PATCH] ipc/sem: do not sleep with a spin lock held cgel.zte
2021-12-22 11:45 ` Manfred Spraul
2021-12-22 15:31   ` Vasily Averin
2021-12-22 15:50     ` Vasily Averin
2021-12-22 17:06       ` Manfred Spraul [this message]
2021-12-22 17:38         ` Vasily Averin
2021-12-22 19:08           ` Vasily Averin
2021-12-23  2:37   ` [PATCH v2] " cgel.zte
2021-12-23  2:56   ` cgel.zte
2021-12-23  3:12   ` cgel.zte
2022-01-03  9:27     ` Jiri Slaby
2022-01-03 17:17       ` Manfred Spraul
2022-01-04 18:20         ` Shakeel Butt
2022-01-04 18:20     ` Shakeel Butt
2022-01-04 20:18       ` Manfred Spraul

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=4d786a02-1560-25ed-4603-8419672ec044@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=cgel.zte@gmail.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=dbueso@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=shakeelb@google.com \
    --cc=unixbhaskar@gmail.com \
    --cc=vvs@virtuozzo.com \
    --cc=zealci@zte.com.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.