From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FA623E123C for ; Fri, 10 Apr 2026 18:12:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775844734; cv=none; b=Zhdx5eqfbYtdVKArKCjJ5nu/1Dd+oNZjW0dQPQTha6IT4ZrIWmw6HqslWelvdRTpdMkQALecfl62NvQ0NgKHuhrThMgvjRjJxh1zUTsbXMvSgbqAi5CUUhuy4mel99VcQjJAm4MbtEHR68sIFe3DSEJcOOdcSHFkhgUUnR+gIo4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775844734; c=relaxed/simple; bh=hiUP/Ze4OUB+WZ8fmnUh+G8NB5KKB69S/b0GIm7VAvw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YiHdB7FuVUoDFKZ3S+UzG88Ert6TvF4qHv4E15ZGV59s3lN4GYbC5W2GXgP2BolHloCKA9DcM1Q7t5F/Ykqmf1XETRMYWY481FLd/R/86KCav10KuHsGa56B+yuk/kb4sGsIWNpFQpK45MZvClkA5r8/NIUqNq6bVygQv1MBkk8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=ip9e41dR; arc=none smtp.client-ip=209.85.222.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ip9e41dR" Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-8cfdac74050so243792685a.3 for ; Fri, 10 Apr 2026 11:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1775844732; x=1776449532; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7bcrNPUvexRHFlvWYMVKo1yO/LnbhXx+tOPPYwyGpqA=; b=ip9e41dRJIAzDBhf2maq19BHtpNJUcsZSma/3LbhUbccqzcEOeOsuk/bm83sO3w1rU 2xS9IujCxwAjUEdFZheaKmxG0i9Dv8rb92YPtRvU9USIxsMHuljo68X19Mk4X+6vjkDK 1oNV84/Xlnp+wZQ1PJGYLOm/N2m91WuMYokmq9ib+oIzF+fkhZMWvVtku11Vx8lLr9kp tuPADZkpBVzIkQ3BZky8pTBIoLtc1KLNjTHYOl6pBr+Sig8AP2xDSlEj3tqkQgov/V3i NTzCMnlW/hjkXzrkVlV2QHEc9Kwi7xbhZEdoywgifEdmVwLbLI6RXyNE9ZCMMUX0T+f/ KVhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775844732; x=1776449532; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7bcrNPUvexRHFlvWYMVKo1yO/LnbhXx+tOPPYwyGpqA=; b=qy3MlaWExrb/VVzCO5FRiK2r0wMDE97MD8hsRDoHnxU00SoWABpqnpV6vnFcGvCzrk j7lfnyWjMvRnm/AJIqxNlZZRYtg9PGvy6Anr6ay1UtR+xQYtnAYxd9iIHH4Oodh/DJ7p mBi04TJrOJsSrX+O8yg6I3MIsO5mArEoYeNbVqn4Mv8ulLGw9lrtLLVNVu98nDrK0OMd BxsuaiIsyMtgVsLdQlC5l5pyfEneO86UA2C6UV6g+CaPpklQY2V/TTrcNDiaPeUik1v1 +DuvCipigpktgDTG2wxhe+YskxzLFksIsxXykhD2Tq5ZxmPn8DjAzuqJxxgLpHTo1sia nRVw== X-Gm-Message-State: AOJu0Yx6gIshXwaPO25Ud/FvYhw4fal6GVyZkPnygQGTkrvtJ0PrDBks deT0dsds1tSZKWA3mT11eMnAmsxjGtzrZFPayPNCI+g/g7/K7GgjapTAth/VJB2MToysIDkBzPM GPC8s X-Gm-Gg: AeBDieslvDPkl1DcywxlGwLDcfJmLyqRO7v9UhoczRDDX5tKGdDDjkNnO1khh7Wwgs8 cvJ9E5bBGWfk/pd3Ny3XbPoThwZfWshGQTxwZ3IvBtlJr6CbY02R2QPZxOFMI3MzdqmSB4sHsLv hkVgJ3Tpx0+d39iB3cTEoNOTM+tPy4dcCkmCMJKh8sMCWZGDePRuYn+eFka19M8HgoAnXTwGpG/ Pq7IZOVVDfq2+2jWwypdtADeGhb9qQaFzgWuT7xFVYYMUCBa8vxP+ucguveLBrle2/uGDNvqJ5t JmhS9FubqnZRr6+YYIScwur559UtlHOEsYHKKksfEeCvDvNiEjJMCq8g8ByeK75TsrbipOgVbj5 /JA2LgfB84SIEkDLvPaLy+ByyiDGgWXpMFATuxvuJunYUbUXpt+bykdXkD/WYhZazUuv7+Ks4Dr Xr9Nbf+A/3/M+pjp94KwYMf5H08plaBmiE07dU9cbUqxbwnzv1PelkAVpUNA2nrOAV8qup/Q== X-Received: by 2002:a05:620a:448c:b0:8cf:bbf0:ff55 with SMTP id af79cd13be357-8ddcf9b2fb7mr627569085a.51.1775844732110; Fri, 10 Apr 2026 11:12:12 -0700 (PDT) Received: from ziepe.ca (mctnnbsa70w-159-2-73-22.dhcp-dynamic.fibreop.nb.bellaliant.net. [159.2.73.22]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8ddb8d6e13fsm282533785a.23.2026.04.10.11.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 11:12:11 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wBGKx-0000000FPyq-00fp; Fri, 10 Apr 2026 15:12:11 -0300 Date: Fri, 10 Apr 2026 15:12:10 -0300 From: Jason Gunthorpe To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Steffen Eiden , Alex Williamson Subject: Re: [PATCH 1/3] VFIO: take reference to the KVM module Message-ID: <20260410181210.GG2551565@ziepe.ca> References: <20260407180107.1603697-1-pbonzini@redhat.com> <20260407180107.1603697-2-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260407180107.1603697-2-pbonzini@redhat.com> On Tue, Apr 07, 2026 at 08:01:05PM +0200, Paolo Bonzini wrote: > VFIO is implicitly taking a reference to the KVM module between > vfio_device_get_kvm_safe and vfio_device_put_kvm, thanks to > symbol_get and symbol_put. > > In preparation for removing symbol_get and symbol_put themselves > from VFIO, actually store a pointer to the KVM module and use > module_get()/module_put() to keep KVM alive. Why should VFIO have to deal with this? If it has a refcounted struct kvm then it is kvm's problem to make sure that module doesn't disappear while the refounct is valid.. I would expect this to happen naturally because the file_operations are still live and they will hold the module refcount. Jason