From patchwork Mon Sep 29 13:56:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 38071 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9328F202DB for ; Mon, 29 Sep 2014 13:57:06 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e51sf578541eek.11 for ; Mon, 29 Sep 2014 06:57:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=0+NzjCgQb5iuQjyYLFk567KMTGqv1nEqApZAhFWgrb8=; b=gr8GOFm0IE19FcjMo2wcWzHWaY+6Hq2J3DEMNX8pOxXoHq9Z46moyvPt6UwK1IxOTW jY0TBssdbgK2MGymbjHNpLbBZ/Ma6/ZBESTscAkuRX7SmneXgsNdGxt0E4bPwenB4hpd E6FFqg3jxZQhZxI6GQilvclEJzZGmyzWmI2MZ9aOajPlQrynJTwLqIvsmkevVD+54wng 0I7fF6gaM11G5N6xMiU8A06vKztcbCTepa234Q3m+ru/iyDPTZoffjnHhkL6rwsZvSwZ SUvE2WW1DhtiIVM1ZiymXnckH8gp23+q2dnqOvu9JIyYWGbxDFPBy/xwWAKxyOYbDGvd Eazw== X-Gm-Message-State: ALoCoQlf6T99J09KFvxjX6GXc1aaGXFcWCnAnVLZ+9eO2mvykJIPaRolLwLSBjxESja6fYJYTVjR X-Received: by 10.112.198.226 with SMTP id jf2mr1586792lbc.1.1411999025423; Mon, 29 Sep 2014 06:57:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.74 with SMTP id r10ls653264lag.109.gmail; Mon, 29 Sep 2014 06:57:05 -0700 (PDT) X-Received: by 10.152.28.38 with SMTP id y6mr3825027lag.90.1411999025281; Mon, 29 Sep 2014 06:57:05 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id a4si18476698lbr.29.2014.09.29.06.57.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 29 Sep 2014 06:57:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id gb8so8513794lab.16 for ; Mon, 29 Sep 2014 06:57:05 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr37557377lbb.73.1411999025176; Mon, 29 Sep 2014 06:57:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp177522lbb; Mon, 29 Sep 2014 06:57:04 -0700 (PDT) X-Received: by 10.140.38.231 with SMTP id t94mr59778522qgt.3.1411999024170; Mon, 29 Sep 2014 06:57:04 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u3si13634015qcn.5.2014.09.29.06.57.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 29 Sep 2014 06:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:36890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYbRn-0000S4-82 for patch@linaro.org; Mon, 29 Sep 2014 09:57:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYbRG-00009B-Td for qemu-devel@nongnu.org; Mon, 29 Sep 2014 09:56:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYbRA-0000u1-MB for qemu-devel@nongnu.org; Mon, 29 Sep 2014 09:56:30 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:52827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYbRA-0000tB-FA for qemu-devel@nongnu.org; Mon, 29 Sep 2014 09:56:24 -0400 Received: by mail-lb0-f174.google.com with SMTP id l4so17745142lbv.5 for ; Mon, 29 Sep 2014 06:56:18 -0700 (PDT) X-Received: by 10.112.56.198 with SMTP id c6mr15999690lbq.43.1411998977891; Mon, 29 Sep 2014 06:56:17 -0700 (PDT) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id jp17sm4903538lab.18.2014.09.29.06.56.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Sep 2014 06:56:17 -0700 (PDT) From: Christoffer Dall To: qemu-devel@nongnu.org Date: Mon, 29 Sep 2014 15:56:49 +0200 Message-Id: <1411999009-25241-1-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.0.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.217.174 Cc: Christoffer Dall , Mario Smarduch Subject: [Qemu-devel] [PATCH] kvm: Fix error code check from kvm_vm_ioctl() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Currently kvm_physical_sync_dirty_bitmap() calls kvm_vm_ioctl() and checks if it returns -1. However, kvm_vm_ioctl() actually returns -errno, and not -1, so this check will fail and architectures not implementing this functionality in the kernel blindly attempt broken things like unimplemented dirty page logging for migration. This addresses bug https://bugs.launchpad.net/qemu/+bug/1294227. Cc: Mario Smarduch Signed-off-by: Christoffer Dall --- kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvm-all.c b/kvm-all.c index 4afcd05..ab57170 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -429,7 +429,7 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section) d.slot = mem->slot; - if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) { + if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) { DPRINTF("ioctl failed %d\n", errno); ret = -1; break;