Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2059791ybh; Fri, 24 Jul 2020 03:30:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFtccqLzdCOKaEaXbZrVs9sh5mIPtLIaFXhNcvtSKcfVySUwn6bPIo5mzlLjR1xg32ohtl X-Received: by 2002:a17:907:42cb:: with SMTP id nz19mr8391849ejb.447.1595586640933; Fri, 24 Jul 2020 03:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595586640; cv=none; d=google.com; s=arc-20160816; b=bdn27KjnNN0IT16h6DFmuajgYqLycFK5QklDDWgu0w6CxQtw9td9UXPpaCqTseQVdK /zVLiYNfOiF6DtsB2U1U0PsrN3D2C5BWbq5RQDSgnIS+YLfqeOOEfiYYiEIF4/IDRDdn q1isN0wg4xvURHkCFF8VksglIE0VMxFS1e6WcD9zOIPMVBpsgVtcn3grLNa4TK6YY9Dm fQWVzPbs8b7s6wXF/ISZi4w8VvFeFpOaXMYUxoJYbfb/gND+0ilG/IW2g9xyzSGnAQlB 62JE+Aacaf13ie/hzoEwWh9AOHukQRjvMgNZ9p8/hjD8ne/PbjJAl4tUYvahnLlZ5wpb ZJ1g== 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=UVZ26OQbgaPgiSea2o/4/Uwc+JAljKOKALrmK2mdEBs=; b=fASr45/iDl+hyHatxira+XkIDinXt8cdCTBJ0o48yARSQyKn83vBhs6hrEyzriMbaJ Sh3M589mpkhdUdYvz0TJ6LzKL0xWXkuMcRSfJaWm/YP1uIF1NScVDUycJaecikdl4kl8 Oeh2/EmLH4u6lvLAPc3i8s3H2kqNJ7Gaegcxhfki6JSDC+5gKZjvR7L6pj1LakR8R9Mh zzbY2th34hNO/zS9JCAq1ZTvIz3LFuzEByCsX9d4cw4VQX3H/GM0+cPxdByPOWimGpWN Ox249UsGiCPvZtcXxaPeR2n34I+ue47y3aL2rqx9g0/op/nM5wvghEBAtDxAN7AVJXVr rN9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vihE7SOo; 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 a9si244230edt.401.2020.07.24.03.30.17; Fri, 24 Jul 2020 03:30: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; dkim=pass header.i=@kernel.org header.s=default header.b=vihE7SOo; 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 S1726740AbgGXK15 (ORCPT + 99 others); Fri, 24 Jul 2020 06:27:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:58722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726520AbgGXK15 (ORCPT ); Fri, 24 Jul 2020 06:27:57 -0400 Received: from kernel.org (unknown [87.71.40.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C42C72065C; Fri, 24 Jul 2020 10:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595586476; bh=rTxGRGk7C2mffWe9YQ5WA7WqwJtcr2BteH9NQ77nZv0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vihE7SOo3lD4LC4+CIPQCOoOudzMuHnNuJbbTSv86K3VmmOoshAkXr/uxwxKzvfIU KToD3j1GADq0268CJz4CmRLe0JbPbLqZb2itF7bI7BkVi+lkxrhdYW+HmqLDrMb+8K OkBeauy5MurtdVDrclLFQxjJ+BEbo0lOnCQe1VMQ= Date: Fri, 24 Jul 2020 13:27:48 +0300 From: Mike Rapoport To: Jarkko Sakkinen 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: <20200724102748.GD2831654@kernel.org> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> <20200724050553.1724168-6-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724050553.1724168-6-jarkko.sakkinen@linux.intel.com> 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 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. > struct kprobe_insn_cache kprobe_insn_slots = { > -- > 2.25.1 > -- Sincerely yours, Mike.