From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95E793B19BB for ; Tue, 7 Apr 2026 18:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775584883; cv=none; b=Uw0RKNkzSBNP+R7ISOo8cfJGxv4yK6TqIM+XpvsN6FHySJBTtKsWcAN1oReD3g4DzzGCmqPYX3jPl8fDAPTu+D9felGV27bvRob8JdAEyOOEvvoLUbO7JCGwsVltJfnCbJl1uYXuWxHKSkwn+2Sc/vAWW15tpwNY8/bYrAi40Eo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775584883; c=relaxed/simple; bh=Ig6ui/9Zd4Zwo9nawdQ8zMjEH0FlUfcIiXPW0/Rtlls=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OVwh/01SSB6P2ynwU2Rm4QxDAZLXgVUBM5i4nRQAujyQjB/r7unX0d+U6thw6t0eylAsBKC+IcDjdlLUSrin2W14kY+H8+YzxeCp/UPH/JwAu3hIU1XYX3yOFtx5V3cfVREOk3hIeXy5zno2+w8sgPz9cxMnEaQVajDjL8afinE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=F8/Bi84l; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=E1di7ySc; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F8/Bi84l"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="E1di7ySc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775584880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=EoxBwdftF7ZHqM58cd4+7nkJVXRUJjxP6QSRipaPkEY=; b=F8/Bi84lI45Pthd6/9wzxTZj1wmG87JF2YI1TxMhFMbxflFMSYJ25oRPKPpKLX6gEqQ3VO gItoug1s0GiN8UieLRqyOXbPXsp5A8j7JIV1PxBfuLgck/FvE6yzFOSIaqUFjDcbb9Ty0c d+hP6kXx0VOSMm/wdFd8vJ3rp5c9mRg= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-323-Yap-C3wTMuqkRQYU2Qu6ww-1; Tue, 07 Apr 2026 14:01:18 -0400 X-MC-Unique: Yap-C3wTMuqkRQYU2Qu6ww-1 X-Mimecast-MFC-AGG-ID: Yap-C3wTMuqkRQYU2Qu6ww_1775584877 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-488af976487so16021495e9.1 for ; Tue, 07 Apr 2026 11:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1775584876; x=1776189676; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EoxBwdftF7ZHqM58cd4+7nkJVXRUJjxP6QSRipaPkEY=; b=E1di7yScjPAjN92oCkzc2yo6q4GiwFwEuDzLjrGmx0I9AjKBxtIFDoaoVfJutnFhPG ji7HwJcHu+yeIFEO2auBzinyPPI74kxsZ1n32tju38UwshdhhRFij+SJe28eiUwZ/oPu 9bftCjaMd1cHRsE7BHspd/RttmLQBo7CN0wsLP66U7MFmUaryKjunm5FIorAoc7RY3Vc 2mX5Unz5SLJ8oNQ2MYxkmkuu7FMYO4w2TmwL3pVkteJg3aCOrlyUFHgCbdCMPQspVvKQ FuirTZ6GumRf3PLNUqD/uoEcxXThH/i4xV4C3T3mjeRQ318lpNKthcgiJnC+9HKbV1wm +XGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775584876; x=1776189676; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EoxBwdftF7ZHqM58cd4+7nkJVXRUJjxP6QSRipaPkEY=; b=EfEacMdcxWBKZVH49OJp2p7iQZ6P3R6Af2uaj+DovKjD6NliPpAczb5hLe+vzUP35v GUCk9dAkLaWDpgZZ7gfKIPo+sw01cjdPdhy6vVVoYEvbtsH+VYIwbUjN26H5epcHJaPo JTNjBBTgymknRimJ100o1uX5fZzDOre0Qdu6ZXyIk1mtdFhYy7sNhbTcc/kXCRj4K/PK MM6q2wNOk5gfDANoLDpHI92MtWJ0ZJKF/CQoNWiFGsbLs+URri9DPnC+L16xW2n4F4on X37MdGcjy1gfgH3QvKjVkblp7wYy783WyMWMPF2DwbNMT036A41coiy8biN2heOBzkGe BtUA== X-Gm-Message-State: AOJu0YxGvGgJOA0Hzpq5M5gDKksWB6elB7JZid67IqMAw/T2HTrmsxuz 4qih6PatLc/Xyunk7nEr45Ns2xKlEPS9MGBY9Udt7V2spIDlWJ/OJ9XCEDF/g1+P9AM3w3omHHb lT5ktiXCUSO0NRQ+xMFaQczLNfTJZIcA51mxRDfzjMLxKn8iIAwsCgJBzCPw9/1XvZuWpTONy51 44+n2eeHQ7jjQZlz2d1+EoVRc6c0ZQcRt9dPIi3SiPZLm3l4V6zQ== X-Gm-Gg: AeBDieucUgKWXll7waV7gr97DkpvZqedmwvpOCwh8oYcqFkfjH6ZIjvQRJUySowB1FC 1OVDNBHYkQN2jVOVXC8WMD0dk2fRAIgWHbLBlUz32wu/eOChdYwVLogEiFPTWwXPkl37yZ68qB5 +DJ88NBOm6Ery9dQ3sn8p20YM6k1X9smm8XVLv7LLWbRiYjXKsstNn/TlAb2bxKcH5cCn0f5QkZ EXL4argFicXw9LixEHh5qTrvsi3Cs1oKboxH6WKCcs3/s80qnYrvmTvpMEMwfE2g4+fqGeNSn8X fHg9DL3mer1F7WwzmXh5NCaRNSMaryeMjbbjW7eOLM/M0nfY4KaRH+cB7NWo1KNSSBaHsRwgSye vp5sxqiN6On2yNT6+KgtG2T55lb/tjEkV1g4caryvxK3UAIfLtT7qy+Wi0SP3tn6O/PqYoNNyUf EvINsWOrVoy0A4KDhzjsywP9DM X-Received: by 2002:a05:600c:4f15:b0:488:945a:ed63 with SMTP id 5b1f17b1804b1-488995cbaa7mr273887825e9.0.1775584876326; Tue, 07 Apr 2026 11:01:16 -0700 (PDT) X-Received: by 2002:a05:600c:4f15:b0:488:945a:ed63 with SMTP id 5b1f17b1804b1-488995cbaa7mr273886975e9.0.1775584875698; Tue, 07 Apr 2026 11:01:15 -0700 (PDT) Received: from [192.168.10.48] ([151.49.85.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488c555a6d3sm1510945e9.27.2026.04.07.11.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 11:01:13 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Steffen Eiden , Alex Williamson Subject: [PATCH 0/3] KVM, vfio: remove exported KVM symbols Date: Tue, 7 Apr 2026 20:01:04 +0200 Message-ID: <20260407180107.1603697-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit KVM right now exports three symbols for the whole kernel to manage the reference count of "struct kvm"; these are used by VFIO just to keep the "struct kvm" alive. This can mostly be replaced by inlines, and in fact the entire definition of struct kvm can be made opaque to VFIO. Besides the cleanup of removing the sort-of-deprecated symbol_get() and the bidirectional dependency between KVM and VFIO, this is useful for the recently posted support for Arm VMs on s390. In that scenario each KVM implementation module wants to have its own copy of kvm_put_kvm() in order to call the "right" kvm_destroy_vm(). With multiple modules, VFIO has no way to do a symbol_get() from the right module. With this series, that problem is gone because kvm_put_kvm dispatches through a function pointer, set by whichever implementation creates the VM. The main issue is that symbol_get() was implicitly taking a reference to the KVM module, and that has to be preserved. This is the purpose of patch 1. Thanks, Paolo Paolo Bonzini (3): VFIO: take reference to the KVM module KVM, vfio: remove symbol_get(kvm_get_kvm_safe) from vfio KVM, vfio: remove symbol_get(kvm_put_kvm) from vfio arch/x86/kvm/mmu/tdp_mmu.c | 2 +- arch/x86/kvm/vmx/nested.h | 4 +-- drivers/vfio/device_cdev.c | 2 +- drivers/vfio/group.c | 5 ++-- drivers/vfio/vfio.h | 15 +++++++---- drivers/vfio/vfio_main.c | 51 ++++++++++++++------------------------ include/linux/kvm_host.h | 9 +++---- include/linux/kvm_types.h | 30 ++++++++++++++++++++++ include/linux/vfio.h | 4 +-- virt/kvm/kvm_main.c | 34 ++++++------------------- virt/kvm/vfio.c | 4 +-- 11 files changed, 80 insertions(+), 80 deletions(-) -- 2.53.0