From patchwork Mon Sep 27 14:11:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jose R. Ziviani" X-Patchwork-Id: 12520037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E103C433EF for ; Mon, 27 Sep 2021 14:14:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF76E61058 for ; Mon, 27 Sep 2021 14:14:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BF76E61058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:43158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUrOL-0005tS-NY for qemu-devel@archiver.kernel.org; Mon, 27 Sep 2021 10:14:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUrMl-0003RS-U1 for qemu-devel@nongnu.org; Mon, 27 Sep 2021 10:12:23 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:44498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mUrMe-0005j2-31 for qemu-devel@nongnu.org; Mon, 27 Sep 2021 10:12:23 -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-out1.suse.de (Postfix) with ESMTPS id 4A7E422144; Mon, 27 Sep 2021 14:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1632751933; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lg4W8BkcEmPnQTDfAPiydE+ZxIRBgqPGoyf3/PNOkNY=; b=oN+Us1MwEDUU3eYThJHt6nupX3WiG4P2693F5/OcoqgIuAC+D3446jH4r9IZh+QxFhQCJn wyazRppN8jW1gAxPOvSMHzfPwdNq9vtqWbWIOtNTPaEHThUCPBIwwVo7m5eLGvnu1C0Mo7 Ef2fkH9U2jCfR0v5+gxFEnmYsrDsmg8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1632751933; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lg4W8BkcEmPnQTDfAPiydE+ZxIRBgqPGoyf3/PNOkNY=; b=OEOKIjzG1t1CpOkZwXKgfGyEgD1Dy8v0W/fpBWPFRU0zPd1Um15EcbMhwv7ZhxPETFk7Fn kfOwQVRo+HVbuIBg== 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 CF22F13A91; Mon, 27 Sep 2021 14:12:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CBRWJDvRUWH+LwAAMHmgww (envelope-from ); Mon, 27 Sep 2021 14:12:11 +0000 From: "Jose R. Ziviani" To: qemu-devel@nongnu.org Subject: [PATCH v2 0/2] modules: Improve modinfo.c support Date: Mon, 27 Sep 2021 11:11:59 -0300 Message-Id: <20210927141201.21833-2-jziviani@suse.de> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210927141201.21833-1-jziviani@suse.de> References: <20210927141201.21833-1-jziviani@suse.de> MIME-Version: 1.0 Received-SPF: pass client-ip=195.135.220.28; envelope-from=jziviani@suse.de; helo=smtp-out1.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, kraxel@redhat.com, "Jose R. Ziviani" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patchset introduces the modinfo_need and changes modinfo-generate.py/meson.build to generate/link one modinfo per target. modinfo-generate.py will know, thanks to modinfo_need, which modules are currently enabled for a given target before adding it in the array of modules. It will give a hint about why some modules failed, so developers can have a clue about it: },{ /* hw-display-qxl.modinfo */ /* module QXL is missing. */ /* hw-display-virtio-gpu.modinfo */ .name = "hw-display-virtio-gpu", .objs = ((const char*[]){ "virtio-gpu-base", "virtio-gpu-device", "vhost-user-gpu", NULL }), },{ The main reason of this change is to fix problems like: $ ./qemu-system-s390x -nodefaults -display none -accel tcg -M none -device help | head Failed to open module: /.../hw-display-qxl.so: undefined symbol: vga_ioport_read Failed to open module: /.../hw-display-virtio-vga.so: undefined symbol: vmstate_vga_common Failed to open module: /.../hw-display-virtio-vga.so: undefined symbol: vmstate_vga_common Failed to open module: /.../hw-display-virtio-vga-gl.so: undefined symbol: have_vga Failed to open module: /.../hw-usb-smartcard.so: undefined symbol: ccid_card_ccid_attach Failed to open module: /.../hw-usb-redirect.so: undefined symbol: vmstate_usb_device Failed to open module: /.../hw-usb-host.so: undefined symbol: vmstate_usb_device With this patch, I run this small script successfuly: #!/bin/bash pushd ~/suse/virtualization/qemu/build for qemu in qemu-system-* do [[ -f "$qemu" ]] || continue res=$(./$qemu -nodefaults -display none -accel tcg -M none -device help 2>&1 | grep "Failed to" > /dev/null; echo $?) [[ $res -eq 0 ]] && echo "Error: $qemu" done popd Also run make check and check-acceptance without any failures. Todo: - accelerators can be filtered as well (this only covers the device part), then the field QemuModinfo.arch can be removed. v1 -> v2: - Changed the approach to this problem after suggestions made by Paolo and Gerd. Thank you! Jose R. Ziviani (2): modules: introduces module_needs directive modules: generates per-target modinfo hw/display/qxl.c | 1 + hw/display/vhost-user-gpu-pci.c | 1 + hw/display/vhost-user-gpu.c | 1 + hw/display/vhost-user-vga.c | 1 + hw/display/virtio-gpu-base.c | 1 + hw/display/virtio-gpu-gl.c | 1 + hw/display/virtio-gpu-pci-gl.c | 1 + hw/display/virtio-gpu-pci.c | 1 + hw/display/virtio-gpu.c | 1 + hw/display/virtio-vga-gl.c | 1 + hw/display/virtio-vga.c | 1 + hw/s390x/virtio-ccw-gpu.c | 1 + hw/usb/ccid-card-emulated.c | 1 + hw/usb/ccid-card-passthru.c | 1 + hw/usb/host-libusb.c | 1 + hw/usb/redirect.c | 1 + include/qemu/module.h | 10 +++++++++ meson.build | 25 ++++++++++++++------- scripts/modinfo-generate.py | 40 ++++++++++++++++++++------------- 19 files changed, 67 insertions(+), 24 deletions(-)