From nobody Wed Nov 27 09:56:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1699347589; cv=none; d=zohomail.com; s=zohoarc; b=a0TMHAcTvPAiNJwhBbTXBspmQdfMOg4tAXckxMkjRuGcRAQVBNrcx3yaSGvUBxyMPAS12gTb5Wgfq/5LngfoHHhGtr8d4R9+CKUDUNo7ScSmF+TDsSBb2e/y3iVc+2V7Ym2ezPAdANEmYwvE+HCwomN3Nhc+cBwP8Ts47++WZs4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699347589; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RbU2AhEIYoSsIpzzSHTfw0S8X3Bh//VFQqxawl/4l4k=; b=N+fBsgGnDyCZQ106UlJYl8dj80DVqeTBUstA2SSW/H4FMwt+3h68SmfTnbuKAMBuZ+O7TEQtHbf8wRp329p6GMUPwVRdYtuTQ94GLcl2Ua3c/Sju0VcIsZNnNeCHfFhsyVkCUyAb3Ok7HW7loxBZrHQaCIojYOv2iQ6xjyQ+440= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1699347589654941.3628966573629; Tue, 7 Nov 2023 00:59:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0HvX-0001Of-RN; Tue, 07 Nov 2023 03:59:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0HvU-0001Eh-PU; Tue, 07 Nov 2023 03:59:13 -0500 Received: from forwardcorp1c.mail.yandex.net ([2a02:6b8:c03:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0HvS-0004mZ-OQ; Tue, 07 Nov 2023 03:59:12 -0500 Received: from mail-nwsmtp-smtp-corp-main-44.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-44.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:1bac:0:640:75a2:0]) by forwardcorp1c.mail.yandex.net (Yandex) with ESMTP id 3E40F6269C; Tue, 7 Nov 2023 11:59:03 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b676::1:19]) by mail-nwsmtp-smtp-corp-main-44.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id jwXmps4OkmI0-OLoDqTK4; Tue, 07 Nov 2023 11:59:02 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1699347542; bh=RbU2AhEIYoSsIpzzSHTfw0S8X3Bh//VFQqxawl/4l4k=; h=Message-Id:Date:Cc:Subject:To:From; b=fO2lUEM4EqxG6yPy3BRVSdlIJW5cbGGEwqQoeZKm8zpbqRhbqN8Ig+NbbsQ41PHfK cNWYYx96OUfCUGPzGj4MG2IrKjTj+fKpE7BzBYu3lv6Ho3tYFMeC9zmkNQWPqEcfK1 mQ7YasXU803yyCfFEiNncUQCCw5RCpKG6lR1Jg4s= Authentication-Results: mail-nwsmtp-smtp-corp-main-44.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: dave@treblig.org, armbru@redhat.com, vsementsov@yandex-team.ru, yc-core@yandex-team.ru, zeil@yandex-team.ru, xeor@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com, qemu-block@nongnu.org Subject: [PATCH] block-backend: per-device throttling of BLOCK_IO_ERROR reports Date: Tue, 7 Nov 2023 11:58:42 +0300 Message-Id: <20231107085842.602188-1-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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=2a02:6b8:c03:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1c.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1699347590970100001 Content-Type: text/plain; charset="utf-8" From: Leonid Kaplan BLOCK_IO_ERROR events comes from guest, so we must throttle them. We still want per-device throttling, so let's use device id as a key. Signed-off-by: Leonid Kaplan Signed-off-by: Vladimir Sementsov-Ogievskiy --- monitor/monitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/monitor/monitor.c b/monitor/monitor.c index 01ede1babd..ad0243e9d7 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -309,6 +309,7 @@ int error_printf_unless_qmp(const char *fmt, ...) static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] =3D { /* Limit guest-triggerable events to 1 per second */ [QAPI_EVENT_RTC_CHANGE] =3D { 1000 * SCALE_MS }, + [QAPI_EVENT_BLOCK_IO_ERROR] =3D { 1000 * SCALE_MS }, [QAPI_EVENT_WATCHDOG] =3D { 1000 * SCALE_MS }, [QAPI_EVENT_BALLOON_CHANGE] =3D { 1000 * SCALE_MS }, [QAPI_EVENT_QUORUM_REPORT_BAD] =3D { 1000 * SCALE_MS }, @@ -498,6 +499,10 @@ static unsigned int qapi_event_throttle_hash(const voi= d *key) hash +=3D g_str_hash(qdict_get_str(evstate->data, "qom-path")); } =20 + if (evstate->event =3D=3D QAPI_EVENT_BLOCK_IO_ERROR) { + hash +=3D g_str_hash(qdict_get_str(evstate->data, "device")); + } + return hash; } =20 @@ -525,6 +530,11 @@ static gboolean qapi_event_throttle_equal(const void *= a, const void *b) qdict_get_str(evb->data, "qom-path")); } =20 + if (eva->event =3D=3D QAPI_EVENT_BLOCK_IO_ERROR) { + return !strcmp(qdict_get_str(eva->data, "device"), + qdict_get_str(evb->data, "device")); + } + return TRUE; } =20 --=20 2.34.1