Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2018035ybh; Fri, 24 Jul 2020 02:16:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT0MDRO/aTCCJzk7PzASVSjCLooy5/zXvOdu2ZVsXJDybELCD78iH0li7JKb+PSX+/jgWk X-Received: by 2002:a17:906:86c9:: with SMTP id j9mr1193063ejy.5.1595582161209; Fri, 24 Jul 2020 02:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595582161; cv=none; d=google.com; s=arc-20160816; b=mXwp7oEIeq91sMtG/y18pm2EIWyaH3rPMz7lJ1UD0w78T5LNs+O3I5PSQgl5/mf+pN FOKKkncOxp842IZTMEJ6jGdN7Oi3F0irHD14sqby4Zp4tqNz2nmkS390L+Q5LoR6xdNC iGGMHu8JhKSVwTBn4fXbeOcBP8j4NETwncf3edoLuc4fenq+gJs4CwgL7bjSaEhL2G8S qa5hYBqJi2SliE+AB41A7eVRFstacrQ0BnjISST3lThKeW62inLYdZFoeBF4zOu26H5m lxXAI/csewj/XIWH7Mc8CTi3EDm6S8LPbQej9bH+wamU/c1uVVIBSS3kIgEYYRDRgzkm C4ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=13FtjbtfLSbB7lUu2KMXehtRfJlBejW7Rr8iZY5Tpxo=; b=qq0TQ1nnVvtOF/0fM5ZoVqSUTT0u5wSPB3MpSetQhtdhlPT7Nkpo/R+686lvGIL5PC T1p4ye/HcXvHa5qt784XCFcvpg7D9/4o2XldkPpoNknbnRoyP3J92iNeFlXXdwfh/ScE kj1VzZHaP2REXD6LBMx+qwicJCSOkSp8y1xPt7HzGBRx1SQJ/DR7vCDvL7vyhTFt/LIs RoxnMFKXVKwWL26ptK8CRCD6CxNX41zsJkP90mKG0gVRzVTok6c1RCWLhb5C6cPB2h+X 2kEP1QeG+3DHWko0AbE3hfDFAqxw5LYYuQFViueAFPJCCmpjTsAJ47Pe3wTgKo9pN1tn jGgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="nDzT8+/v"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si254074ejq.387.2020.07.24.02.15.38; Fri, 24 Jul 2020 02:16:01 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b="nDzT8+/v"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbgGXJNY (ORCPT + 99 others); Fri, 24 Jul 2020 05:13:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbgGXJNY (ORCPT ); Fri, 24 Jul 2020 05:13:24 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D490BC0619D3 for ; Fri, 24 Jul 2020 02:13:23 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id ga4so9229444ejb.11 for ; Fri, 24 Jul 2020 02:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=13FtjbtfLSbB7lUu2KMXehtRfJlBejW7Rr8iZY5Tpxo=; b=nDzT8+/vlYwD6OAFh3eCjMgEf1dSl503zdnwgMgotSNyUi0fcH8vWETzUUnuxBH01A x0FfzQ8ksNoPjskd8E1OpmMiR/RotwWL28mY6QuxcqxNWhwW22zwu9ye+CrhX76LbdWY XA1jbo4lWMU1AymNlEoag9jqAE09KwZDuY0KeWcYrYgox9EMg4dOmO98XfbS4MI0z38y l3eyjKKueH+OsqQ6vpMSBSiRfAIl+WTDWWxT4rlx4B8xRYUa4dHO4GLuWRZtHPCdiquc Q8vU3AgF9EgXR7awHe0F500NGUHfp6JZOGvxH0rUNqotEod+yhvtezKGw8tR0x3kzJjF rIgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=13FtjbtfLSbB7lUu2KMXehtRfJlBejW7Rr8iZY5Tpxo=; b=HcZ4s5K0xhunq2UCjn82KrmJfdUiJviZE5PeULCnzvMiDLP4uCL4ywByF2/G0bAWI7 X0b5EE9myevL07z448kaXfTs8pJ8xvN6Vv0bM7rX87gDWrVNtnCVpGoLuWQdDDD/pnkb ry7HhwxY36uEKXdCDgL1MotuT4H6n4pMEniz1WKA6krtXLcuroYnP6tNU7SGBYuXe1bN sqdOgbLqqTX2hxX0wvjC0Zk6UUfg84n5Sg6YbZ7ruub/Or3u3eo+kK55Q93D6ax38YRA +b85yps4R0X42CC+rVtvG3pSVv4W4TlISQ4Uoi+jNFINzP7f/a3Rv54Ve0ugs6aG2/Sd ut7g== X-Gm-Message-State: AOAM533IT8n6mHY2iXq5T55rZKz0sFm9zNdtAIom5MQPrhC/J2HaQqtO hW7UJSwyn1/3VQkYHwWU6EA= X-Received: by 2002:a17:906:b0d3:: with SMTP id bk19mr8662181ejb.167.1595582002571; Fri, 24 Jul 2020 02:13:22 -0700 (PDT) Received: from gmail.com (54033286.catv.pool.telekom.hu. [84.3.50.134]) by smtp.gmail.com with ESMTPSA id q25sm319164edb.58.2020.07.24.02.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 02:13:21 -0700 (PDT) Date: Fri, 24 Jul 2020 11:13:19 +0200 From: Ingo Molnar To: Jarkko Sakkinen 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: <20200724091319.GA517988@gmail.com> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> <20200724050553.1724168-2-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724050553.1724168-2-jarkko.sakkinen@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * 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, Ingo