From nobody Tue Feb 10 02:54:42 2026 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1664292225; cv=none; d=zohomail.com; s=zohoarc; b=CIPgg9PpEEw+AKsItZFiRu5Ioa8CCz4lZRsWXZmX9gFjD4hg7tfz+umU0rKYr/OTddZk+32vtsjnGDhPGRSjOqBA5n9SHxJ1X7zLW1u1cBiwCAs1JwfGvC1CrpRZKdzj4K/n0RwI3dSosm4+yOaZs0W0NYCVjBjYqeAve6dvpVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664292225; 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=/vMReYXCUNDcbofY5nPdTks5rxY6D9/DKnA/gvCK44s=; b=IjmfLrWUL9IzKg4zY8zmeexb+bR0wGBcitiozurNhcMy+/fGntaMZoLHOBljF6V7EG0jut7GTl5fqtfCaA9rdzxYE4o8nNwkX92CLuHwvwWjK/g3gUtBNQXoztNuSABMUWRHhAyCNDLDeKTMv7la6iMu5n5KWU+MeN51KjNI514= 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 1664292225034815.5319555237865; Tue, 27 Sep 2022 08:23:45 -0700 (PDT) Received: from localhost ([::1]:36278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odCQx-0006rD-U1 for importer@patchew.org; Tue, 27 Sep 2022 11:23:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odAnI-0001AV-3t for qemu-devel@nongnu.org; Tue, 27 Sep 2022 09:38:41 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:55092) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odAnG-00088p-DC for qemu-devel@nongnu.org; Tue, 27 Sep 2022 09:38:39 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4B1081FCF5; Tue, 27 Sep 2022 13:38:37 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E5B00139BE; Tue, 27 Sep 2022 13:38:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QA+JNtz8MmNsKgAAMHmgww (envelope-from ); Tue, 27 Sep 2022 13:38:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1664285917; h=from:from:reply-to: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=/vMReYXCUNDcbofY5nPdTks5rxY6D9/DKnA/gvCK44s=; b=qRCVtZkiC7I0LABBfN5DKxCPjMNTlS0cxl5iKHuDLL+bGw1+ERFp/nPL6gzFI17JzdeQ+Y QQN7aaTtT/FoKcoDb0XO70RQr0GdGLu6dpzajVW342L+wO60l9RdZk9NWSxBknqmYrT52/ H9gth6TQBv05Y7ucWsSFDK88kxkXwaM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1664285917; h=from:from:reply-to: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=/vMReYXCUNDcbofY5nPdTks5rxY6D9/DKnA/gvCK44s=; b=BeLe1V+16F2+h5A/ur1jFEzmj+kOc2cAmTgeKnYO33vHV1ofAmBdf/z3s+P+mxXBlQ6CBf rmIZ0ZUrBYPI80Dg== From: Claudio Fontana To: Paolo Bonzini , Richard Henderson , Markus Armbruster , Kevin Wolf Cc: qemu-devel@nongnu.org, dinechin@redhat.com, Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Claudio Fontana Subject: [PATCH v7 5/5] accel: abort if we fail to load the accelerator plugin Date: Tue, 27 Sep 2022 15:38:25 +0200 Message-Id: <20220927133825.32631-6-cfontana@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220927133825.32631-1-cfontana@suse.de> References: <20220927133825.32631-1-cfontana@suse.de> MIME-Version: 1.0 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=195.135.220.29; envelope-from=cfontana@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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.29 Precedence: list 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" X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1664292225806100001 if QEMU is configured with modules enabled, it is possible that the load of an accelerator module will fail. Abort in this case, relying on module_object_class_by_name to report the specific load error if any. Signed-off-by: Claudio Fontana Reviewed-by: Richard Henderson [claudio: changed abort() to exit(1)] Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Markus Armbruster --- accel/accel-softmmu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/accel/accel-softmmu.c b/accel/accel-softmmu.c index 67276e4f52..f9cdafb148 100644 --- a/accel/accel-softmmu.c +++ b/accel/accel-softmmu.c @@ -66,6 +66,7 @@ void accel_init_ops_interfaces(AccelClass *ac) { const char *ac_name; char *ops_name; + ObjectClass *oc; AccelOpsClass *ops; =20 ac_name =3D object_class_get_name(OBJECT_CLASS(ac)); @@ -73,8 +74,13 @@ void accel_init_ops_interfaces(AccelClass *ac) =20 ops_name =3D g_strdup_printf("%s" ACCEL_OPS_SUFFIX, ac_name); ops =3D ACCEL_OPS_CLASS(module_object_class_by_name(ops_name)); + oc =3D module_object_class_by_name(ops_name); + if (!oc) { + error_report("fatal: could not load module for type '%s'", ops_nam= e); + exit(1); + } g_free(ops_name); - + ops =3D ACCEL_OPS_CLASS(oc); /* * all accelerators need to define ops, providing at least a mandatory * non-NULL create_vcpu_thread operation. --=20 2.26.2