Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4021825pxk; Tue, 22 Sep 2020 08:28:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAV7u9S04zUpMp+lVkVOuVNffHsiVhci+fq3zgVWgKcacAFAVxIBgFY7lLhCKVagd/1JL6 X-Received: by 2002:a17:906:a101:: with SMTP id t1mr5381101ejy.203.1600788520515; Tue, 22 Sep 2020 08:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600788520; cv=none; d=google.com; s=arc-20160816; b=gpy3jXk8C7qkum2mvbIaNlY0o6dzFXHVs6c7OsSElIicT3vISkvnyFtKLgnvCt8ATt Ke7KTrwdx0VnU1lGHy46nqxARnWYbUn6H+Mwm6B92hsinZ+D5lhPG7UwqI1yt+noJf6e HRWysKii4oPDOU74dbKANk283UiFJat4T/4Mufx5d+e+3TfxmlaSEjPiegOhNEosK/AK 2TbWPOz2ebBM6xDVrbL6ofWipuRHgq5GU4yhuYGoktEHUffRlV5kUIyXvDZ2k8zqZrC1 MIiLkn5NioS1+jHi21/flwcZdBp5CJNY0VOu4ce9eEYtkxR8Hah4joVGXaXtxTDdYUld WVyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1rRJPNr6Go7Zmwt7klZt7PBqgiepflCbCkU0pVwsVgw=; b=elgqDF5ByfHj33DaQ9DOACGa460Xwr674NBYd22yGUrvOS+g9RMip1wlrWiJ2TXa3R Qpmg85gpXQ2yEqoaNUTaEuqoilMXoBTIo4kh7/xQQ1L0VF9yoeav2IjFXYKk6LgUkhLz Jf3Qq/2Zkybxl7mDsJr5X2SNnEIolLiltqzw7TbJPVkurXXZps/DQvGhvy7AEJOLL6ZX MW6+r6JVbZgbwqczS8oSHVHfJVbBseAzrQHY29R5czDd8LHQFRlzRp7OD3JY3yN9uIFj Jh4UlNXBz+pJobPMhyo0mfh2N5ztRMcABs4EhfClhopsxrseHB88u7KvSnHI3bZBQJ4r 1ioA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si7905023ejx.235.2020.09.22.08.28.14; Tue, 22 Sep 2020 08:28: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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726650AbgIVP1K (ORCPT + 99 others); Tue, 22 Sep 2020 11:27:10 -0400 Received: from verein.lst.de ([213.95.11.211]:45148 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726614AbgIVP1K (ORCPT ); Tue, 22 Sep 2020 11:27:10 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 6CC1F67373; Tue, 22 Sep 2020 17:27:06 +0200 (CEST) Date: Tue, 22 Sep 2020 17:27:06 +0200 From: Christoph Hellwig To: boris.ostrovsky@oracle.com Cc: Christoph Hellwig , Andrew Morton , Peter Zijlstra , Juergen Gross , Stefano Stabellini , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Minchan Kim , Nitin Gupta , x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org Subject: Re: [PATCH 6/6] x86/xen: open code alloc_vm_area in arch_gnttab_valloc Message-ID: <20200922152706.GA30633@lst.de> References: <20200918163724.2511-1-hch@lst.de> <20200918163724.2511-7-hch@lst.de> <0833b9a8-5096-d105-a850-1336150eada1@oracle.com> <20200922145819.GA28420@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2020 at 11:24:20AM -0400, boris.ostrovsky@oracle.com wrote: > > On 9/22/20 10:58 AM, Christoph Hellwig wrote: > > On Mon, Sep 21, 2020 at 04:44:10PM -0400, boris.ostrovsky@oracle.com wrote: > >> This will end up incrementing area->ptes pointer. So perhaps something like > >> > >> > >> pte_t **ptes = area->ptes; > >> > >> if (apply_to_page_range(&init_mm, (unsigned long)area->area->addr, > >> ??????????????????????? PAGE_SIZE * nr_frames, gnttab_apply, &ptes)) { > >> > >> ?????? ... > > Yeah. What do you think of this version? > > > Oh yes, this is way better. This now can actually be read without trying to mentally unwind triple pointers. (You probably want to initialize idx to zero before calling apply_to_page_range(), I am not sure it's guaranteed to be zero). Both instances are static variables, thus in .bss and initialized. So unless you insist I don't think we need a manual one.