From patchwork Mon Sep 16 08:54:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 828996 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:4187:b0:367:895a:4699 with SMTP id ei7csp682119wrb; Mon, 16 Sep 2024 01:58:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX7sqJHMMic3Fr5Dd86srLcCoSKSC4IdvcsTdfxAdDKFCSVazApqRN3KhpeeBLFg+Kzpkrtiw==@linaro.org X-Google-Smtp-Source: AGHT+IFG97yUs0QSNW9RO7qknkh85NnHn7QH274ZI82vvTnxfuBtvxZdyujic9g/rajfNTuxX/3Q X-Received: by 2002:a05:622a:d2:b0:458:5011:666c with SMTP id d75a77b69052e-4599d219fdcmr158802341cf.4.1726477088854; Mon, 16 Sep 2024 01:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726477088; cv=none; d=google.com; s=arc-20240605; b=PzG3tQz2i6CgXGKY/2+3NPlkpYAwMsQXBWv/wSd+jXLEGArdatCj99bfiKTl1H6MY+ dw17PSezjolhE+ARXcjB6jJsBb71urze6ukPn9DJ69Ya6PEV+D2OqBOh8OWS1co7IUmb MG85+cYhI06/7Sy3wK+MK5KQt5Wo/HFf8cHzPuX54kCygqZfFq/I4is0Ge22qcNwYXqO HPBXh3EaAkWNV19whmzlQA3fpdkQrirjklJb/K2XHcejeCR9czkafw5e0I5aYcQRkKW/ rikbfY8Gmh8xLwnA/s856C7Rttx2cfDHU8ne2Rw1vWP6H+N7yeyg5CjNiYZnXWwmQ9D8 7bUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WWhpWDyIZgZQNjk9OdCuUgywH4MF2qEBFr+67oTYvJA=; fh=EUSMNgYjwj4GGVay3LBMQ2Gpqe70dd1O82wcFkfan2U=; b=KK9cZDuX3rIhMcxMhdXXDzgyCGTMxzkb+pjEb9mXqZZn+j+lkBxIknabdDFmb6YGvo 1wyIsJcDlyCsivwj4BE3uX9GXH4dQZ0EAxBNjtksTkG2K2LkUfxysNBSdcIaDRTiZFVX Er7Yht9EbXH9YVVXsCNBpb5H8s7j2ENsIcC8iG34J+bklkqq0SPm40U9BqbOjKHuqJRe 1/rBHaN5bwLg2RHtWOEIA9vQ9aSwENZLhEUyQ3lIL8L5QJiPd3aT6Gr6yDv3w9w8iNE0 Z2sCgkBEalJurilXxcUg6QZmXj74DtN3pwqTOIlxgDpzsZ5epIdYffsSs1fpablx917m VlgQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DmMnDlOL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-459aad0ef1asi55262371cf.337.2024.09.16.01.58.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Sep 2024 01:58:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DmMnDlOL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sq7VZ-0001of-8c; Mon, 16 Sep 2024 04:54:57 -0400 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 1sq7VD-0000ps-LQ for qemu-devel@nongnu.org; Mon, 16 Sep 2024 04:54:35 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sq7Uu-0005F7-GF for qemu-devel@nongnu.org; Mon, 16 Sep 2024 04:54:35 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42cb6f3a5bcso39669845e9.2 for ; Mon, 16 Sep 2024 01:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726476855; x=1727081655; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WWhpWDyIZgZQNjk9OdCuUgywH4MF2qEBFr+67oTYvJA=; b=DmMnDlOL3I0RX9ozBGc/MI6CrqvDC/IoEUA+2p9DIMNQDBZ3nKChnWdVtdXbX9ArbC C13UsPs38xYYVQEzYfQwBKH0DM9eD2tEIOsOlfurpyjpd4AyhLgRAZbAkcQVjPIv9WN/ PDTGDHI4A1pouRYHgD+5DgRwyKQjixzgJDBqMBpww5dsagPmRXqEFAK/JZ3ocTEVMM0Q ROYufXHg/9S5kv6pJwJC1pVQt2FPdmYfFTzl2Pxhe5tGlQH845gpnXIBcFrlW9HY91Ne uowSyhA1Kg0q/fIehbTDfRAS1+VBytbuaXAg9QqlIyovnftVyMjmorZ6zYjFKY3Lwbzl Tggw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726476855; x=1727081655; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WWhpWDyIZgZQNjk9OdCuUgywH4MF2qEBFr+67oTYvJA=; b=o5JTCuzqZ5B9L5mV6dYfdn+p+ZHrU8afIx//qXpf5b/zElDjcMChuUG29mJghyxTsr GM4OmxSupmM/V2O7CsGCPdsWfdRCAnGR0ngsoVIDgHc0/yPbhJVuQZKaiUWVOHJWlOzs emfP1iiYeAGGszLa3brnHoHDwToEAckP0NnVY1eTm4BBLzCDpNqo318W12oJEV3xP2dU INV/XKWXUGvoAI3Vffgt3BhXP7XdORORHpaePnhe0CJ1Df1DNy10a20GrlIXGt1snDLq mUw2OjqE+5+u/+6fEi5T2ROFFmyPyMmmZ8s514Hda7dzC7znZX7c6xGXupH08eCC4pVP czoA== X-Gm-Message-State: AOJu0YyLp5Vt0F8U4Kh/W2FNVec64lIH4G5oRK2V+9adLUekwKapT2KA fwf3VR3CMNwviH2J1PGVORk/TCvDmT/BKpxcOg4Qrg91JyUYqkmOJ6on4SLNjFk= X-Received: by 2002:a05:600c:4f01:b0:42c:aeaa:6b0d with SMTP id 5b1f17b1804b1-42d907205a5mr105040045e9.9.1726476855029; Mon, 16 Sep 2024 01:54:15 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42d9b05da47sm106194315e9.17.2024.09.16.01.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 01:54:10 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 124CA5F8F2; Mon, 16 Sep 2024 09:54:02 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Thomas Huth , Richard Henderson , qemu-ppc@nongnu.org, Ilya Leoshkevich , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , Alexandre Iooss , Eduardo Habkost , Daniel Henrique Barboza , Yanan Wang , Nicholas Piggin , David Hildenbrand , devel@lists.libvirt.org, Mahmoud Mandour , Zhao Liu , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Elisha Hollander Subject: [PATCH v2 18/18] contrib/plugins: avoid hanging program Date: Mon, 16 Sep 2024 09:54:00 +0100 Message-Id: <20240916085400.1046925-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20240916085400.1046925-1-alex.bennee@linaro.org> References: <20240916085400.1046925-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 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 Although we asks for instructions per second we work in quanta and that cannot be 0. Fail to load the plugin instead and report the minimum IPS we can handle. Signed-off-by: Alex Bennée Reported-by: Elisha Hollander Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- contrib/plugins/ips.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/plugins/ips.c b/contrib/plugins/ips.c index 29fa556d0f..6f078689dc 100644 --- a/contrib/plugins/ips.c +++ b/contrib/plugins/ips.c @@ -152,6 +152,11 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, vcpus = qemu_plugin_scoreboard_new(sizeof(vCPUTime)); max_insn_per_quantum = max_insn_per_second / NUM_TIME_UPDATE_PER_SEC; + if (max_insn_per_quantum == 0) { + fprintf(stderr, "minimum of %d instructions per second needed\n", NUM_TIME_UPDATE_PER_SEC); + return -1; + } + time_handle = qemu_plugin_request_time_control(); g_assert(time_handle);