Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp331252pxv; Thu, 8 Jul 2021 03:37:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8n6yuEEX0zncfJF59dJZYLp8eimKdakVphr1fBCjXqxgE7UONWup4sAc8xi8X9X6HiLCn X-Received: by 2002:a05:6402:33c:: with SMTP id q28mr9795241edw.269.1625740677358; Thu, 08 Jul 2021 03:37:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625740677; cv=none; d=google.com; s=arc-20160816; b=X0j4/Ke0bY6yYUHs7FKNlS3y07MJfTAFO58PD4KmgDBuGPDXX84v3rAxJXRL0gB/5s B2aTmOwF3NxorpkLjKFfkNllUjNwuRuGFFztQxZEi3EVnkpcC082ikXUgwChToN5SSeu mQaZDt8RX5UCqVgq8lfqYZDwqiR3ztDeeavluQKfxrHzC3K2jlnWh2OgeyYbC29Nnc2g /37XYM/6t2WZ9vwXXmNoXB7A1L/rrkFs73HD7AZi+KAOUuK6OFvCe8mGbb/Rf228iO4s 8FNFWAFG/OiYrco2/2wUaLZDLXnWoS9YTKrV9PWMAaPX8EUUNcU7SCTHsPD5RGknaMsb T7Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ojxcqkk0kVLlNu7Ta3F99gByfDZzDKUG/V8xaV9TP94=; b=OzxoROnRVnovyM+ELz9ODlmVkpZqB5nECxK8sr+IKs626Oqnqk3iBRNOIFLIUtUK5f qt3R5pGWxYPA/xCQrt3BIAn8ns7oEt52f4DtzaIGKTE6UkRsTaOLFmh0OFNMnBhELVQL Frv1RrKXyymkOJHI24dApjFE3JFuFXrSzQ6jhUY/Yynd+LLt3aG0mDCyV4sKBkqPPwGW 00nFsr+lS8nHYY530CZrmq1jQe7zvmFp9iWwZSK0Y8UzbA4QHTgjXdc19DqZ8IP8ejHd OgxT4FHfZqvcTkc3BuTkso5xHJ/Z/ydS34elIN2WjKV8kJb3Ylr9+xCPlMXJdDFJHbyx kB5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=H2hzpj0q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de54si2368281ejc.99.2021.07.08.03.37.33; Thu, 08 Jul 2021 03:37:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=H2hzpj0q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231533AbhGHKiH (ORCPT + 99 others); Thu, 8 Jul 2021 06:38:07 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:47804 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231332AbhGHKiH (ORCPT ); Thu, 8 Jul 2021 06:38:07 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id C73CF22064; Thu, 8 Jul 2021 10:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1625740524; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ojxcqkk0kVLlNu7Ta3F99gByfDZzDKUG/V8xaV9TP94=; b=H2hzpj0qV36mzJGSsQkGxWTXFCEpTAaz61yprS1BXS5QamKRHLD8Oao0b3MGvTsN9Q0IHu IeadmiH9IZk/Nn5Ggrzohd0uJUxVbgvdBixnRFhmygHeHWBAwwKIHZxbuSPVl/GeKZa624 hYnPD0YT5YyewNLsorY/UMpYiDJewkg= Received: from suse.cz (unknown [10.100.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id AC6A4A3B84; Thu, 8 Jul 2021 10:35:24 +0000 (UTC) Date: Thu, 8 Jul 2021 12:35:24 +0200 From: Petr Mladek To: Vasily Gorbik Cc: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Joe Lawrence , Heiko Carstens , Sven Schnelle , Sumanth Korikkar , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] livepatch: Speed up transition retries Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2021-07-07 14:49:41, Vasily Gorbik wrote: > That's just a racy hack for now for demonstration purposes. > > On a s390 system with large amount of cpus > klp_try_complete_transition() often cannot be "complete" from the first > attempt. klp_try_complete_transition() schedules itself as delayed work > after a second delay. This accumulates to significant amount of time when > there are large number of livepatching transitions. > > This patch tries to minimize this delay to counting processes which still > need to be transitioned and then scheduling > klp_try_complete_transition() right away. > > For s390 LPAR with 128 cpu this reduces livepatch kselftest run time > from > real 1m11.837s > user 0m0.603s > sys 0m10.940s > > to > real 0m14.550s > user 0m0.420s > sys 0m5.779s > > And qa_test_klp run time from > real 5m15.950s > user 0m34.447s > sys 15m11.345s > > to > real 3m51.987s > user 0m27.074s > sys 9m37.301s > > Would smth like that be useful for production use cases? > Any ideas how to approach that more gracefully? Honestly, I do not see a real life use case for this, except maybe speeding up a test suite. The livepatch transition is more about reliability than about speed. In the real life, a livepatch will be applied only once in a while. We have spent weeks thinking about and discussing the consistency model, code, and barriers to handle races correctly. Especially, klp_update_patch_state() is a super-sensitive beast because it is called without klp_lock. It might be pretty hard to synchronize it with klp_reverse_transition() or klp_force_transition(). You would need to come up with a really convincing use case and numbers to make it worth the effort. Best Regards, Petr