Received: by 10.192.165.156 with SMTP id m28csp747135imm; Wed, 11 Apr 2018 06:43:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx499l5YiZ6cId3ZlObND9WiAf0e6/URGtgTr8uh33wAC0MLncleyRvz1+eQoJWCNo8GOdJZy X-Received: by 2002:a17:902:b60f:: with SMTP id b15-v6mr5100005pls.12.1523454182537; Wed, 11 Apr 2018 06:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523454182; cv=none; d=google.com; s=arc-20160816; b=t/E4qKb2BoXm8Yw06USNlm3+/eEg4pCtS1Va60DoLfcSAM/wQ//uaQXZv8CAJieIaE alxJA2V1L/zuFB0WFlMdSMQ5P6PeaX2jLj2zWdIVYUb1QJUv9eDK4zBUGvpv2yR6zoVb pcvSpjW85s5CoWISJL9UJn5yifI/MvYe4Dmcb9LsxWWN68g00EG4psPVn2jFeMp0fryc DGIjowLAIC8rvL3rOVPwmfVGXCW5gmhL4IWWJl+Q/Y+z9ViJs6h92mg5om+N/Rt8gsSp 9U4gb0x3U7BH9YRJr8ZWZiUZGXjJI77MI4amzQHG8WFdkCkSPEgrFV+0xvnyFp/+e79W V+9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=jEQaf0Bl3WOmYPFuXZOftMrYWoRCvy9JdYcVtqLXD7g=; b=JTawNVPhDFM6vmNigVogSFrCyPMXhVKdm98DFpFq5RDi2gDfg7Ykwe2yj67ayXrBdl ZC1P5rB1ThHAUTwMhgk0csqN6NJsijfujtcJLejBMVauW5X5NWPGnL5TtXDJIvcxz0Je 1VkJbleGW422MvP+rfJgWE5grGDBpgIs6Aq13ViOP6c98pKeNTRbV/RJ9H7eumBWQIQs kmmsWT+lbC3tTnt94j5kY96gepPgB2GHSgIjORaiCLP3jBOlWdNhcsToSAJYfLnhftfT rIGT0x6ZoKw8LsIpbsPWmWy5eMc4pl8/YppqUF9Wjqbs8S/i32pEh0eNPxqSlz3od3qp OVdg== 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 s126si749699pgc.477.2018.04.11.06.42.23; Wed, 11 Apr 2018 06:43:02 -0700 (PDT) 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 S1753107AbeDKNji (ORCPT + 99 others); Wed, 11 Apr 2018 09:39:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:55620 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbeDKNjf (ORCPT ); Wed, 11 Apr 2018 09:39:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DB4B5AD8E; Wed, 11 Apr 2018 13:39:33 +0000 (UTC) Date: Wed, 11 Apr 2018 15:39:30 +0200 (CEST) From: Miroslav Benes To: Josh Poimboeuf cc: Petr Mladek , Jiri Kosina , Jason Baron , Joe Lawrence , Jessica Yu , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10 05/10] livepatch: Support separate list for replaced patches. In-Reply-To: <20180411123214.mfpkbrirze32phrb@treble> Message-ID: References: <20180319214324.riyp233trtfxbeto@treble> <20180320122538.t75rplwhmhtap5q2@pathway.suse.cz> <20180320201502.2skkk3ld4zk2dxwg@treble> <20180323094507.smsqc5ft3yajnwqt@pathway.suse.cz> <20180323224410.vuq5cabfprqhd6ej@treble> <20180326101107.bbloeh5l276on7uz@pathway.suse.cz> <20180406195049.dtfebzfdkbvv6yex@treble> <20180410083455.l26dgo5kx4cy7bc7@pathway.suse.cz> <20180410174206.l3uk6lchhzxvn75x@treble> <20180411123214.mfpkbrirze32phrb@treble> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Apr 2018, Josh Poimboeuf wrote: > On Wed, Apr 11, 2018 at 10:07:31AM +0200, Miroslav Benes wrote: > > > > I was confused by wording "in the middle". It suggested that there > > > > might had been enabled patches on the top and the bottom of the stack > > > > and some disabled patches in between at the same time (or vice versa). > > > > This was not true. > > > > > > That *was* what I meant. Consider the following sequence of events: > > > > > > - Register patch 1 > > > - Enable patch 1 > > > - Register patch 2 > > > - Enable patch 2 > > > - Disable patch 2 > > > - Register patch 3 > > > - Enable patch 3 > > > > > > Notice that patch 2 (in the middle) is disabled, whereas patch 1 (on the > > > bottom) and patch 3 (on the top) are enabled. > > > > This should not be possible at all. > > > > __klp_enable_patch: > > > > if (patch->list.prev != &klp_patches && > > !list_prev_entry(patch, list)->enabled) > > return -EBUSY; > > > > When patch 3 is enabled, list_prev_entry() returns patch 2 and its > > ->enabled is false. > > Hm, you're right. I'm not sure how I got that idea... > > I still agree with my original conclusion that enforcing stack order no > longer makes sense though. Frankly I cannot say. I have got no opinion on this, so if there is a patch to remove it, I won't oppose it (probably). I just think it is connected to the atomic replace patch set. > > > > Another possibility would be to get rid of the enable/disable states. > > > > I mean that the patch will be automatically enabled during > > > > registration and removed during unregistration. > > > > > > I don't see how disabling during unregistration would be possible, since > > > the unregister is called from the patch module exit function, which > > > can only be called *after* the patch is disabled. > > > > > > However, we could unregister immediately after disabling (i.e., in > > > enabled_store context). > > > > I think this is what Petr meant. So there would be nothing in the patch > > module exit function. Well, not exactly. We'd need to remove sysfs dir and > > maybe something more. > > Sounds good to me, though aren't the livepatch sysfs entries removed by > klp during unregister? Yes. I was thinking we may take something out of disable+unregister step and leave it in the exit function, but maybe there is nothing like that. > > > > The question is what is acceptable to others > > > > > > If there are any objections, this is their chance to speak up :-) > > > > > > > and if it needs to be done as part of this patch set. > > > > > > Maybe so, for at least a few reasons: > > > > > > - This patch set makes the 'stack' obsolete, so it makes sense to remove > > > the 'stack' with it. > > > > Not necessarily. I like Petr's rebase explanation here. > > I'm not sure what you mean. IIRC, his rebase explanation referred to > how we handle 'replace' patches, for which there is no stacking (as I > meant the term: enforcement of stack order for registration and > enablement). See above. I don't completely agree with the obsoleteness part. I don't see it that way. But it is moot. I'm not against the enforcement removal. Regards, Miroslav