From patchwork Thu Jul 28 08:08:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 9250851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A39660757 for ; Thu, 28 Jul 2016 08:13:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E50A1FFB9 for ; Thu, 28 Jul 2016 08:13:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4317426253; Thu, 28 Jul 2016 08:13:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D4D5A1FFB9 for ; Thu, 28 Jul 2016 08:13:35 +0000 (UTC) Received: from localhost ([::1]:51589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSgRi-0000k8-Tn for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Jul 2016 04:13:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSgMw-00059i-02 for qemu-devel@nongnu.org; Thu, 28 Jul 2016 04:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSgMs-0006t4-6S for qemu-devel@nongnu.org; Thu, 28 Jul 2016 04:08:36 -0400 Received: from smtp3.mundo-r.com ([212.51.32.191]:36773 helo=smtp4.mundo-r.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSgMr-0006sq-V2; Thu, 28 Jul 2016 04:08:34 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BsAgD8vJlX/5tjdVtdHAEBgydWfI0rlkgBAQEBAQUBgQ+RVoIPgX0khXkCgTY4FAEBAQEBAQFdJ4RdAgQnUhA/EjwbGYg1AQm7bAEBCCIFhWKCSIdZhQ8FjweKK4YYiGWPP5AmHjaCRYE4awGIdgEBAQ X-IPAS-Result: A2BsAgD8vJlX/5tjdVtdHAEBgydWfI0rlkgBAQEBAQUBgQ+RVoIPgX0khXkCgTY4FAEBAQEBAQFdJ4RdAgQnUhA/EjwbGYg1AQm7bAEBCCIFhWKCSIdZhQ8FjweKK4YYiGWPP5AmHjaCRYE4awGIdgEBAQ X-IronPort-AV: E=Sophos;i="5.28,433,1464645600"; d="scan'208";a="156419989" Received: from fanzine.igalia.com ([91.117.99.155]) by smtp4.mundo-r.com with ESMTP; 28 Jul 2016 10:08:30 +0200 Received: from a88-114-146-42.elisa-laajakaista.fi ([88.114.146.42] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim) id 1bSgMn-0005IV-P4; Thu, 28 Jul 2016 10:08:30 +0200 Received: from berto by perseus.local with local (Exim 4.87) (envelope-from ) id 1bSgMa-0000tp-CM; Thu, 28 Jul 2016 11:08:16 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 28 Jul 2016 11:08:12 +0300 Message-Id: <663d5aca406060e31f80d8113f77b6feee63b919.1469693110.git.berto@igalia.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.51.32.191 Subject: [Qemu-devel] [PATCH for-2.7 v2 1/2] throttle: Don't allow burst limits to be lower than the normal limits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gu Nini , Stefan Hajnoczi , qemu-block@nongnu.org, Alberto Garcia Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Setting FOO_max to a value that is lower than FOO does not make sense, and it produces odd results depending on the value of FOO_max_length. Although the user should not set that configuration in the first place it's better to reject it explicitly. https://bugzilla.redhat.com/show_bug.cgi?id=1355665 Signed-off-by: Alberto Garcia Reported-by: Gu Nini --- util/throttle.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/throttle.c b/util/throttle.c index 654f95c..3817d9b 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -348,6 +348,11 @@ bool throttle_is_valid(ThrottleConfig *cfg, Error **errp) " bps/iops values"); return false; } + + if (cfg->buckets[i].max && cfg->buckets[i].max < cfg->buckets[i].avg) { + error_setg(errp, "bps_max/iops_max cannot be lower than bps/iops"); + return false; + } } return true;