[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4dcf407-462a-e6bd-7ab5-6d27fbcccb99@redhat.com>
Date: Thu, 6 Dec 2018 09:23:47 -0500
From: Joe Lawrence <joe.lawrence@...hat.com>
To: Petr Mladek <pmladek@...e.com>
Cc: Jiri Kosina <jikos@...nel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Miroslav Benes <mbenes@...e.cz>,
Jason Baron <jbaron@...mai.com>,
Evgenii Shatokhin <eshatokhin@...tuozzo.com>,
live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
Jessica Yu <jeyu@...nel.org>
Subject: Re: [PATCH v14 03/11] livepatch: Consolidate klp_free functions
On 12/06/2018 03:15 AM, Petr Mladek wrote:
> On Wed 2018-12-05 14:02:20, Joe Lawrence wrote:
>> On Thu, Nov 29, 2018 at 10:44:23AM +0100, Petr Mladek wrote:
>>> The code for freeing livepatch structures is a bit scattered and tricky:
>>>
>>> [ ... snip ... ]
>>>
>>> +static int klp_init_patch(struct klp_patch *patch)
>>> +{
>>> + struct klp_object *obj;
>>> + int ret;
>>> +
>>> + mutex_lock(&klp_mutex);
>>> +
>>> + ret = klp_init_patch_before_free(patch);
>>> if (ret) {
>>> mutex_unlock(&klp_mutex);
>>> return ret;
>>> }
>>>
>>
>> I believe klp_init_patch_before_free() accumulates more responsibilities
>> later in the patchset, but I'll ask here: does it really need the
>> klp_mutex since it looks to be operating only on the klp_patch, its
>> objects and functions?
>
> I do not have a strong opinion about it.
>
> On one hand, we are manipulating all the structures and should prevent
> any parallel use. On the other hand, the rest of the code will not
> touch the patch until it is added into klp_patches list or until
> the sysfs interface is created.
>
> If you think that it might cause false expectations and confusions
> then I could move it out of the lock.
I didn't find it confusing, nor is it performance limiting. I figured I
would point it out in case there was some reason for the mutex that I
had missed.
> Well, in the final version we need to call klp_check_patch_conflict()
> under the mutex.
That's right.
-- Joe
Powered by blists - more mailing lists