Received: by 10.223.185.116 with SMTP id b49csp3951015wrg; Tue, 6 Mar 2018 07:33:21 -0800 (PST) X-Google-Smtp-Source: AG47ELvWm7fMr45e7DNWNF/2HauWkxe08pbwAgGNDJbO4rdLrzqbBi5gySRNkW7feFG15CqzOSfN X-Received: by 10.101.86.73 with SMTP id m9mr15653738pgs.70.1520350401722; Tue, 06 Mar 2018 07:33:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520350401; cv=none; d=google.com; s=arc-20160816; b=lnl8E1eRvPiRNjJaBo7QIfQ1bxVIhIr4cCHi2I3rOyBJjpEwf9sivzAmmO2uPtvnEP uosEW06KNR/26crRoLW8ypPpOy1Y8Qu1URA4V533hugnRvSPYhBmMlZxhpbXGwmj5X6f i2W2Ir/X3qr0S2tmVWt7SvphC6CBJ9q0Oio4DXJLyOBzKc8pNpUemL1HVIvVHcNjOGcQ yze7QnBIxcwhgQFqiOZkf4jwCS9JfX7fcHIDUUx1Lq3vITULBMX04VrhmfSobsHV2G8n RRGbcah9ovZl6W+i0Pax3nZutL+BQN73KQnAjMzVbWc93ocGqIHqaDaUc0t0nn7oCkQT UYJA== 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:message-id:subject:cc:to:from:date :arc-authentication-results; bh=l/jT3MAiAbXoYK4J2mIW/PIw6dnFg+VmuLfkre0lD2U=; b=ZtcGlk049SRahqo+GS8X/Ffs0IH8Sz2r5LsVYfwkaiOSYaHnux4As7dDnQUeXw5FOZ NfBfzTZWhEWu64sKrVMDowZad8JQkQtaWUO/XodeZ9cPGyCgVh7e4lNkRAjCk0U7BwPv OfLf/n+yPcTfK9FlJGYsl49Pb0O+llcCoycytAZhekpGvvRQcanzK9GeVlUpVWLrFjzu j66L0FK/oH3EgqcHs2ljw4HnC7tR4QyR3YVtDm3U86DLUv7Y/4mx4Xq7Z4Np6CKSRTdf O15wKU6v8uKZ+wKBqrypU9OHHclwcceNzvPUtT5yo6GCjBhpdUT0rqkPnEacZsJiR+wj ujLQ== 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 j8si11942626pfn.234.2018.03.06.07.33.07; Tue, 06 Mar 2018 07:33:21 -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 S1753654AbeCFPcM (ORCPT + 99 others); Tue, 6 Mar 2018 10:32:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:34579 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbeCFPcK (ORCPT ); Tue, 6 Mar 2018 10:32:10 -0500 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 73A8DAF05; Tue, 6 Mar 2018 15:32:09 +0000 (UTC) Date: Tue, 6 Mar 2018 16:32:08 +0100 From: Petr Mladek To: Miroslav Benes Cc: Evgenii Shatokhin , Jason Baron , Jiri Kosina , Josh Poimboeuf , Joe Lawrence , Jessica Yu , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 0/8] livepatch: Atomic replace feature Message-ID: <20180306153208.35cmwo7wcdfwa2hd@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon 2018-03-05 13:54:38, Miroslav Benes wrote: > On Mon, 5 Mar 2018, Evgenii Shatokhin wrote: > > > Hi, > > Hi, > > > > The atomic replace allows to create cumulative patches. They > > > are useful when you maintain many livepatches and want to remove > > > one that is lower on the stack. In addition it is very useful when > > > more patches touch the same function and there are dependencies > > > between them. > > > > I have experimented with this updated patchset a bit. > > It looks like replace operation fails if there is a loaded but disabled patch. > > > > Suppose there are 2 binary patches changing the same kernel functions. Load > > patch1, then disable it (echo 0 > /sys/kernel/livepatch/patch1/enabled), then > > try load patch2 with atomic replace. I get "Device or resource busy" error at > > this point. > > > > It seems, __klp_enable_patch() returns -EBUSY for some reason. I haven't dug > > deeper into that code yet. > > Yes, it is "enforce stacking" check in __klp_enable_patch(): > > /* enforce stacking: only the first disabled patch can be enabled */ > if (patch->list.prev != &klp_patches && > !list_prev_entry(patch, list)->enabled) > return -EBUSY; > > So not connected to this patch set. We've had the behaviour for quite some > time. We actually wanted to enabled this for the patches with the replace flag. It is even described in Documentation/livepatch/cumulative-patches.txt. Of course, you could always unregister all the disabled patches that block the new one. But it might be inconvenient. I do not see any big reason why this should be disabled: + klp_add_nops() takes into account even disabled patches. In the worst case, we might enable some NOPs that are not really needed. + klp_throw_away_replaced_patches() removes all patches down the stack. I am going to enable this in a separate patch in v10. Best Regards, Petr