Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8423329imu; Tue, 4 Dec 2018 08:10:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/WbY/Ar4Gomn51IGLX5T7mm3rNjr1wTEOyrqYNQxg84OUv8brVoSy0TOWe3u3D0cEjPXOtT X-Received: by 2002:a63:e40c:: with SMTP id a12mr17356186pgi.28.1543939803199; Tue, 04 Dec 2018 08:10:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543939803; cv=none; d=google.com; s=arc-20160816; b=Ci8Yx1IvTUcfzYwkbbwkPVnfPzR3beYjtLPZ6vwy3YqVzA3dIEDEEKRZHZSB8Z7WOa FW48f7Pwvtj8fXc4wnlDJPUkQIcVQpRipvP6y4O+l88ZJqW04BvF9c9mDzYyz/NbxdzY 90ROy5afhyvH4l6F5noLSWIc+TN9+J9zcYUVVS+NjzMYvaHtdsBz97+28xuP/5eL/VbJ nIA/pDmBmKakNgG4g6LpZEpfO9pBDIln6oPPztcnlfyLiDfKKSjCG+6APyGFT8oNEXWG hdC0581JaZU2nuGvRSWZ9Nzx4orDresLIhujhWlLybq/UtVkrVkcSPTuHsa5LJwYqhsa J9VA== 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; bh=yULyEXqKNUeoxwjwL6t6vHgzaAXVq5diQBWRDwvyu7k=; b=YRS7EWkSO5dZj8ugTGWvWCO7g1PhDEaOl1idzHjVQ9dkVjfweQTBoFkUBuXhqk1JG/ c/M7V8abQvubsBneL8B2Li4N7QJy2BwKyBLzTZrcQ3242jrMWzW9MvJoPZweHr5DfIuc DedxPAwF8D/n075swAQikxByv01Lyp9pvlxgIoZhGKzHYGc4Q4A5ufZVizimQ41XM8Og Idmj8Cpl2NXJ6xkpX4DmSWgktl91YMWfAgYfCzGsePV9DFi9xOJeIFqMS5K0eYj2sUlN RmjSxBZCB+hqj2fzZ3zk9S5Jxvptjzy17+8L6u5SuaEYsEUmcX5rFrcb4yBonOZ7kPNg Es/A== 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 y18si17769797plp.269.2018.12.04.08.09.36; Tue, 04 Dec 2018 08:10:03 -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 S1726977AbeLDQIH (ORCPT + 99 others); Tue, 4 Dec 2018 11:08:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:41434 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726954AbeLDQIH (ORCPT ); Tue, 4 Dec 2018 11:08:07 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C69E2ADFE; Tue, 4 Dec 2018 16:08:04 +0000 (UTC) Date: Tue, 4 Dec 2018 17:08:03 +0100 (CET) From: Miroslav Benes To: Petr Mladek cc: Jiri Kosina , Josh Poimboeuf , Jason Baron , Joe Lawrence , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v14 08/11] livepatch: Remove Nop structures when unused In-Reply-To: <20181129094431.7801-9-pmladek@suse.com> Message-ID: References: <20181129094431.7801-1-pmladek@suse.com> <20181129094431.7801-9-pmladek@suse.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 Thu, 29 Nov 2018, Petr Mladek wrote: > Replaced patches are removed from the stack when the transition is > finished. It means that Nop structures will never be needed again > and can be removed. Why should we care? > > + Nop structures make false feeling that the function is patched > even though the ftrace handler has no effect. > > + Ftrace handlers are not completely for free. They cause slowdown that > might be visible in some workloads. The ftrace-related slowdown might > actually be the reason why the function is not longer patched in > the new cumulative patch. One would expect that cumulative patch > would allow to solve these problems as well. > > + Cumulative patches are supposed to replace any earlier version of > the patch. The amount of NOPs depends on which version was replaced. > This multiplies the amount of scenarios that might happen. > > One might say that NOPs are innocent. But there are even optimized > NOP instructions for different processor, for example, see > arch/x86/kernel/alternative.c. And klp_ftrace_handler() is much > more complicated. > > + It sounds natural to clean up a mess that is not longer needed. > It could only be worse if we do not do it. > > This patch allows to unpatch and free the dynamic structures independently > when the transition finishes. > > The free part is a bit tricky because kobject free callbacks are called > asynchronously. We could not wait for them easily. Fortunately, we do > not have to. Any further access can be avoided by removing them from > the dynamic lists. > > Signed-off-by: Petr Mladek Acked-by: Miroslav Benes M