Received: by 10.223.185.116 with SMTP id b49csp2629882wrg; Mon, 5 Mar 2018 06:17:16 -0800 (PST) X-Google-Smtp-Source: AG47ELtrf3FE2/pvvc9+JPky6f93xWobmGi3RFiwZ2ASiwUBaxbTCq7uyRNCw0vRTxMdZtUcZ802 X-Received: by 10.98.74.67 with SMTP id x64mr15568645pfa.135.1520259436409; Mon, 05 Mar 2018 06:17:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520259436; cv=none; d=google.com; s=arc-20160816; b=aw6r32JFUzmNiQfZ+//bd2bQfLOFXLxOM1r4pVS7XjEknGb1Bp053vXekFfkmym74G uTVX71+QkQK7/BsjMNIJ6vW/75YslOY0XZ6onzTCczCyr79C3nzrBFqbHnRCCuMtvF6U otb8S+UUiPHcv+O38ZMnuExXNMxDnJ35SZipxeduC0bsgdXfXXrlFlflM7yMrjU9uJKO roKN6VG0D7oM7QPoeXO3LmESjWFjkjLbb6VXs32ACdk/3MLm/RxbuuaPHBxuRvRG+p9e 9KISV/+sYHh00+rWwOtgdUNqkF50C1ol66K8/ZBM+52b7eRPPpCfkP920j6zfKRkekps +6Og== 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=LD4FAxwwnxqM6Ecusy7k/ptz6DYsHRuZOsvKTm7Tyrk=; b=eGUJ2VzOnPmkC1RFY22EN2TtI2qVhm38ak3s3Si4ObaPLzvo5UFnBCGT4L4oMuHB54 DcJ/m+pB2lo++GDJw2iirpEdtwYsP2FXMMXwMU7rFV/uUUKwviqPU9/rxtCS07IzL6FW Zh3HZIIN8AsbQbAEY2I226Ku9VI/8j6/WJwa+mj10/FXxiSr7b0v/H6j3vqlR1aOmGX+ 3v40LBPu/wd65rxBYCaK0BBaDLStTgW6/WgwsGj8rV1DKuorBQNr8+BmqWE331NyocY2 GBwFKphSP5lteM6OQzzFISZVMKZU3D9RFayAc45SiFtWQvSuzIceNwhuhbO6BUziFtPr MtHg== 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 u17si8450937pgv.116.2018.03.05.06.17.02; Mon, 05 Mar 2018 06:17:16 -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 S964807AbeCEMyp (ORCPT + 99 others); Mon, 5 Mar 2018 07:54:45 -0500 Received: from mx2.suse.de ([195.135.220.15]:38536 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934693AbeCEMym (ORCPT ); Mon, 5 Mar 2018 07:54:42 -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 C3A44ABB2; Mon, 5 Mar 2018 12:54:40 +0000 (UTC) Date: Mon, 5 Mar 2018 13:54:38 +0100 (CET) From: Miroslav Benes To: Evgenii Shatokhin cc: Petr Mladek , 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 In-Reply-To: <5c956014-b717-aed8-de1b-58967ef835c6@virtuozzo.com> Message-ID: References: <20180221132914.4809-1-pmladek@suse.com> <5c956014-b717-aed8-de1b-58967ef835c6@virtuozzo.com> 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 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. Miroslav > A workaround is simple: just unload all disabled patches before trying to load > patch2 with replace. Still, the behavior is quite strange.