Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5687411imu; Wed, 30 Jan 2019 01:45:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN5LpDgZzOIvhzwrS8iWvUSVR08K/HFPNDrToD/0oq7dsJabwKlRJ+KyEd0i5F/ijIBQavHJ X-Received: by 2002:a65:6148:: with SMTP id o8mr26914988pgv.451.1548841502315; Wed, 30 Jan 2019 01:45:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548841502; cv=none; d=google.com; s=arc-20160816; b=TyFAT8zc13c56ZVsn4Yt1WFO03zm3ko0XLj4jNMni/67FoEN/oSaGeSdr0mR4RTwRo VcWIANQ8nBFz+Dxa4BVK8kX2bhEQJvPSlgLzI8CrGc5YddUIQLQHMMz7mvkepE5xXcW5 bsOtP0BfJnbwl9CS1zJSkl8sxCEOH2Q+fYq91uN0IbLgyS564h46TPH+fDG3fCBnfGqe /8+oxmFxepooUoVAjrjLZ76jAYB+wXniLNs8UrqOMtu4F2Cj+IPH7g9jG22YCyRPfc93 6NZUUxcL85SJzRZy7yroWci8oYjhsXbQQqynfSiOhe1bvifyj3MH3wxVw5l6sey6wI62 23kw== 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=h5pkjIeUwwt/E8xxSU4BMdLsYfxskURUH6Pslm7J2WE=; b=Ui5hkvyNmxOPsz2Ovr5fundu2Ekcuf9PCFCW37zoF1LYL51H6NEroHTVhzmhHZXP5/ H5LJbCFAXaCzI99fbro99B26odxEd8s4oyf1s8pxDrVUJghdm8Ch9YXI+dF11wTWuI1j iUe6SGz6ApKwv0PRfuODO6Qdz4C2V3u5y0b28d694EESLPUOn2lDVLksvONa5q/Jpk35 SLd2GYVOZwes/hgnlh5Ay9g0K8LJnHP/F35d1f7B1KeQAu4A3aYTmit27P5Rvy35AY/Z mErXq+b9MAJ37QWYHHsiIPEUTeGNoNKPzv7uDH67bcgZfDxOaqKH9/JBD1IPQVsfsuYj pOjg== 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 f10si980517pgh.195.2019.01.30.01.44.47; Wed, 30 Jan 2019 01:45:02 -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 S1730654AbfA3JoI (ORCPT + 99 others); Wed, 30 Jan 2019 04:44:08 -0500 Received: from mx2.suse.de ([195.135.220.15]:45286 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729050AbfA3JoH (ORCPT ); Wed, 30 Jan 2019 04:44: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 22EDFACC6; Wed, 30 Jan 2019 09:44:06 +0000 (UTC) Date: Wed, 30 Jan 2019 10:44:05 +0100 From: Petr Mladek To: Josh Poimboeuf Cc: Joe Lawrence , Miroslav Benes , 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: <20190130094405.qbm7nynam3dryq4h@pathway.suse.cz> References: <20190116161720.796-1-pmladek@suse.com> <20190116161720.796-5-pmladek@suse.com> <20190129200049.aarlvssu7fihfpwh@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190129200049.aarlvssu7fihfpwh@treble> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2019-01-29 14:00:49, Josh Poimboeuf wrote: > 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 :-) Fair enough. I took this patch as an experiment that might fail :-) Best Regards, Petr