Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3720269yba; Tue, 7 May 2019 06:07:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3U190FuSWw5kBbs5Bjk9jofhF1X/Mm1tI4WG3s7PTvHo1XMaSLKES07vY9pBGsAD9nqjv X-Received: by 2002:a63:2ac5:: with SMTP id q188mr30485667pgq.388.1557234472757; Tue, 07 May 2019 06:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557234472; cv=none; d=google.com; s=arc-20160816; b=U1nHE5aBbFNpXQNPaOthjXdWgH8N0TrO8fznKLSXdyIsVhFZUes4OJUSanA7yME+gW YGgU2Iz5vxV7XeetYKGCmAacr2NTOK9gHSRh+cBcj43aGLpY0Agv9pIh1lQvC3kQGRuN S+hp7IfbfemPz0CoyEXxcp0uWMiQDoHwH9hsh0NRNB3LMF8cjdEG2XC6FjGPxzIZ1D2j X5SJ+P6yjn71ViaGIddtLJdKmcNcPXo7Jnp6H6Iq28ggwPKFGhxAm1bnh/deY0Fqfw6L f/SrM/3/+MbbbOPPbEJ5rBguSGPpPTvAO4Mf55tTswVKk6Fp0SA7EV80gGb9/U1pGOWW yZpw== 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:dkim-signature; bh=GXJYEx9sOLKJI3ZXX2H1XxUQSIcWbwQSwtZn8ggn+90=; b=eBKQNzDurH6uyOtXgKi7OqmGM+gzhz3TxiIgRgan0u/Wx7e+zoS9onai6DXTX+k+6d b5fYeVSKQYNjuOwtq2jhy/BWxxqYd9rfwv+581w3FNXo5swi1SWYtCh3KRkz39REmbkA WZCEfvVTqQTojdHajSMPpClpktYWteL5MZf2dLJ26oRJzae6VzMkmrqqrIHE48+7BcMV vere0EHadAjeDI5hKh+S3LMlLYLEcFv0xVEcEgWaQ0zWHGSZZv3SHWAX9JQua2DlR4bD MjLpNKagagddH0T2FyVuPNIYYVvmWwle1aYmn4oPxJmWRVJ9/OVYn0KXz8C82f+OwsGi 64Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CqpLWNvc; 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 u3si8538052pfa.128.2019.05.07.06.07.35; Tue, 07 May 2019 06:07:52 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=CqpLWNvc; 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 S1726501AbfEGNGU (ORCPT + 99 others); Tue, 7 May 2019 09:06:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:41424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726406AbfEGNGU (ORCPT ); Tue, 7 May 2019 09:06:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D928720578; Tue, 7 May 2019 13:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557234379; bh=XfQZU2DpqqrNaC5uwBRr2mXrJytyFoUzUl7vvTJlB8c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CqpLWNvcQYpwOH0Ds3NTlc9nCXnv0qgpF0DE5BgxFOBWxB5O9IwDE++/eiiqgLqC7 zgwwtIGe/kQfEykEnjo7lXnoozEu4ckYLeqRhgjX7ZegjRKcU+zNgx9oPo8lBwiFhN yh/3iZ0MkOUnVjxqkPVCPrwuPah2PEPxomZ5pWDY= Date: Tue, 7 May 2019 15:06:16 +0200 From: Greg Kroah-Hartman To: Miroslav Benes Cc: Petr Mladek , Jiri Kosina , Josh Poimboeuf , Joe Lawrence , Kamalesh Babulal , "Tobin C . Harding" , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] livepatch: Remove custom kobject state handling Message-ID: <20190507130616.GA17386@kroah.com> References: <20190503132625.23442-1-pmladek@suse.com> <20190503132625.23442-2-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 07, 2019 at 02:32:57PM +0200, Miroslav Benes wrote: > On Fri, 3 May 2019, Petr Mladek wrote: > > > kobject_init() always succeeds and sets the reference count to 1. > > It allows to always free the structures via kobject_put() and > > the related release callback. > > > > Note that the custom kobject state handling was used only > > because we did not know that kobject_put() can and actually > > should get called even when kobject_init_and_add() fails. > > > > The patch should not change the existing behavior. > > Pity that the changelog does not describe the change from > kobject_init_and_add() to two-stage kobject init (separate kobject_init() > and kobject_add()). > > Petr changed it, because now each member of new dynamic lists (created in > klp_init_patch_early()) is initialized with kobject_init(), so we do not > have to worry about calling kobject_put() (this is slightly different from > kobj_added). > > It would also be possible to retain kobject_init_and_add() and move it to > klp_init_patch_early(), but it would be uglier in my opinion. kobject_init_and_add() is only there for the "simple" use cases. There's no problem with doing the two-stage process on your own like this, that's exactly what it is there for :) thanks, greg k-h