From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2778C433EF for ; Fri, 15 Apr 2022 04:45:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349438AbiDOEsI (ORCPT ); Fri, 15 Apr 2022 00:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232067AbiDOEsH (ORCPT ); Fri, 15 Apr 2022 00:48:07 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C65554FBF for ; Thu, 14 Apr 2022 21:45:38 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 8BD0C68B05; Fri, 15 Apr 2022 06:45:34 +0200 (CEST) Date: Fri, 15 Apr 2022 06:45:34 +0200 From: Christoph Hellwig To: Jason Gunthorpe Cc: Alex Williamson , Cornelia Huck , kvm@vger.kernel.org, Paolo Bonzini , Eric Auger , Christoph Hellwig , Yi Liu Subject: Re: [PATCH 04/10] vfio: Use a struct of function pointers instead of a many symbol_get()'s Message-ID: <20220415044533.GA22209@lst.de> References: <0-v1-33906a626da1+16b0-vfio_kvm_no_group_jgg@nvidia.com> <4-v1-33906a626da1+16b0-vfio_kvm_no_group_jgg@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4-v1-33906a626da1+16b0-vfio_kvm_no_group_jgg@nvidia.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, Apr 14, 2022 at 03:46:03PM -0300, Jason Gunthorpe wrote: > kvm and VFIO need to be coupled together however neither is willing to > tolerate a direct module dependency. Instead when kvm is given a VFIO FD > it uses many symbol_get()'s to access VFIO. > > Provide a single VFIO function vfio_file_get_ops() which validates the > given struct file * is a VFIO file and then returns a struct of ops. > > Following patches will redo each of the symbol_get() calls into an > indirection through this ops struct. So I got anoyed at this as well a while ago and I still think this is the wrong way around. I'd much rather EXPORT_SYMBOL_GPL kvm_register_device_ops and just let kvm_vfio_ops live in a module than all the symbol_get crazyness. We'll need to be careful to deal with unload races or just not allow unloading, though.