Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2644941ybh; Fri, 24 Jul 2020 19:39:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDyX0fk5XrH8NCLof53uhlwzKV0zIqNjOXfTCvvdklKOC8bj0lTK+9HSq4F+km4sgbzeJ6 X-Received: by 2002:a50:e689:: with SMTP id z9mr11757780edm.131.1595644770842; Fri, 24 Jul 2020 19:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595644770; cv=none; d=google.com; s=arc-20160816; b=HrA92lMle8RyBVnUvGmDyY8dmeC7wCroyd69xAIQBwSew4/GUixXixUXZsBqMGrM6K coIidOl+jBt1CsHqQYnESoVNC4/bOE9B5YJPCC73S33IR6Ah8FTEKBS/jAoih2/6AEd2 sh4ZMdQUSDW3W1rnIszoXsmw/nk2Utp24v0iv0Dtow5mb+NNINBC3B5pOHSSbqCmwXvA iFwgI0frWdmI5LxioV0ZlH2dbGRAOQDy8Q3m0k6ndQ5fKHUj6//9Q/VjRlEs5NaKvtW3 7Jlv/S7fxzzf50UwZmTjKKIXQaPFcbXV8R9euoyUaPwjtRgU804Ay1I8jybZlHbbHjPB jVxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=nHkC4zt5VcVa98xnHIF/qzxt6jX3f/JJ89Nq46iZw0g=; b=Ki3CkE8qYdL9MGpFBd5/4K7r2R9kh15trgX46SdfgXBArbsUf/QJ2K+eXg33DNiZxp s60XIrTCM19J9Jti62nR+H3eJb78zU1WeFygQYpFgUpBocVOmcSpVQccpT0iFGR8jHDu QFL6+apdH31Mj+M4nncwY6BKEk0Z8SXeTCnqpz4AwvZTjZRTpnfkYl+Fj4xb0prVJsNJ 1c1Vb7szWHFcdcQ9+RvGoQgc7Tg7Zl7WT0jY5sJD8r0JCpaxDqsw9pFFvOfmgXoHL+v+ ccnTfhftyPQ1lTnb4gCTnnVviLiCUjb5vOrsBGMtkNu4rfElDW7K95d12pSF3C8+q2KZ Pucw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s23si1842610eji.327.2020.07.24.19.38.51; Fri, 24 Jul 2020 19:39:30 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbgGYCgl (ORCPT + 99 others); Fri, 24 Jul 2020 22:36:41 -0400 Received: from mga12.intel.com ([192.55.52.136]:21751 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbgGYCgl (ORCPT ); Fri, 24 Jul 2020 22:36:41 -0400 IronPort-SDR: RgHjhSaxZu/Svh1adiKeF96ldxA+lCiiEFCDb2QZeqvrLakvZeJwwmPj0rW3AfcDm5rFhXLdJT i+j/SoQCgVOw== X-IronPort-AV: E=McAfee;i="6000,8403,9692"; a="130364417" X-IronPort-AV: E=Sophos;i="5.75,392,1589266800"; d="scan'208";a="130364417" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2020 19:36:40 -0700 IronPort-SDR: KUDOuRXU7WxsPpfpzLDg/dH8nvZCth3M2Ujrp7RGQEKup3WlQurm5AhhZzT75HE6n+bZP1b7PH xU8ocz+diU4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,392,1589266800"; d="scan'208";a="311607313" Received: from jcrametz-mobl.ger.corp.intel.com (HELO localhost) ([10.252.58.73]) by fmsmga004.fm.intel.com with ESMTP; 24 Jul 2020 19:36:35 -0700 Date: Sat, 25 Jul 2020 05:36:33 +0300 From: Jarkko Sakkinen To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andi Kleen , Peter Zijlstra , Masami Hiramatsu , Jessica Yu , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" , Steven Rostedt , Ingo Molnar Subject: Re: [PATCH v5 1/6] kprobes: Remove dependency to the module_mutex Message-ID: <20200725023633.GC17052@linux.intel.com> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> <20200724050553.1724168-2-jarkko.sakkinen@linux.intel.com> <20200724091319.GA517988@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724091319.GA517988@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 24, 2020 at 11:13:19AM +0200, Ingo Molnar wrote: > > * Jarkko Sakkinen wrote: > > > Add lock_modules() and unlock_modules() wrappers for acquiring module_mutex > > in order to remove the compile time dependency to it. > > > > Cc: linux-mm@kvack.org > > Cc: Andi Kleen > > Cc: Peter Zijlstra > > Suggested-by: Masami Hiramatsu > > Signed-off-by: Jarkko Sakkinen > > --- > > include/linux/module.h | 18 ++++++++++++++++++ > > kernel/kprobes.c | 4 ++-- > > kernel/trace/trace_kprobe.c | 4 ++-- > > 3 files changed, 22 insertions(+), 4 deletions(-) > > > > diff --git a/include/linux/module.h b/include/linux/module.h > > index 2e6670860d27..8850b9692b8f 100644 > > --- a/include/linux/module.h > > +++ b/include/linux/module.h > > @@ -705,6 +705,16 @@ static inline bool is_livepatch_module(struct module *mod) > > bool is_module_sig_enforced(void); > > void set_module_sig_enforced(void); > > > > +static inline void lock_modules(void) > > +{ > > + mutex_lock(&module_mutex); > > +} > > + > > +static inline void unlock_modules(void) > > +{ > > + mutex_unlock(&module_mutex); > > +} > > + > > #else /* !CONFIG_MODULES... */ > > > > static inline struct module *__module_address(unsigned long addr) > > @@ -852,6 +862,14 @@ void *dereference_module_function_descriptor(struct module *mod, void *ptr) > > return ptr; > > } > > > > +static inline void lock_modules(void) > > +{ > > +} > > + > > +static inline void unlock_modules(void) > > +{ > > +} > > Minor namespace nit: when introducing new locking wrappers please > standardize on the XYZ_lock()/XYZ_unlock() nomenclature, i.e.: > > modules_lock() > ... > modules_unlock() > > Similarly to the mutex_lock/unlock(&module_mutex) API that it is > wrapping. > > Also, JFYI, the overwhelming majority of the modules related APIs use > module_*(), i.e. singular - not plural, so > module_lock()/module_unlock() would be the more canonical choice. > (But both sound fine to me) Thanks, I renamed them as module_lock() and module_unlock(). > Thanks, > > Ingo /Jarkko