Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 056DDC388F9 for ; Thu, 22 Oct 2020 23:10:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B04CD24679 for ; Thu, 22 Oct 2020 23:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603408227; bh=nfC4bHNbEuax03+fqQ2pLSHLy5Kmbm7Cgs03mRlrGF0=; h=Date:From:To:Subject:Reply-To:List-ID:From; b=jBvWRvtZUZHovGy39jbyb2wrXk6mYuSN8791DnGPjH/NXETpFpykctcquFkV8lY+Q 5HkC05mvVw4hTnBYjtuEgNKhFZRFaVWEDiMf7KoyCJw32IAwTxx+ITJAu+TkKZpLla Vzz/uGhMq1tjxbd9hln+rkkefNAO24BqUm9omKhk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S373265AbgJVXK1 (ORCPT ); Thu, 22 Oct 2020 19:10:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:50722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S373254AbgJVXK1 (ORCPT ); Thu, 22 Oct 2020 19:10:27 -0400 Received: from localhost.localdomain (c-71-198-47-131.hsd1.ca.comcast.net [71.198.47.131]) (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 B12522465A; Thu, 22 Oct 2020 23:10:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603408226; bh=nfC4bHNbEuax03+fqQ2pLSHLy5Kmbm7Cgs03mRlrGF0=; h=Date:From:To:Subject:From; b=tyIQqjf5bca1aAKfL6epmjFwlvI5ZeRut4AhmJ5BUpf4AgJM6qge/+OXcKhUMk7/2 7V2ROgXG2iYZbAlaeKoXv0/4QqWsRIGiIswbWvlpP0dC007R77BYJb6+cyAD0bOZ9P 2Eiq2ScFUDB70erZxk3BykVLVrVNE8UNMlpWgSdY= Date: Thu, 22 Oct 2020 16:10:25 -0700 From: akpm@linux-foundation.org To: boris.ostrovsky@oracle.com, chris@chris-wilson.co.uk, hch@lst.de, jani.nikula@linux.intel.com, jgross@suse.com, joonas.lahtinen@linux.intel.com, matthew.auld@intel.com, minchan@kernel.org, mm-commits@vger.kernel.org, ngupta@vflare.org, peterz@infradead.org, rodrigo.vivi@intel.com, sstabellini@kernel.org, tvrtko.ursulin@intel.com, urezki@gmail.com, willy@infradead.org Subject: [merged] x86-xen-open-code-alloc_vm_area-in-arch_gnttab_valloc.patch removed from -mm tree Message-ID: <20201022231025.-WibcZULc%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: x86/xen: open code alloc_vm_area in arch_gnttab_valloc has been removed from the -mm tree. Its filename was x86-xen-open-code-alloc_vm_area-in-arch_gnttab_valloc.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Christoph Hellwig Subject: x86/xen: open code alloc_vm_area in arch_gnttab_valloc Replace the last call to alloc_vm_area with an open coded version using an iterator in struct gnttab_vm_area instead of the triple indirection magic in alloc_vm_area. Link: https://lkml.kernel.org/r/20201002122204.1534411-11-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Boris Ostrovsky Cc: Chris Wilson Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Juergen Gross Cc: Matthew Auld Cc: "Matthew Wilcox (Oracle)" Cc: Minchan Kim Cc: Nitin Gupta Cc: Peter Zijlstra Cc: Rodrigo Vivi Cc: Stefano Stabellini Cc: Tvrtko Ursulin Cc: Uladzislau Rezki (Sony) Signed-off-by: Andrew Morton --- arch/x86/xen/grant-table.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) --- a/arch/x86/xen/grant-table.c~x86-xen-open-code-alloc_vm_area-in-arch_gnttab_valloc +++ a/arch/x86/xen/grant-table.c @@ -25,6 +25,7 @@ static struct gnttab_vm_area { struct vm_struct *area; pte_t **ptes; + int idx; } gnttab_shared_vm_area, gnttab_status_vm_area; int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, @@ -90,19 +91,31 @@ void arch_gnttab_unmap(void *shared, uns } } +static int gnttab_apply(pte_t *pte, unsigned long addr, void *data) +{ + struct gnttab_vm_area *area = data; + + area->ptes[area->idx++] = pte; + return 0; +} + static int arch_gnttab_valloc(struct gnttab_vm_area *area, unsigned nr_frames) { area->ptes = kmalloc_array(nr_frames, sizeof(*area->ptes), GFP_KERNEL); if (area->ptes == NULL) return -ENOMEM; - - area->area = alloc_vm_area(PAGE_SIZE * nr_frames, area->ptes); - if (area->area == NULL) { - kfree(area->ptes); - return -ENOMEM; - } - + area->area = get_vm_area(PAGE_SIZE * nr_frames, VM_IOREMAP); + if (!area->area) + goto out_free_ptes; + if (apply_to_page_range(&init_mm, (unsigned long)area->area->addr, + PAGE_SIZE * nr_frames, gnttab_apply, area)) + goto out_free_vm_area; return 0; +out_free_vm_area: + free_vm_area(area->area); +out_free_ptes: + kfree(area->ptes); + return -ENOMEM; } static void arch_gnttab_vfree(struct gnttab_vm_area *area) _ Patches currently in -mm which might be from hch@lst.de are