From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cornelia Huck Subject: Re: [PATCH 1/4] s390/kvm: Handle hosts not supporting s390-virtio. Date: Fri, 10 Aug 2012 13:03:35 +0200 Message-ID: <20120810130335.514be8d1@BR9GNB5Z> References: <1344351168-2568-1-git-send-email-cornelia.huck@de.ibm.com> <1344351168-2568-2-git-send-email-cornelia.huck@de.ibm.com> <50238B0D.2060604@redhat.com> <20120809124157.582fd609@BR9GNB5Z> <20120810084248.GA3283@osiris.de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20120810084248.GA3283@osiris.de.ibm.com> Sender: kvm-owner@vger.kernel.org List-Archive: List-Post: To: Heiko Carstens Cc: Avi Kivity , KVM , linux-s390 , qemu-devel , Marcelo Tosatti , Anthony Liguori , Rusty Russell , Christian Borntraeger , Carsten Otte , Alexander Graf , Martin Schwidefsky , Sebastian Ott List-ID: On Fri, 10 Aug 2012 10:42:48 +0200 Heiko Carstens wrote: > On Thu, Aug 09, 2012 at 12:41:57PM +0200, Cornelia Huck wrote: > > On Thu, 09 Aug 2012 13:03:57 +0300 > > Avi Kivity wrote: > > > > > On 08/07/2012 05:52 PM, Cornelia Huck wrote: > > > > Running under a kvm host does not necessarily imply the presence of > > > > a page mapped above the main memory with the virtio information; > > > > however, the code includes a hard coded access to that page. > > > > > > > > Instead, check for the presence of the page and exit gracefully > > > > before we hit an addressing exception if it does not exist. > > > > > > > > /* > > > > * Init function for virtio > > > > * devices are in a single page above top of "normal" mem > > > > @@ -443,6 +458,12 @@ static int __init kvm_devices_init(void) > > > > } > > > > > > > > kvm_devices = (void *) real_memory_size; > > > > + if (test_devices_support() < 0) { > > > > + vmem_remove_mapping(real_memory_size, PAGE_SIZE); > > > > + root_device_unregister(kvm_root); > > > > + /* No error. */ > > > > + return 0; > > > > + } > > > > > > > > > > Cleaner to defer root_device_register() until after the mapping has been > > > verified. > > > > OK, will reorder. > > Please use the "lura" instruction to figure out if the guest real page > even exists _before_ creating the mapping. > That way you don't need all the code afterwards. New instruction of the day ;) Indeed, this makes the code look nicer. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szn0u-0007Ag-39 for qemu-devel@nongnu.org; Fri, 10 Aug 2012 07:05:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Szn0I-00024b-Ql for qemu-devel@nongnu.org; Fri, 10 Aug 2012 07:04:20 -0400 Received: from e06smtp18.uk.ibm.com ([195.75.94.114]:47488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Szn0I-00024C-HZ for qemu-devel@nongnu.org; Fri, 10 Aug 2012 07:03:42 -0400 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Aug 2012 12:03:40 +0100 Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7AB3VSm21823716 for ; Fri, 10 Aug 2012 11:03:31 GMT Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7AAdaC9030607 for ; Fri, 10 Aug 2012 06:39:36 -0400 Date: Fri, 10 Aug 2012 13:03:35 +0200 From: Cornelia Huck Message-ID: <20120810130335.514be8d1@BR9GNB5Z> In-Reply-To: <20120810084248.GA3283@osiris.de.ibm.com> References: <1344351168-2568-1-git-send-email-cornelia.huck@de.ibm.com> <1344351168-2568-2-git-send-email-cornelia.huck@de.ibm.com> <50238B0D.2060604@redhat.com> <20120809124157.582fd609@BR9GNB5Z> <20120810084248.GA3283@osiris.de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/4] s390/kvm: Handle hosts not supporting s390-virtio. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Heiko Carstens Cc: linux-s390 , Anthony Liguori , Rusty Russell , KVM , Carsten Otte , Marcelo Tosatti , Sebastian Ott , qemu-devel , Alexander Graf , Christian Borntraeger , Avi Kivity , Martin Schwidefsky On Fri, 10 Aug 2012 10:42:48 +0200 Heiko Carstens wrote: > On Thu, Aug 09, 2012 at 12:41:57PM +0200, Cornelia Huck wrote: > > On Thu, 09 Aug 2012 13:03:57 +0300 > > Avi Kivity wrote: > > > > > On 08/07/2012 05:52 PM, Cornelia Huck wrote: > > > > Running under a kvm host does not necessarily imply the presence of > > > > a page mapped above the main memory with the virtio information; > > > > however, the code includes a hard coded access to that page. > > > > > > > > Instead, check for the presence of the page and exit gracefully > > > > before we hit an addressing exception if it does not exist. > > > > > > > > /* > > > > * Init function for virtio > > > > * devices are in a single page above top of "normal" mem > > > > @@ -443,6 +458,12 @@ static int __init kvm_devices_init(void) > > > > } > > > > > > > > kvm_devices = (void *) real_memory_size; > > > > + if (test_devices_support() < 0) { > > > > + vmem_remove_mapping(real_memory_size, PAGE_SIZE); > > > > + root_device_unregister(kvm_root); > > > > + /* No error. */ > > > > + return 0; > > > > + } > > > > > > > > > > Cleaner to defer root_device_register() until after the mapping has been > > > verified. > > > > OK, will reorder. > > Please use the "lura" instruction to figure out if the guest real page > even exists _before_ creating the mapping. > That way you don't need all the code afterwards. New instruction of the day ;) Indeed, this makes the code look nicer.