Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2563628ybh; Fri, 24 Jul 2020 16:39:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi+Mv7L09OOgklwSshJ1je0LRN2HNGx8lAlXvxluCtW4wFCVKPyyxTDlvpe/uOrOyhvAwM X-Received: by 2002:a17:907:2082:: with SMTP id pv2mr4042840ejb.188.1595633980461; Fri, 24 Jul 2020 16:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595633980; cv=none; d=google.com; s=arc-20160816; b=JCUzYtRK5HnkS+mwGGnesJG0h8zacaRddjJkmhOX+A7WRxNB5IkVBB/yJmgJ5KlXVi UM41fgmUYM5EO0IM7Doyf5dQNAZ3E+x5ek9Jv77A2azEmY7mwbGHVEh/v/jkEgIeIC7u 8p9b/z+QzcQb+Fo7kv6vxkslAOxxavmm/3o7hvQx75vErmsIq67eZ1CA1iFopxqQaVew UtwBhuHWqnYUx7t6pTpwROifPMjP9y0pbu+ad7nF6JIsBC7qaPv2gvpINwm9YnHICbrt NMEkpx242BMj0umozDTegCvcYMZ/Auk32RNOgzj1pPppNokmy1eK3U7m5Rl8uNkVdp3d aDQg== 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=rE74LpjyZrQi4d1NXe4K6Bs7k1j2T+bd6NWW261UXls=; b=JO+X7/X5sAfEU0b+f1/z8iMXizjQBvu72Dey96LY2J6G9lYYe5khznAoaXhS6aS509 6U2JxrM1TkI7cl4LLe+K6M/GnX3IJ5evp6inLvtObGGO9T3CFHLW68GJIty2NAJQ4kLb GYJNQkvWkmcDz6QPximkWjl2QXYAmxDm9qxWzHwOC5vk6X1dyldjZNAC2PoflutTbuNj mCKcaiXMlnOVFNVZXPauZqmPgIvgckadGGl+0XYYwpzijwO9z7xnPgF9PKhEOuTD2Pxt Cd1h63DGUIkOAWQxPn6kZflo69kD+Jw0eUk32q1wq0u2rD1EtasCOpVfaWDzIt5qYI9j 61pQ== 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 qk16si1436512ejb.532.2020.07.24.16.39.17; Fri, 24 Jul 2020 16:39:40 -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 S1726799AbgGXXix (ORCPT + 99 others); Fri, 24 Jul 2020 19:38:53 -0400 Received: from mga11.intel.com ([192.55.52.93]:48289 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbgGXXiw (ORCPT ); Fri, 24 Jul 2020 19:38:52 -0400 IronPort-SDR: A05C+Xmg/24AWZ8XWCC49We/KZXqTG3zxZ5R7OU3VFq4Ozu1+Fj+WoGC8eAZi3f6sq5Y1opxbU p4QPAu3hRiCA== X-IronPort-AV: E=McAfee;i="6000,8403,9692"; a="148705546" X-IronPort-AV: E=Sophos;i="5.75,392,1589266800"; d="scan'208";a="148705546" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2020 16:38:50 -0700 IronPort-SDR: FHY2QQkrnx0GfAGNW9L2qgado7yMVapEjpsegNmidntYGOZEDhGLPi0Y8c41n6UXiBarj0ycdG zyYD4SMfVQ3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,392,1589266800"; d="scan'208";a="463392443" Received: from assenmac-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.38.15]) by orsmga005.jf.intel.com with ESMTP; 24 Jul 2020 16:38:46 -0700 Date: Sat, 25 Jul 2020 02:38:45 +0300 From: Jarkko Sakkinen To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andi Kleen , Masami Hiramatsu , Peter Zijlstra , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" Subject: Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free() Message-ID: <20200724233845.GB1903189@linux.intel.com> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> <20200724050553.1724168-6-jarkko.sakkinen@linux.intel.com> <20200724102748.GD2831654@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724102748.GD2831654@kernel.org> 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 01:27:48PM +0300, Mike Rapoport wrote: > On Fri, Jul 24, 2020 at 08:05:52AM +0300, Jarkko Sakkinen wrote: > > Use text_alloc() and text_free() instead of module_alloc() and > > module_memfree() when an arch provides them. > > > > Cc: linux-mm@kvack.org > > Cc: Andi Kleen > > Cc: Masami Hiramatsu > > Cc: Peter Zijlstra > > Signed-off-by: Jarkko Sakkinen > > --- > > kernel/kprobes.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > > index 4e46d96d4e16..611fcda9f6bf 100644 > > --- a/kernel/kprobes.c > > +++ b/kernel/kprobes.c > > @@ -40,6 +40,7 @@ > > #include > > #include > > #include > > +#include > > > > #define KPROBE_HASH_BITS 6 > > #define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS) > > @@ -111,12 +112,20 @@ enum kprobe_slot_state { > > > > void __weak *alloc_insn_page(void) > > { > > +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC > > + return text_alloc(PAGE_SIZE); > > +#else > > return module_alloc(PAGE_SIZE); > > +#endif > > } > > > > void __weak free_insn_page(void *page) > > { > > +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC > > + text_free(page); > > +#else > > module_memfree(page); > > +#endif > > } > > Both alloc_insn_page() and free_insn_page() are __weak and can be simple > overriden in arch/x86 code. That is correct, but the override is obviously happening at linking time. module_alloc() and module_memfree() will still leave a compile time dependency to CONFIG_MODULES. /Jarkko