Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2144476imu; Fri, 14 Dec 2018 06:30:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/UE6uXd5S7Cz/TYQcr7PAqbxDA2bi+tdLG0i6RT9N7nvXCMb1sDD1cmUu048gxzX48hAEqP X-Received: by 2002:a63:4342:: with SMTP id q63mr2921237pga.63.1544797808218; Fri, 14 Dec 2018 06:30:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544797808; cv=none; d=google.com; s=arc-20160816; b=LSaY30ru7iatRo0E40P0hvU7F5Gdwj4tV6n4VEXiPvVFizW31bhT9lfFL1+tRGvKoA ijPH2vabDNUKehPjf9VE3r9NUJA21v+Td6tS12o0ZZyAQS0INh6IDuLYT79rz067VKlw FW3M7RxUdWep+hwvgNxmimg4htxVsjVKiNFgn04+IQpozYXqQOJKSHuFkUsVJHnN7/2b nBH/QJFJIVdc6yvB9mivaG1gMSTGcYrWB26cSYr2W0QHexCcsfA9zrYbvlhspglDwO9t oqFLhde6fW8sftDXJiQQLenNTBKNHx2SQNCdrPnoz7d6GisVUOZePaPOVwVdRKLrQv5Y AJ3Q== 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:references:message-id:subject:cc :to:from:date; bh=RYbY1hCR2mJ3sviwr6+G87xx9NAE5obgNeKDFggEFL4=; b=Bj8aVnx6N0pnWxtgk9oj3tCslaJdqBPOyKC2C+biQqFEDOeSshS3K8TIJnSTmxtHpw cty6Z+HorgiSWvrrUKOISWr9B6TMYfkrpvgxWCgmaWldIEf/r8XqKLbobl4tlUZxSxcq BCcQonN0UQYpiG5EJUyOmd0gqRCQbxiRQHqrYBtGHMeIBoZhbeFzTbTaVlFtvF+UwaZn Aaef0q5jcbV9uBOf7ACOwhv7dBH81IhRlPOmSEnSVxc+d4+IDmYrjCT4dVv546N8TW3o BHPADufyrnCl2UhbUCsRvnqDoRjTnFC7+ivW1IXzN4grplmHJZ0Gaz5q49ygdh+hAa4X qr4Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u184si4109405pgd.262.2018.12.14.06.29.46; Fri, 14 Dec 2018 06:30:08 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730249AbeLNO1R (ORCPT + 99 others); Fri, 14 Dec 2018 09:27:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47704 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730058AbeLNO1R (ORCPT ); Fri, 14 Dec 2018 09:27:17 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0023E3082139; Fri, 14 Dec 2018 14:27:17 +0000 (UTC) Received: from treble (ovpn-120-195.rdu2.redhat.com [10.10.120.195]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 53FD426FCF; Fri, 14 Dec 2018 14:27:12 +0000 (UTC) Date: Fri, 14 Dec 2018 08:27:10 -0600 From: Josh Poimboeuf To: Petr Mladek Cc: Jiri Kosina , Miroslav Benes , Jason Baron , Joe Lawrence , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v14 05/11] livepatch: Simplify API by removing registration step Message-ID: <20181214142710.iprnzxxty5k5vqoz@treble> References: <20181129094431.7801-1-pmladek@suse.com> <20181129094431.7801-6-pmladek@suse.com> <20181213224625.65o77z75u4njocnp@treble> <20181214100232.elyqlnjyhp55acxf@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181214100232.elyqlnjyhp55acxf@pathway.suse.cz> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 14 Dec 2018 14:27:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 14, 2018 at 11:02:32AM +0100, Petr Mladek wrote: > On Thu 2018-12-13 16:46:25, Josh Poimboeuf wrote: > > Now that we can't re-enable a patch, I wonder if we really need both the > > 'patch->enabled' and 'klp_target_state' variables? > > > > A patch is now always enabled, unless it's in transition, in which case > > its 'enabled' state is the same as 'klp_target_state'. > > > > For example I wonder if we could get rid of 'klp_target_state', since it > > should be the same as 'klp_transition_patch->enabled'. > > There are some catches: > > 1. klp_update_patch_state() can be called anywhere and anytime. We > would add yet another race-sensitive code if we access the flag > via a pointer. True. > 2. patch->enabled is bool while klp_target_state is triple state. > The argument is that KLP_UNDEFINED helps to catch bugs. > > > > Or alternatively we could get rid of 'patch->enabled', since it should > > be the same as > > > > patch == klp_transition_patch ? klp_target_state : true > > This might solve the first catch but not the 2nd one. It could WARN_ON if it's KLP_UNDEFINED when it's not supposed to be. > Not to say that it is much harder to read. We could put it in a klp_patch_enabled(patch) wrapper. > > Of course this could be a follow-on cleanup patch, which could be done > > in the future, so as not to hold up the merging of these patches > > anymore. > > Yes, please. This is controversial, non-trivial, and can wait. No problem. -- Josh