From patchwork Fri Jul 24 05:04:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 11682029 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33E31138A for ; Fri, 24 Jul 2020 05:06:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 09498206F6 for ; Fri, 24 Jul 2020 05:06:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09498206F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 478CF8D001F; Fri, 24 Jul 2020 01:06:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 427E78D0007; Fri, 24 Jul 2020 01:06:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 364918D001F; Fri, 24 Jul 2020 01:06:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0143.hostedemail.com [216.40.44.143]) by kanga.kvack.org (Postfix) with ESMTP id 21E588D0007 for ; Fri, 24 Jul 2020 01:06:18 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E0D881801FFE2 for ; Fri, 24 Jul 2020 05:06:17 +0000 (UTC) X-FDA: 77071783194.11.sound29_240f15126f44 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id D8EE918033E53 for ; Fri, 24 Jul 2020 05:05:18 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,jarkko.sakkinen@linux.intel.com,,RULES_HIT:30012:30054,0,RBL:134.134.136.65:@linux.intel.com:.lbl8.mailshell.net-62.18.0.100 64.95.201.95;04yroanatjgwsyf91wdewczok9ghgyptek3rscscp6cp7wg1nta8qiwkxx9f4xb.hdn988swtas8y54dk7d5xswm5uuuwd9w1ru64csdghom78figp3xyeshm1rmp9n.y-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: sound29_240f15126f44 X-Filterd-Recvd-Size: 3105 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Jul 2020 05:05:18 +0000 (UTC) IronPort-SDR: szi6S2zGjenlOK8xxVY8OugQwXrg+gOFeAkc6z8SBSk+/PHUwVx9VSGMHWltsDfFSVhyWUDN4s W0x34FlFvTJQ== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="150645715" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="150645715" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 22:05:18 -0700 IronPort-SDR: qY/icntTHNX8zoRFkoNoJ9PavRZVse1JH+1/o2alo5VC1HFLRyNHZrsE1xfYPp1L/E2n4a6MXl Bw89swfNwqww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="302553101" Received: from itopinsk-mobl1.ccr.corp.intel.com (HELO localhost) ([10.249.36.179]) by orsmga002.jf.intel.com with ESMTP; 23 Jul 2020 22:05:15 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org Cc: Jarkko Sakkinen , linux-mm@kvack.org, Andi Kleen , Masami Hiramatsu , Peter Zijlstra , Andrew Morton Subject: [PATCH v5 2/6] vmalloc: Add text_alloc() and text_free() Date: Fri, 24 Jul 2020 08:04:56 +0300 Message-Id: <20200724050501.1723315-3-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200724050501.1723315-1-jarkko.sakkinen@linux.intel.com> References: <20200724050501.1723315-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D8EE918033E53 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Introduce functions for allocating memory for dynamic trampolines, such as kprobes. An arch can promote the availability of these functions with CONFIG_ARCH_HAS_TEXT_ALLOC. Cc: linux-mm@kvack.org Cc: Andi Kleen Cc: Masami Hiramatsu Suggested-by: Peter Zijlstra Signed-off-by: Jarkko Sakkinen --- include/linux/vmalloc.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 0221f852a7e1..6c151a0ac02a 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -249,4 +249,21 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms) int register_vmap_purge_notifier(struct notifier_block *nb); int unregister_vmap_purge_notifier(struct notifier_block *nb); +/* + * These functions can be optionally implemented by an arch in order to + * provide specialized functions for allocating trampoline code. + */ + +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC +/* + * Allocate memory to be used for trampoline code. + */ +void *text_alloc(unsigned long size); + +/* + * Free memory returned from text_alloc(). + */ +void text_free(void *region); +#endif /* CONFIG_ARCH_HAS_TEXT_ALLOC */ + #endif /* _LINUX_VMALLOC_H */