Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5056835imu; Tue, 29 Jan 2019 12:02:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN4QX2TdfrBwxKJgqTvz/0hfyVjH8A9Q5DUCVQoYBdjdFQerryGSS6n7B6EX/4NV2SlZibvD X-Received: by 2002:a17:902:b592:: with SMTP id a18mr27437707pls.293.1548792126258; Tue, 29 Jan 2019 12:02:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548792126; cv=none; d=google.com; s=arc-20160816; b=Bd1SYb6qhkm7+irbA3ylX7NrUsvfs4SOV0NvxpDFHagkAAutJ/ItQxMK89jww4fFIH aOUihWiTKD08cwe4Twn3QKVQTLVnl/3AB8zXNiWVWToGa8RdvRwy6NkKHqslY4E2OTq6 DwqZnFhGMHjUTuyiCYqbj4x+x/xDJrJGg6flgppahje6nbQDyG6BW/TudesHPr9ugrQh E61hW5FmXytc9f6oi3dlqzRw5ghtKZ8HHf3R0kmpaqI1LCvbgF47UEdmSpeiYSW5nppA k9+3JnNuMC1oaUmKjl2FxCup6RMC2zO/6I1VAJzApSf2JP3Xtfc7LzarqpLjin0LRgn4 V1Jw== 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=luge8z1p9NnRPKa5lz6c25/7PY6lVxLsSp4Xahx8bbQ=; b=e9ohu61lB/rzpw/hWTIE10FIx3CnmlO0Qs+6VnCY1yljU7VT355vqWT2klCdTgPb5X MdrkHZEt1k59FVAV64zNARff/2P68Tb0B4oB4TepFDC5QdQsC9az27Pdv0P3zt5ABYPB u0dsrnBPgcPLWpowNhxlIDfK07xNryFYVRPt8AxcRReIgj+oPVHEyGaHy00tMwMCI3A+ 5XmwZ7g4CnJXlcEy35tp+uLfvLxrhz3iajI9VSWi47BJND/xhV5F58embJcRCUSJZWFB ffr7MHSP7YFr/tWz4t/MWPvtJaZqITWYsCcNLJnzosBalCGRbRepMnVPwB6XQ9wgKUH/ eDyQ== 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 u20si16762529plj.129.2019.01.29.12.01.49; Tue, 29 Jan 2019 12:02:06 -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 S1729420AbfA2UA5 (ORCPT + 99 others); Tue, 29 Jan 2019 15:00:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50868 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727473AbfA2UA5 (ORCPT ); Tue, 29 Jan 2019 15:00:57 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 05E17CCB94; Tue, 29 Jan 2019 20:00:56 +0000 (UTC) Received: from treble (ovpn-120-147.rdu2.redhat.com [10.10.120.147]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6C5862671; Tue, 29 Jan 2019 20:00:51 +0000 (UTC) Date: Tue, 29 Jan 2019 14:00:49 -0600 From: Josh Poimboeuf To: Joe Lawrence Cc: Miroslav Benes , Petr Mladek , Jiri Kosina , Jason Baron , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] livepatch: Remove the redundant enabled flag in struct klp_patch Message-ID: <20190129200049.aarlvssu7fihfpwh@treble> References: <20190116161720.796-1-pmladek@suse.com> <20190116161720.796-5-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 29 Jan 2019 20:00:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 23, 2019 at 01:27:59PM -0500, Joe Lawrence wrote: > > I wanted to ask why there is list_empty() and not klp_patch_enabled(), so > > just to be sure... the patch was added to klp_patches list, so patch->list > > is not empty (should not be). We could achieve the same by calling > > !klp_patch_enabled() given its implementation, but it would look > > counter-intuitive here. > > > > The rest looks fine. > > > > However, I am not sure if the outcome is better than what we have. Yes, > > patch->enabled is not technically necessary and we can live with that (as > > the patch proves). On the other hand, it gives the reader clear guidance > > about the patch's state. klp_patch_enabled() is not a complete > > replacement. We have to call list_empty() in __klp_enable_patch() or check > > the original klp_target_state in klp_try_complete_transition(). > > > > I am not against the change, I am glad to see it is achievable, but I am > > not sure if the code is better with it. Joe acked it. What do the others > > think? > > Let me qualify my ack -- I think minimizing the number of state variables > like patch->enabled can help readability... on the other hand, deducing the > same information from other properties like list-empty can be confusing, ie, > klp_patch_enabled() is generally a lot clearer than > list_empty(&patch->list)). > > So I like this idea and would be interested to hear what folks think about > the exception cases you pointed out. I share Miroslav and Joe's ambivalence. It's interesting to see that it can be done, and normally I'd prefer to get rid of extraneous data fields, but the patch doesn't reduce code, and it even makes the code slightly more complex IMO, because klp_patch_enabled() doesn't always work like you'd expect. So while I suggested it to begin with, I'm going to go with a NACK :-) -- Josh