From nobody Sun May 19 03:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618495312; cv=none; d=zohomail.com; s=zohoarc; b=ap52MraVhvXFcQjCI9CZUhhrFuQPEIEmP193UUZ60q6Vx5hwHa3Pn4Ulxd6EZTIkwgPSyH6H9hp4G+KRmyl4c+RMQYzwHEzozgk39pibBw0sBVmqUcmr/86UYchdGoh3OahtKKVrBPkH2XL1gT2TVX42ha+H7EVbWphrUOkww5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618495312; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LWl1z60kASrrjV8abgZcQ6LpqRXRU0z0fmYz7/lqzJ0=; b=nvRVu2ZRQUjnEa+p50dmyK3lcvnBjtINB81fXZSf8dA1mA68jLlFHg/4lsq9rjlEWRm+LxJk0TerpbJGlUtQWg6Max7eA/vyvU0GS/N0uVxCNz5XOA1hBnKza33Ai+WFM7IBrv1V8YX3kPXzP2rft3KtmapCEPWQyc40HTvnbCQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618495312586702.0196279359678; Thu, 15 Apr 2021 07:01:52 -0700 (PDT) Received: from localhost ([::1]:47356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lX2Z3-0006gU-Dd for importer@patchew.org; Thu, 15 Apr 2021 10:01:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2WR-0005F9-Nd for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2WP-00020h-Ba for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:07 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-WzaEVOQ-MDajBBLQT6J62Q-1; Thu, 15 Apr 2021 09:59:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C329817473; Thu, 15 Apr 2021 13:59:01 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-159.ams2.redhat.com [10.36.115.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 465116A032; Thu, 15 Apr 2021 13:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618495144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LWl1z60kASrrjV8abgZcQ6LpqRXRU0z0fmYz7/lqzJ0=; b=CDpaPEeB3I9EkrahhHJL8ZQ0E6PHEYZGFsCxVrMN9U9afTQ2QaaJrqTvy0SCSJK59+nAKV aiTAgjbLR2WleClqK6hV6j4kAXHMpkPRJPH7Jq6o/nNhognH5fe6ccOWNCSf3+EezYGCBt kazYzVuiO2D0GmlIcs5wuPyTtO1hQno= X-MC-Unique: WzaEVOQ-MDajBBLQT6J62Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/5] migration: add trace point when vm_stop_force_state fails Date: Thu, 15 Apr 2021 14:58:47 +0100 Message-Id: <20210415135851.862406-2-berrange@redhat.com> In-Reply-To: <20210415135851.862406-1-berrange@redhat.com> References: <20210415135851.862406-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, Juan Quintela , Richard Henderson , "Dr. David Alan Gilbert" , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This is a critical failure scenario for migration that is hard to diagnose from existing probes. Most likely it is caused by an error from bdrv_flush(), but we're not logging the errno anywhere, hence this new probe. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Connor Kuehl Reviewed-by: Dr. David Alan Gilbert --- migration/migration.c | 1 + migration/trace-events | 1 + 2 files changed, 2 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 8ca034136b..bee0dcd501 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3121,6 +3121,7 @@ static void migration_completion(MigrationState *s) if (!ret) { bool inactivate =3D !migrate_colo_enabled(); ret =3D vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); + trace_migration_completion_vm_stop(ret); if (ret >=3D 0) { ret =3D migration_maybe_pause(s, ¤t_active_state, MIGRATION_STATUS_DEVICE); diff --git a/migration/trace-events b/migration/trace-events index 668c562fed..8ec28432eb 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -149,6 +149,7 @@ migrate_pending(uint64_t size, uint64_t max, uint64_t p= re, uint64_t compat, uint migrate_send_rp_message(int msg_type, uint16_t len) "%d: len %d" migrate_send_rp_recv_bitmap(char *name, int64_t size) "block '%s' size 0x%= "PRIi64 migration_completion_file_err(void) "" +migration_completion_vm_stop(int ret) "ret %d" migration_completion_postcopy_end(void) "" migration_completion_postcopy_end_after_complete(void) "" migration_rate_limit_pre(int ms) "%d ms" --=20 2.30.2 From nobody Sun May 19 03:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618495613; cv=none; d=zohomail.com; s=zohoarc; b=jtJrN5I9vKNf+Mns78fSYgmrL6vbcyS84L6e9VD4LIdqTav4nvn+KBrrIPfFB6n1ruHTL38ZznfHBzho2mTouubsrRSDQi/BjVIe0V2Yway7UGg+EOIkNtDuD8Opc67STdsKEUSVDfcdjo++FS7J6sAJm3/OMvoS1NjzLowwNnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618495613; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gOjm/lrrp+5iRv6wLwsDJOt1LxSOxZjY9L6noJbDg7k=; b=BRs6bLg/BKIy5SSI2B1Ayhh+EtTp/MWEvrA4ywDlWsTnGkRSRhFq+j1OqhBS3w1q4bWc58CnarbjNi2C/330ajrRpmHquAL0ETYTzDWjTCuF0YVQM66uQGm4ZJp6tQKwQYkA3kNMASMIm69GPUg+9+1VjuV+NXIjO79oAQYCy2o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618495613968608.4397458670604; Thu, 15 Apr 2021 07:06:53 -0700 (PDT) Received: from localhost ([::1]:33014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lX2dx-0004HH-8M for importer@patchew.org; Thu, 15 Apr 2021 10:06:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2WT-0005IC-6L for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:44300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2WR-00022U-Ik for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:08 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-458-AB-zlDMPPEKJIYBVjfIRkw-1; Thu, 15 Apr 2021 09:59:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39B43107ACCA; Thu, 15 Apr 2021 13:59:04 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-159.ams2.redhat.com [10.36.115.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA8AB6A97C; Thu, 15 Apr 2021 13:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618495146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gOjm/lrrp+5iRv6wLwsDJOt1LxSOxZjY9L6noJbDg7k=; b=daeX9C8juHNGjz0Z1oFkU8syYfq7/VSwNr4ZYEYIxGJ26MgReCddZRJ6P5ruu1ufAvrgjJ +IKHsgX+9jiGeDgqtZFfzcbH12EffyBzC/F8OB80VMCBLSWVs06r4G/vZRBRDUIOiYmYyQ 9lFavrepnqzgu+o4ySV/cjSOEz1jPcM= X-MC-Unique: AB-zlDMPPEKJIYBVjfIRkw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/5] softmmu: add trace point when bdrv_flush_all fails Date: Thu, 15 Apr 2021 14:58:48 +0100 Message-Id: <20210415135851.862406-3-berrange@redhat.com> In-Reply-To: <20210415135851.862406-1-berrange@redhat.com> References: <20210415135851.862406-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, Juan Quintela , Richard Henderson , "Dr. David Alan Gilbert" , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The VM stop process has to flush outstanding I/O and this is a critical failure scenario that is hard to diagnose. Add a probe point that records the flush return code. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Connor Kuehl Reviewed-by: Dr. David Alan Gilbert --- softmmu/cpus.c | 7 ++++++- softmmu/trace-events | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/softmmu/cpus.c b/softmmu/cpus.c index a7ee431187..c3caaeb26e 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -44,6 +44,7 @@ #include "sysemu/whpx.h" #include "hw/boards.h" #include "hw/hw.h" +#include "trace.h" =20 #ifdef CONFIG_LINUX =20 @@ -266,6 +267,7 @@ static int do_vm_stop(RunState state, bool send_stop) =20 bdrv_drain_all(); ret =3D bdrv_flush_all(); + trace_vm_stop_flush_all(ret); =20 return ret; } @@ -704,12 +706,15 @@ int vm_stop_force_state(RunState state) if (runstate_is_running()) { return vm_stop(state); } else { + int ret; runstate_set(state); =20 bdrv_drain_all(); /* Make sure to return an error if the flush in a previous vm_stop= () * failed. */ - return bdrv_flush_all(); + ret =3D bdrv_flush_all(); + trace_vm_stop_flush_all(ret); + return ret; } } =20 diff --git a/softmmu/trace-events b/softmmu/trace-events index b80ca042e1..f11b427544 100644 --- a/softmmu/trace-events +++ b/softmmu/trace-events @@ -19,6 +19,9 @@ flatview_new(void *view, void *root) "%p (root %p)" flatview_destroy(void *view, void *root) "%p (root %p)" flatview_destroy_rcu(void *view, void *root) "%p (root %p)" =20 +# softmmu.c +vm_stop_flush_all(int ret) "ret %d" + # vl.c vm_state_notify(int running, int reason, const char *reason_str) "running = %d reason %d (%s)" load_file(const char *name, const char *path) "name %s location %s" --=20 2.30.2 From nobody Sun May 19 03:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618495448; cv=none; d=zohomail.com; s=zohoarc; b=kUx0N5papoZxwLU4dwZ8xrTXnlnuCwDQYnAmBGCiczMTls7bMkcOW7vssX+4d9NmpjvgzMmbtzeeOeFSDPAjHTO/rebO7muHAjfXTPhAmjRG33SeL1/HWrD+4jc1fsNjZdl9Rel3yUvd8dfH/9qo0besFe06mHoBNH4DETWjQBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618495448; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TFzRBkY+DSgenbNBn3jkrOtWXzY0sNDIyTzKb8fUwiE=; b=H2yexbYLJ3QpAissNfRrHZiNzm7GunRp0HvTAc4jcY0dTgpZj89mlPR7gLw3LdRlJA5AgPfl68OMRNtknveme4TK47AoCFlIlCB1yy7Pkjo0lag6hD4K1zQetW79I2jqNrkKZ47K5C8Pyebe6gA5nvUf75nWDsxwcJT2yR/fPGY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618495448400945.5703524254914; Thu, 15 Apr 2021 07:04:08 -0700 (PDT) Received: from localhost ([::1]:55718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lX2bH-0001qh-KR for importer@patchew.org; Thu, 15 Apr 2021 10:04:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2Wa-0005Uu-7N for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36463) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2WX-00026R-KT for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-240-gwk9P3JaNOGJchgLUBlV3w-1; Thu, 15 Apr 2021 09:59:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 304AB107ACE4; Thu, 15 Apr 2021 13:59:10 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-159.ams2.redhat.com [10.36.115.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83DFB6BF6B; Thu, 15 Apr 2021 13:59:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618495152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TFzRBkY+DSgenbNBn3jkrOtWXzY0sNDIyTzKb8fUwiE=; b=Kg7ZYmUIOtCYAMxN/0Ks7yhs8edpSXfIlwDbzWXlH8tO193C0W5+fG+5fHmUdg2FL3Sg6e ZqUQ5hiRv5IBz0B/JabHPDf7A5Kx7hAY4pA4BWhuG+xBHF8o0AJeFk7qkr5bBop1FBzF4Z ZmOwWHoaoLUUKn2qvgpN0afr66Yg81k= X-MC-Unique: gwk9P3JaNOGJchgLUBlV3w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 3/5] block: preserve errno from fdatasync failures Date: Thu, 15 Apr 2021 14:58:49 +0100 Message-Id: <20210415135851.862406-4-berrange@redhat.com> In-Reply-To: <20210415135851.862406-1-berrange@redhat.com> References: <20210415135851.862406-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, Juan Quintela , Richard Henderson , "Dr. David Alan Gilbert" , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When fdatasync() fails on a file backend we set a flag that short-circuits any future attempts to call fdatasync(). The first failure returns the true errno, but the later short- circuited calls return a generic EIO. The latter is unhelpful because fdatasync() can return a variety of errnos, including EACCESS. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Connor Kuehl --- block/file-posix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 20e14f8e96..99cf452f84 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -160,7 +160,7 @@ typedef struct BDRVRawState { bool discard_zeroes:1; bool use_linux_aio:1; bool use_linux_io_uring:1; - bool page_cache_inconsistent:1; + int page_cache_inconsistent; /* errno from fdatasync failure */ bool has_fallocate; bool needs_alignment; bool drop_cache; @@ -1357,7 +1357,7 @@ static int handle_aiocb_flush(void *opaque) int ret; =20 if (s->page_cache_inconsistent) { - return -EIO; + return -s->page_cache_inconsistent; } =20 ret =3D qemu_fdatasync(aiocb->aio_fildes); @@ -1376,7 +1376,7 @@ static int handle_aiocb_flush(void *opaque) * Obviously, this doesn't affect O_DIRECT, which bypasses the page * cache. */ if ((s->open_flags & O_DIRECT) =3D=3D 0) { - s->page_cache_inconsistent =3D true; + s->page_cache_inconsistent =3D errno; } return -errno; } --=20 2.30.2 From nobody Sun May 19 03:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618495322; cv=none; d=zohomail.com; s=zohoarc; b=GaQE86AjeQucE8mx4ABEfGiCpKS81nZylO5fFEm2mBsIG9VzYd7yrNH21pSHORwYYXBUcJhhcgAYc/a68WfFSvQB6OnwheIQfnbqOMrynWotObWAU1/58zRysezhjCXe/3UtVFUobR/d3UPfkmNtq1/fb0Dd+Z+v9J15w4LFsZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618495322; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=K0MmcAntTd5SbwkFZUh0401Z4Ui3UqiqHIykQtY6N3o=; b=B2P67NfSw0zpLW+U4VEc6nULjFwWEEVdu6z+m9zhu1xtCHKgCN8wqsmkrGSknRugIY2FeV0rqa2v1kh8AljZqpiET/hY/sE4V6th2+uzUAeAdnZDBt0dyJtErttJgxxr57UXyXEzMQtSc0EKGCpKKqEYU4DCD85tk2WVeOb3mRI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618495322266429.3467235464526; Thu, 15 Apr 2021 07:02:02 -0700 (PDT) Received: from localhost ([::1]:48122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lX2ZD-00077N-BN for importer@patchew.org; Thu, 15 Apr 2021 10:01:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2Wd-0005bl-Ew for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2Wb-000293-HG for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:19 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-21-lrIRfBsiPMqxn_KVfXSS0w-1; Thu, 15 Apr 2021 09:59:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B226D8189EC; Thu, 15 Apr 2021 13:59:12 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-159.ams2.redhat.com [10.36.115.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7843D60CC5; Thu, 15 Apr 2021 13:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618495156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K0MmcAntTd5SbwkFZUh0401Z4Ui3UqiqHIykQtY6N3o=; b=PEoMkOGKCx/ynlywyiDzIC1a2XmFg3QuShaiM5dqimWFM58BGdjXN6keDv63XNcLM1R2fn DRWvZcuhWCsgUbwW4IKDxuF3ZNDYoL015CKzFid5eoeLBu7Z/iUstjqosNvNJ7Hvvo87HB L+gJ1DU29ovWFonxHZ7lkbvpkD7o8mY= X-MC-Unique: lrIRfBsiPMqxn_KVfXSS0w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/5] block: add trace point when fdatasync fails Date: Thu, 15 Apr 2021 14:58:50 +0100 Message-Id: <20210415135851.862406-5-berrange@redhat.com> In-Reply-To: <20210415135851.862406-1-berrange@redhat.com> References: <20210415135851.862406-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, Juan Quintela , Richard Henderson , "Dr. David Alan Gilbert" , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) A flush failure is a critical failure scenario for some operations. For example, it will prevent migration from completing, as it will make vm_stop() report an error. Thus it is important to have a trace point present for debugging. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Connor Kuehl Reviewed-by: Dr. David Alan Gilbert --- block/file-posix.c | 2 ++ block/trace-events | 1 + 2 files changed, 3 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 99cf452f84..6aafeda44f 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1362,6 +1362,8 @@ static int handle_aiocb_flush(void *opaque) =20 ret =3D qemu_fdatasync(aiocb->aio_fildes); if (ret =3D=3D -1) { + trace_file_flush_fdatasync_failed(errno); + /* There is no clear definition of the semantics of a failing fsyn= c(), * so we may have to assume the worst. The sad truth is that this * assumption is correct for Linux. Some pages are now probably ma= rked diff --git a/block/trace-events b/block/trace-events index 1a12d634e2..c8a943e992 100644 --- a/block/trace-events +++ b/block/trace-events @@ -206,6 +206,7 @@ file_copy_file_range(void *bs, int src, int64_t src_off= , int dst, int64_t dst_of file_FindEjectableOpticalMedia(const char *media) "Matching using %s" file_setup_cdrom(const char *partition) "Using %s as optical disc" file_hdev_is_sg(int type, int version) "SG device found: type=3D%d, versio= n=3D%d" +file_flush_fdatasync_failed(int err) "errno %d" =20 # sheepdog.c sheepdog_reconnect_to_sdog(void) "Wait for connection to be established" --=20 2.30.2 From nobody Sun May 19 03:38:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618495433; cv=none; d=zohomail.com; s=zohoarc; b=dStUcK4vmTEG/hJREjvAO7AAVcqhifCJGUqW0LOaq13Q0e+e5wru60KiM0jgLiPORnWp3PCWmiN4F9w/OduLW7h5nPrgLbEHWp/IdW2mVk2tNg9pHMEFxO60rkszGLQdEhQcXNcX47Shp4wU7m6dkotLXOjKnuqFA7gcEBVlQb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618495433; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qkGNbszQq+DUotjTTTxJ6Bl/7irQWmRBwJ8hcfcFQ2Q=; b=fjAfWEtsewmN8Y/rhAceCgnPQHg0rzPFS7dB+iy5s17WYru2eZW2MYAwiUfwuZBMmY42cPCnSAyuQPdciF7VcWfF1iqzEE59eBrbNZub2SToXple/zIfYN5SDSSoV5sgnwSR4VY1X4+Ie0dExQOVpg8I0wf2gIwzsRs6Pqw7PAM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618495433957834.7287765606849; Thu, 15 Apr 2021 07:03:53 -0700 (PDT) Received: from localhost ([::1]:54712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lX2b2-0001Qk-Gy for importer@patchew.org; Thu, 15 Apr 2021 10:03:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2We-0005cj-1K for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX2Wc-0002BL-CD for qemu-devel@nongnu.org; Thu, 15 Apr 2021 09:59:19 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-Wzig5GqEMXmreu9B5FVllQ-1; Thu, 15 Apr 2021 09:59:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A0DD18B9F84; Thu, 15 Apr 2021 13:59:15 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-159.ams2.redhat.com [10.36.115.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 063E360CC5; Thu, 15 Apr 2021 13:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618495157; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qkGNbszQq+DUotjTTTxJ6Bl/7irQWmRBwJ8hcfcFQ2Q=; b=hzOciq+qh9ijJEn+qm6R1z2mx+2bS9Vmc1j+C0HVOEGXiIc+5HC5hgeDhry8RyK22uEvJk nLXBWV/PVkANmEmDFhDF7Vp42GOceuF+gtJde3uyRnyM4AOFmnlXMkLipFdLLk2sLGIpjW kHc+vKjJigTJpoBApgxE88QzO3RfNc0= X-MC-Unique: Wzig5GqEMXmreu9B5FVllQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 5/5] block: remove duplicate trace.h include Date: Thu, 15 Apr 2021 14:58:51 +0100 Message-Id: <20210415135851.862406-6-berrange@redhat.com> In-Reply-To: <20210415135851.862406-1-berrange@redhat.com> References: <20210415135851.862406-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, Juan Quintela , Richard Henderson , "Dr. David Alan Gilbert" , Max Reitz , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Connor Kuehl Reviewed-by: Dr. David Alan Gilbert --- block/file-posix.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 6aafeda44f..2538e43299 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -106,8 +106,6 @@ #include #endif =20 -#include "trace.h" - /* OS X does not have O_DSYNC */ #ifndef O_DSYNC #ifdef O_SYNC --=20 2.30.2