Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6105737ybi; Wed, 29 May 2019 02:59:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFuMjs2Vn6WCkHu8LGhJ+D4kZB22tSKK12NyQ2Vln6mZ3Uf+uwOQZLhpRXiow7xrzEDS8Q X-Received: by 2002:a17:90a:62cb:: with SMTP id k11mr10612761pjs.26.1559123978659; Wed, 29 May 2019 02:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559123978; cv=none; d=google.com; s=arc-20160816; b=sXpN1K4s4NTalYAU4K/sbxT0jZPIqj0Fmwbh2trDsGWWnaambP5kB85wnrVzNmRwTW GN0oXNf3/v4NXFYYSg3FXnGdziFCQjHN+4CM0y0GWw/12RgzKufMNHjl1Gjeiq7cyco/ DA66XDFtAexFaKnie0Mj6H8TxDylSVIGV7D228qajQbPa9rIFNz/Ftj6oc8Hd69tma4v k53bx/SV4pCLSvScS/z3GZ/OR1Jw8PDoldY5AwtLchcNwDsEzcpLpXhc9H3zch+Vqcxn jhyguHgmDJllzp6WWyC2zYdJK1CyRxxYf7D0RPnihsVCbmy8AmF6yOgjaDmVzItZ0yy6 4bKA== 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=8JD43a2zTb9TDJivwL1zHKbxFk93herc8Ke5qQnYFyw=; b=gVFmzDogjtO1aUt6yZKVwZX2KU4EKpZqAhVDnUVdjii051V3zY3dso/0hVri7jc2Fx Kb7EWH2TzHT4HboyiGJsbxfl6M3i7w1GT3pmmzmpnSxMvWsiiGpLl23SLoz53aYrGTqJ tvIy4sks/I2/0bFwksmP81EHfiz9NYxryzciEhRtUTcJ3kUaegeNBGd31z3IWcuSCE4F ZG7yGvSLduihlS38SaXEJQnR5m9h9ShEFiC0nAEI4fKj+td+Qo6PFXHnRAo8rDc8xl3W +S4daRWXXjO797ul+bKTrFTfreFHG3tKcg/pNdT+PUCb20iIWr8rW0mf9512aR7Cry9B tuNA== 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 n1si26063635pld.61.2019.05.29.02.59.23; Wed, 29 May 2019 02:59:38 -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 S1726687AbfE2J5l convert rfc822-to-8bit (ORCPT + 99 others); Wed, 29 May 2019 05:57:41 -0400 Received: from prv1-mh.provo.novell.com ([137.65.248.33]:54618 "EHLO prv1-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726225AbfE2J5l (ORCPT ); Wed, 29 May 2019 05:57:41 -0400 Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Wed, 29 May 2019 03:57:40 -0600 Message-Id: <5CEE57910200007800233571@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.1 Date: Wed, 29 May 2019 03:57:37 -0600 From: "Jan Beulich" To: "Juergen Gross" Cc: "Stefano Stabellini" , , "xen-devel" , "Boris Ostrovsky" , "Konrad Rzeszutek Wilk" , Subject: Re: [Xen-devel] [PATCH v2 3/3] xen/swiotlb: remember having called xen_create_contiguous_region() References: <20190529090407.1225-1-jgross@suse.com> <20190529090407.1225-4-jgross@suse.com> In-Reply-To: <20190529090407.1225-4-jgross@suse.com> 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 29.05.19 at 11:04, wrote: > @@ -345,8 +346,11 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, > size = 1UL << (order + XEN_PAGE_SHIFT); > > if (!WARN_ON((dev_addr + size - 1 > dma_mask) || > - range_straddles_page_boundary(phys, size))) > + range_straddles_page_boundary(phys, size)) && > + PageXenRemapped(virt_to_page(vaddr))) { > xen_destroy_contiguous_region(phys, order); > + ClearPageXenRemapped(virt_to_page(vaddr)); > + } To be symmetric with setting the flag only after having made the region contiguous, and to avoid (perhaps just theoretical) races, wouldn't it be better to clear the flag before calling xen_destroy_contiguous_region()? Even better would be a TestAndClear...() operation. Jan