From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: Re: [PATCH] virtio: Define and use per-architecture "pfn shift" constants Date: Thu, 06 Nov 2008 09:50:26 -0600 Message-ID: <1225986626.8620.28.camel@localhost.localdomain> References: <1225968591.7284.9.camel@blaa> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: rusty@rustcorp.com.au, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm-ia64@vger.kernel.org To: Mark McLoughlin Return-path: Received: from e32.co.us.ibm.com ([32.97.110.150]:36214 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753134AbYKFPvF (ORCPT ); Thu, 6 Nov 2008 10:51:05 -0500 In-Reply-To: <1225968591.7284.9.camel@blaa> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2008-11-06 at 10:49 +0000, Mark McLoughlin wrote: > On Wed, 2008-11-05 at 22:49 -0600, Hollis Blanchard wrote: > > > - info->queue = kzalloc(PAGE_ALIGN(vring_size(num,PAGE_SIZE)), GFP_KERNEL); > > + vring_bytes = PAGE_ALIGN(vring_size(num, VRING_PAGE_SIZE)); > > + info->queue = kzalloc(vring_bytes, GFP_KERNEL); > > You're still aligning the size to PAGE_SIZE rather than VRING_PAGE_SIZE? The original code was calling kzalloc with a multiple of PAGE_SIZE, so I kept that behavior here... > But actually, why do we align the size anyway? I assume it's so that the last page in the ring (containing the "used" fields) could be safely mapped into another guest's address space, without fear of exposing other data. I don't know how valuable that is, but that's not really my concern so I preserved the behavior. > Also might make sense for vring_init() and vring_size() not to take a > pagesize argument and hard-code them to use VRING_PAGE_SIZE. I think that's a good idea. Anthony mentioned earlier the code was done this way so it could be copied to userspace, where PAGE_SIZE is unavailable, but that isn't an issue if we switch to VRING_PAGE_SIZE. -- Hollis Blanchard IBM Linux Technology Center