Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp59984pxb; Mon, 31 Jan 2022 15:12:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0q4H/GQXsFsW6j8SjSV4dLZ/vBIsze2IBvfkctuM6PjhPZQbKNgmN2I26BTsZYbFGYV3r X-Received: by 2002:a63:610b:: with SMTP id v11mr18462944pgb.201.1643670761274; Mon, 31 Jan 2022 15:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643670761; cv=none; d=google.com; s=arc-20160816; b=0vMrLUh1r7+kH419HaCkG2R8zm/KYL38f4ZatIOcLzDHDLs/NvHtdwbmur6nAjcQD/ XWkIeH9pHur+Y0caTMohu0QOfW4Uos4H/A3aS+lqcKGztMbbydlBkMbYg/v1EdLjvvAK IJbAQ/8f7DuMPGZoKUKlp+i/QDE70Lxsu+9DkchIfDMnqVEqpLs06v31O7/Y85jjlOh8 1FM3rInvirUwt7G9VkTBwBJaroLw/S07DKEjxVYg3LbRHNviUkdnrVh72dmfCKsFXYfD vfYHC0nYRctvdE0DhXW2Flbp1lWHPzZhLJ4UhBXR4jCp2PDBa8VaVDi5pi4b2ztC+eo3 Lnxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=wcuyoZ5Su3ph/75KB81CsFOWWY7S44bOcmnPbXhmOHY=; b=w1S0TzaPWdhoXH3uuY3IdGPnY5tcOjQugblD9x5dLMU7M0MRZqmSAArDoFT0kPIDiR UvaRLy3ZU17beL7kqcmUk6UQxBfvRXmoJUVhbvfNQaDY/7EIom/CL2m/rF+IEfG0rJu8 keog6Iz/DkYxuSRw5/zHcEmI0gOh2DGVkNDix8R/LdNUFObxwBgqld4oz0TRwf3F8HWr lXb42HURrUclhGSoB3QT4+j5t4RWSplQP9QrV9hk5e9V7Ww1foz213TNVDp6mLF/FAl+ xy2jw7GPGqQXO+bU3P+qGFt9IuHdmlkmGvlpF+QLW7aOu6Htm6makMBnpxvSjysw9fbF SpRA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si14571661pgl.837.2022.01.31.15.12.29; Mon, 31 Jan 2022 15:12:41 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350679AbiA2H1j (ORCPT + 99 others); Sat, 29 Jan 2022 02:27:39 -0500 Received: from relay029.a.hostedemail.com ([64.99.140.29]:60308 "EHLO relay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236113AbiA2H1g (ORCPT ); Sat, 29 Jan 2022 02:27:36 -0500 Received: from omf06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B770EF7A; Sat, 29 Jan 2022 07:27:32 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA id 5FAD320021; Sat, 29 Jan 2022 07:27:30 +0000 (UTC) Message-ID: Subject: Re: [RFC PATCH v3 03/13] module: Move livepatch support to a separate file From: Joe Perches To: Aaron Tomlin , mcgrof@kernel.org Cc: cl@linux.com, pmladek@suse.com, mbenes@suse.cz, akpm@linux-foundation.org, jeyu@kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, live-patching@vger.kernel.org, atomlin@atomlin.com, ghalat@redhat.com, allen.lkml@gmail.com Date: Fri, 28 Jan 2022 23:27:29 -0800 In-Reply-To: <20220128203934.600247-4-atomlin@redhat.com> References: <20220128203934.600247-1-atomlin@redhat.com> <20220128203934.600247-4-atomlin@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.4-1ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Stat-Signature: 77agk1thbwafnubyr77zj8armqi3zqr5 X-Spam-Status: No, score=-3.03 X-Rspamd-Server: rspamout08 X-Rspamd-Queue-Id: 5FAD320021 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX18tnKphhZrxs8SAkUupQjJbwtcTABK26Jg= X-HE-Tag: 1643441250-995245 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2022-01-28 at 20:39 +0000, Aaron Tomlin wrote: > No functional change. > > This patch migrates livepatch support (i.e. used during module > add/or load and remove/or deletion) from core module code into > kernel/module/livepatch.c. At the moment it contains code to > persist Elf information about a given livepatch module, only. [] > diff --git a/include/linux/module.h b/include/linux/module.h [] > @@ -668,11 +668,22 @@ static inline bool is_livepatch_module(struct module *mod) > { > return mod->klp; > } > + > +static inline bool set_livepatch_module(struct module *mod) > +{ > + mod->klp = true; > + return true; > +} > #else /* !CONFIG_LIVEPATCH */ > static inline bool is_livepatch_module(struct module *mod) > { > return false; > } > + > +static inline bool set_livepatch_module(struct module *mod) > +{ > + return false; > +} > #endif /* CONFIG_LIVEPATCH */ style trivia: Generally, these static inlines can be written deduplicating the function declaration and using IS_ENABLED or #if inside the definition. Something like: static inline bool is_livepatch_module(struct module *mod) { if (IS_ENABLED(CONFIG_LIVEPATCH)) { mod->klp = true; return true; } return false; } or static inline bool is_livepatch_module(struct module *mod) { #ifdef CONFIG_LIVEPATCH mod->klp = true; return true; #else return false; #endif }