Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1782511yba; Thu, 25 Apr 2019 05:45:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyg7HWFoZf3ZZckKl8UiAuPnN+Hr1hDviNhTGzkM4+Ts6YM90iPdvHB9dJxoDMFDLIeqPez X-Received: by 2002:a17:902:4681:: with SMTP id p1mr37823606pld.42.1556196343918; Thu, 25 Apr 2019 05:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556196343; cv=none; d=google.com; s=arc-20160816; b=vGkdxgH9o7uUsHEBSKWUIHjVdismvtgpImKMVkHOHzvyx+aRuYVLZtchV1gBwcAucV LQiY78WhZkD43Ir6YlGEXYNDHj4zkMqz7HUWTdHbA9sm0LnLAKM0zPB+WnI18ZbIIoGV B+7ZlksdSgvN+apk6p3fWOzYRcHLIRJS0gdVEhV2KPvRiwRrPWK4UihcNWQpVYeOy6cJ e/6g9ugzadMBGcjgZBySHDV6aZLYQJTw5MxZyGQd6EaXfkJ8IwSAbLosOAwaHQud8idd C21B3T7V5QmdNC9eWFbdcr0PQvqJNuV2Pl4cvnV/xJDsahX46YE+ftQO8aFZTny3ZUg+ dFuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:in-reply-to:references :subject:cc:to:from:date:message-id; bh=4rdnJ1i1cE10hvBs24X7m+6mh7mg5D4L440u2Mgk+5g=; b=SO9uC5S8Thqerd5GkUERe0Gdv+0nWYDEou7yYVhSC6N9+9Q0dZ/qXF85+0kskKZCSh Y3ICQdiYvF/66uIKKPDP3qebPyX5CgoGt7RfBXyZt89Gtdllzc+/XGlk3sVjRBwsd+QY 6Sfv/ufe6KuickLp8BefVSMeKPW0PwRLoO+SLwf87vta4ADjc6hdY3BRmxDRXedgbFLC VcE18t1odVIYXUvGrdJHl53G27sxueHQ0+gJ5Ajs06GKaXkyN/bu0xZUgf5XLKbzQsmN tuYlscDTasdoAoYFlK0O7nQnf+KqjqEe74zHXVeeYk/fkC92kq5mp/jpEEii6WZlZOch PVBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z12si3359472plk.353.2019.04.25.05.45.29; Thu, 25 Apr 2019 05:45:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727739AbfDYJBr convert rfc822-to-8bit (ORCPT + 99 others); Thu, 25 Apr 2019 05:01:47 -0400 Received: from prv1-mh.provo.novell.com ([137.65.248.33]:52075 "EHLO prv1-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfDYJBr (ORCPT ); Thu, 25 Apr 2019 05:01:47 -0400 Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Thu, 25 Apr 2019 03:01:46 -0600 Message-Id: <5CC177740200007800228EB2@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Thu, 25 Apr 2019 03:01:40 -0600 From: "Jan Beulich" To: "Juergen Gross" Cc: "Stefano Stabellini" , , "xen-devel" , "Boris Ostrovsky" , "Konrad Rzeszutek Wilk" , Subject: Re: [Xen-devel] [PATCH 3/3] xen/swiotlb: remember having called xen_create_contiguous_region() References: <20190423105457.17502-1-jgross@suse.com> <20190423105457.17502-4-jgross@suse.com> In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>> On 23.04.19 at 20:36, wrote: > On 23/04/2019 19:05, Stefano Stabellini wrote: >> On Tue, 23 Apr 2019, Juergen Gross wrote: >>> Instead of always calling xen_destroy_contiguous_region() in case the >>> memory is DMA-able for the used device, do so only in case it has been >>> made DMA-able via xen_create_contiguous_region() before. >>> >>> This will avoid a lot of xen_destroy_contiguous_region() calls for >>> 64-bit capable devices. >>> >>> As the memory in question is owned by swiotlb-xen the PG_owner_priv_1 >>> flag of the first allocated page can be used for remembering. >> >> Although the patch looks OK, this sentence puzzles me. Why do you say >> that the memory in question is owned by swiotlb-xen? Because it was >> returned by xen_alloc_coherent_pages? Both the x86 and the Arm >> implementation return fresh new memory, hence, it should be safe to set >> the PageOwnerPriv1 flag? >> >> My concern with this approach is with the semantics of PG_owner_priv_1. >> Is a page marked with PG_owner_priv_1 only supposed to be used by the >> owner? > > The owner of the page is free to use the flag. > > Like Grant pages are marked by the grant driver using this flag. And > Xen page tables are using it in PV-guests for indicating a "Pinned" > page table. Considering the background of the series, isn't such multi-purpose use of the flag a possible problem? You're already suspecting a wrong call into here. The function finding the flag set (but for another reason) might add to the confusion. But I realize there are only so many page flags available. Perhaps the freeing function should, first thing, check the handed space actually matches the criteria (within dma_mask and contiguous)? Jan