Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10417395imu; Thu, 6 Dec 2018 00:15:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/WcAktc1a1QpzZB2M3yfp7vF+yjKW3n2otcHMezfSpYgFbxst2JGdjyx58HnVxXbfx/SuF7 X-Received: by 2002:a63:3e05:: with SMTP id l5mr21591919pga.96.1544084155795; Thu, 06 Dec 2018 00:15:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544084155; cv=none; d=google.com; s=arc-20160816; b=gBTulnEz4jBw/m+3XKM7Lcn5H2cXjeFpOPhlTdvHeBYjIUygYZoguIbSBGxr+qLw35 EcYIQ1U6dLs+5bFFKpHLXaPhr0XA/GiienNcR6c2hltTdf97CxN8tHyERbRPY8ulTkwk cfSOTXhkdJDKkrE09wLZnAbVHw/oM5Z5fWqedrWEHNKaq0EVRSxIgVV2q8cTkZApBrQ3 /8No+9a8Iii8mHwfx329IS4MnaJ6A9DB78tjc6xRUmb5BpmA6lzIvv479lZbzOndkBmx 9DP+TDpr1Vcpeb6pEQAKo4r9vWcP6BSbMNqLZGNlxKrHM51B5JqAtDAA+kxtEDhoxIIv f9vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=XJkjSA1Q/wBQXKrg4x+rv8Dt6M5RPKtB/5nQtNTboXw=; b=Ld8w5XC/hE0rJJJi/Io9k0zIWzFXe8d+khYWzeR1MPKe2s/E0dLrcUFWT8iHUdwz7R T9pxO1DCIE2Fg8y28mp8bMqLbhn0KWoHnhJu735w/5k5LOYMv9zgdT5ts49x/0y4jxDp mmQeqa6GsmthxPgFHCysXHCDJYp6wYQqEiGL7Z5M6UoPE5kyWbE/BJJfH3XrUgQVaRrJ Hhxzx9u2cLUqcwxxFhZ376zcnlwwLpKwUsL3qJ0h0DF79Ko3KMVO7LIKdsifyt1im+8W GygwGK9RCV0JqQG0/J+HgRJEV0WGvvlNyA7ZTV+oTUeGDqgH6qEcIViyp/ptqQ+nO1a0 9q4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si20941852plt.213.2018.12.06.00.15.39; Thu, 06 Dec 2018 00:15:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729062AbeLFIPE (ORCPT + 99 others); Thu, 6 Dec 2018 03:15:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:41216 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727575AbeLFIPD (ORCPT ); Thu, 6 Dec 2018 03:15:03 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D1AEBABE4; Thu, 6 Dec 2018 08:15:01 +0000 (UTC) Date: Thu, 6 Dec 2018 09:15:01 +0100 From: Petr Mladek To: Joe Lawrence Cc: Jiri Kosina , Josh Poimboeuf , Miroslav Benes , Jason Baron , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jessica Yu Subject: Re: [PATCH v14 03/11] livepatch: Consolidate klp_free functions Message-ID: <20181206081501.jkki7hg4u43fqwth@pathway.suse.cz> References: <20181129094431.7801-1-pmladek@suse.com> <20181129094431.7801-4-pmladek@suse.com> <20181205190220.vterzx33opvvijne@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181205190220.vterzx33opvvijne@redhat.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Well, in the final version we need to call klp_check_patch_conflict() under the mutex. Best Regards, Petr