Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp119566pxb; Fri, 17 Sep 2021 20:56:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQwiPHWt4uyFcPuSKX6kJJ//7ne3PSNMcBwEtjjXr+C5q+uqRw2sf870yriGJN4rciaZ6v X-Received: by 2002:a5d:9145:: with SMTP id y5mr10933314ioq.200.1631937373674; Fri, 17 Sep 2021 20:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631937373; cv=none; d=google.com; s=arc-20160816; b=g+Ng0MsKKF/UT+RR1vPyM8FaH9ULcBQkS9JBUOcHtWXNs/jsluiwjG8Sfv2lr8WuW0 La1f0rZVDWeZZZ1/R2UOaA+zodFGdgDuMN0+hKhaG74TVfI9Q2zOnb/7/LXHQ+UI25Om 2VGdk0B7BLZxmVYY8r5GIRYRIsDnYWQKNIJ5nGQ5YUxNuo6R73p857/UQTJTmBTy4Mir COwIlhUKEU+Qmml91tfW5FtM8IbEu9XIH4onEry1UfUBtVEhXqnTAzugZZ+vebGb9qzS FjyQGK4ZZV4ml1MifDr/z9UfgmjgBX+fhexDC8Pay/wlElLmEwLOBYqkYibIqTx0tBe2 sung== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=0L2IOSbzNz8SzEnFLGC6WxiFBFqlzx0hCcB/3mHoQ4c=; b=j7kPk0wMD9tJq+LDWmIHRapUCqy195AV1q+Zje5ZHLhgcRc/zwOnj+H92+Pfpx8uWH fjsbcEuCRlTu1KnHalY+xQv0zj0XtnF4gD6eKZZMYmkAz2OGR8kHsIdC8X1EokwVhFZ9 cVxSO6u2A2hF6Do0y80Td5t/Ub401mIPwo7433SDEfzubMCMtP7UGgSPRnLIbSGAtIM9 aIs7siv6Br1/7vPzEsHyz+r4YJwXcFgkYVo9VPEdQZIsiCmutY25hY6VJ7IxH2JpMRwi bFpJnSPe0C6mnLghx1pFPoqg5A2uLHRFfo1QoCRt6pXFyWMnAvnTjKITJuMKEbT6wqCw V+0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TwffbNS4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q15si2593863jaj.16.2021.09.17.20.56.01; Fri, 17 Sep 2021 20:56:13 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TwffbNS4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236102AbhIQUGP (ORCPT + 99 others); Fri, 17 Sep 2021 16:06:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:42692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbhIQUGN (ORCPT ); Fri, 17 Sep 2021 16:06:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 18D11611C3; Fri, 17 Sep 2021 20:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631909091; bh=mEyjE0OtAQmdOBy6JF1uWMiaz+LsaQ2TOO9N0GzD4q8=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=TwffbNS4RL5k7jgYAk9bPvqGar9gPSXlDk7tGrFRJS6vG73q/79FwFr4xCCJNw66u faPcb3eKXbUXcWv89rMvuYi/3EqZIZqPynZ0WV/pN974Hj6SuS9OvfoEUzia0kGSgw mzsjR/DoMpf7tw4UA3fGaUygmCF//mPQMFR0RSwEkTVgEGfu0fJtHyKA2mJa1p15cL 7iBAO8W5stpj5jk+KUlDxzg1MU6JehWVMawg6sskx2DvAncMAwMtsqXL9ioGWwOMYY VslTVrm1j8TiDQ36VTupNVotaWGVYguVOhI/f4EI09U3JMvFkddeor/0PdlCclJ7XV T6eyo4p4Y6/pA== Date: Fri, 17 Sep 2021 13:04:50 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Jan Beulich cc: Juergen Gross , Boris Ostrovsky , Stefano Stabellini , lkml , "xen-devel@lists.xenproject.org" , "hch@lst.de" , Konrad Wilk , "iommu@lists.linux-foundation.org" Subject: Re: [PATCH v2 1/4] swiotlb-xen: ensure to issue well-formed XENMEM_exchange requests In-Reply-To: <7b3998e3-1233-4e5a-89ec-d740e77eb166@suse.com> Message-ID: References: <164e58ff-2edd-2c99-ac3d-e18eb06ff731@suse.com> <7b3998e3-1233-4e5a-89ec-d740e77eb166@suse.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 17 Sep 2021, Jan Beulich wrote: > While the hypervisor hasn't been enforcing this, we would still better > avoid issuing requests with GFNs not aligned to the requested order. > Instead of altering the value also in the call to panic(), drop it > there for being static and hence easy to determine without being part > of the panic message. > > Signed-off-by: Jan Beulich Reviewed-by: Stefano Stabellini > --- > I question how useful it is to wrap "bytes" in PAGE_ALIGN(), when it is > a multiple of a segment's size anyway (or at least was supposed to be, > prior to "swiotlb-xen: maintain slab count properly"). But that's > perhaps yet another separate patch. > --- > v2: Drop logging of alignment. Wrap lines. > > --- a/drivers/xen/swiotlb-xen.c > +++ b/drivers/xen/swiotlb-xen.c > @@ -230,10 +230,11 @@ retry: > /* > * Get IO TLB memory from any location. > */ > - start = memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE); > + start = memblock_alloc(PAGE_ALIGN(bytes), > + IO_TLB_SEGSIZE << IO_TLB_SHIFT); > if (!start) > - panic("%s: Failed to allocate %lu bytes align=0x%lx\n", > - __func__, PAGE_ALIGN(bytes), PAGE_SIZE); > + panic("%s: Failed to allocate %lu bytes\n", > + __func__, PAGE_ALIGN(bytes)); > > /* > * And replace that memory with pages under 4GB. >