From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 27172C4727C for ; Tue, 22 Sep 2020 15:27:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF10E214F1 for ; Tue, 22 Sep 2020 15:27:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726667AbgIVP1K (ORCPT ); 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. From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 EED88C4363D for ; Tue, 22 Sep 2020 15:27:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1EAF2220D for ; Tue, 22 Sep 2020 15:27:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1EAF2220D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B42D6E8B4; Tue, 22 Sep 2020 15:27:51 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by gabe.freedesktop.org (Postfix) with ESMTPS id 52A486E8B0; Tue, 22 Sep 2020 15:27:10 +0000 (UTC) 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 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Subject: Re: [Intel-gfx] [PATCH 6/6] x86/xen: open code alloc_vm_area in arch_gnttab_valloc X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , linux-mm@kvack.org, Peter Zijlstra , intel-gfx@lists.freedesktop.org, x86@kernel.org, linux-kernel@vger.kernel.org, Minchan Kim , dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org, Andrew Morton , Christoph Hellwig , Nitin Gupta Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 wr= ote: > >> This will end up incrementing area->ptes pointer. So perhaps something= like > >> > >> > >> pte_t **ptes =3D area->ptes; > >> > >> if (apply_to_page_range(&init_mm, (unsigned long)area->area->addr, > >> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = PAGE_SIZE * nr_frames, gnttab_apply, &ptes)) { > >> > >> =A0=A0=A0=A0=A0=A0 ... > > 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 t= o 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. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx