From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TumbJ-0007YE-Id for qemu-devel@nongnu.org; Mon, 14 Jan 2013 11:09:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TumbC-0005bR-IT for qemu-devel@nongnu.org; Mon, 14 Jan 2013 11:09:29 -0500 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:50256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TumbC-0005aS-AL for qemu-devel@nongnu.org; Mon, 14 Jan 2013 11:09:22 -0500 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 Jan 2013 16:08:05 -0000 Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0EG92j535061770 for ; Mon, 14 Jan 2013 16:09:02 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost.localdomain [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0EG9AaF032662 for ; Mon, 14 Jan 2013 09:09:10 -0700 Message-ID: <50F42DA5.4010509@linux.vnet.ibm.com> Date: Mon, 14 Jan 2013 17:09:09 +0100 From: Einar Lueck MIME-Version: 1.0 References: <1357923660-35202-1-git-send-email-elelueck@linux.vnet.ibm.com> <1357923660-35202-2-git-send-email-elelueck@linux.vnet.ibm.com> <878v7v290x.fsf@blackfin.pond.sub.org> In-Reply-To: <878v7v290x.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2] hd-geometry.c: Integrate HDIO_GETGEO in guessing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com, agraf@suse.de, qemu-devel@nongnu.org, Christian Borntraeger , Jens Freimann , cornelia.huck@de.ibm.com, pbonzini@redhat.com On 01/14/2013 02:23 PM, Markus Armbruster wrote: > Einar Lueck writes: > >> This patch extends the function hd_geometry_guess. If no geo could >> be guessed via guess_disk_lchs, a new function called guess_disk_pchs is >> called. The latter utilizes HDIO_GET_GEO ioctl to ask the underlying disk >> for geometry. >> If this is not successful (e.g. image files) geometry is derived >> from the size of the disk (as before). >> The new HDIO_GETGEO logic is required for two use cases: >> a) Support for geometries of Direct Attached Storage Disks (DASD) >> on s390x configured as backing of virtio block devices. >> b) Support for FCP attached SCSI disks that do not yet have a >> partition table. Without this patch, fdisk -l on the host would >> return different results then fdisk -l in the guest. > > I'm afraid this could mess up existing, working disks. > > Consider a disk where guess_disk_lchs() fails and HDIO_GETGEO succeeds. > > The old code arbitrarily picks a "standard" physical geometry then. > > Your code picks the one returned by HDIO_GETGEO. > > Unless the two geometries happen to lead to a compatible address > translation, any guest that actually uses the translation now sees > different disk contents, with predictably bad results. > > Can this happen? If no, why not? > You are right. There may be such cases. Thus, I see two options: a) making this code portion platform specific (s390x) b) introduction of a a command line option to force reconsideration of HDIO_GETGEO My impression is, that the value of b) is limited to s390x and therefore a) is the way to go. Regards, Einar.