Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1859756pxb; Fri, 10 Sep 2021 16:16:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycwgUSW7pVeACOAvbSo0pgIOhLUYjRn/K9rk7gyePfe9u56gA0Mozb5Q8zZnUsaKBOwnjP X-Received: by 2002:a92:db0c:: with SMTP id b12mr67376iln.171.1631315806399; Fri, 10 Sep 2021 16:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631315806; cv=none; d=google.com; s=arc-20160816; b=CDW51pwJUO5Y+PxMUiUS4UYIRMw5eHmRmoZyjG+rYbUTsvGB/goXGvuyax2TxUrC7Q Ctvku7I2OrJsk0QLgAAmfzM+3p9UxO1u3G65Tly1ca62J9Rxv7o8rIJq7F2S1jzgsuSR cL4lA9Nu6RDjfuHmVy2z05NTeIYy2tWDdKgzTMb+4LWLJB5CpZ1+TCRGVSxbKc5DsyFG R2QozNOLzhVOXhNP25pUNdi1gXksk6I4VQ+VpoRrax0UwRlIaBMhwVNWYRY9ZOEFqsNd 2h8XfwEcIvZePG7JCwt7vHjDplz5t3dckhLVAD5BsWhzvpAWOLs0p5Tb1pCjYfmGdAYf IsZQ== 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=0xZ54vswL1lsqGkYUYeo0f5lYbcKvjdFNOHFhcrPwd4=; b=P0BnFgWSQvRMMmBsdiyUXLRK4YYbD+tqaHXfFssz1vkOQkm9lD6DtYBxxRdpoec6QX j7nhRvmfVkq7pEscjWIninLPEXdaoEyYRN0TDuIhyQxFp/hIuZATdpWxwbeQIHERW0Cj /SURYqOMTO6irVi1fkl/RxWNUXy6Bj1EgIKuB6kgHPOSLa+tjndpR8CK76VXGqENrrgd +tVxXsp/dqoUk6GQ5KAF+FPXNGRD213R9Txe9fSrUnJU0Uo9hi5kuowwLbRw+yMbhjCW bJuhhEiO5Tc854hSPiWpxc4RLSUYLiRZKqGwmd8DwiAuGSXEdGfLohlj4KR5rwkGC6T3 LnbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OI1DCVnn; 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 189si39146ioa.35.2021.09.10.16.16.35; Fri, 10 Sep 2021 16:16:46 -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=OI1DCVnn; 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 S234656AbhIJXQN (ORCPT + 99 others); Fri, 10 Sep 2021 19:16:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:59380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbhIJXQL (ORCPT ); Fri, 10 Sep 2021 19:16:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F03D7611F0; Fri, 10 Sep 2021 23:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631315700; bh=vJNj/V5gr36eIctaJUoPC89yjzCT0LnaEG2pV27VBPs=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=OI1DCVnn0xilrmUuSWEetAwLMWahluaHTMFEFvR8u5WMW2j7EIqzKwJ1N7d0t7d9s lYU8f6PgKS0MbktKeEwQcp2NeQbCMka68x6vdCQJAxBgj5AB7oop0aZViU2IW7L0mU kjXLlPVNGTZUzphhrE7aW0f5RxAbNfdRlIU9s3TPG9EyPE/lphthLrGBoTcKxVf5qJ 3qSS6+CG2hoIvDciSe5YChDwDXz8taSyLT+YuVrM48k0MqfpcyRDr0oNmqYLnqP32/ bdsjTZMimIT1AGxLbKLfK+ZwPPntd/e60jOiTtXUOJs8McLFOwdZ5ePp1lk0G0l2XK 7YoiB+BS5ab5g== Date: Fri, 10 Sep 2021 16:14:59 -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" Subject: Re: [PATCH 04/12] swiotlb-xen: ensure to issue well-formed XENMEM_exchange requests In-Reply-To: <397bf325-f81e-e104-6142-e8c9c4955475@suse.com> Message-ID: References: <588b3e6d-2682-160c-468e-44ca4867a570@suse.com> <397bf325-f81e-e104-6142-e8c9c4955475@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 Tue, 7 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. > > Signed-off-by: Jan Beulich > --- > I wonder how useful it is to include the alignment in the panic() > message. Not very useful given that it is static. I don't mind either way but you can go ahead and remove it if you prefer (and it would make the line shorter.) > I further wonder 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"). This one I would keep, to make sure to print out the same amount passed to memblock_alloc. > --- a/drivers/xen/swiotlb-xen.c > +++ b/drivers/xen/swiotlb-xen.c > @@ -231,10 +231,10 @@ 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 align=%#x\n", > + __func__, PAGE_ALIGN(bytes), IO_TLB_SEGSIZE << IO_TLB_SHIFT); > > /* > * And replace that memory with pages under 4GB. >