Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2167773iof; Tue, 7 Jun 2022 22:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvjt3Ea+Pa5nAjEcxd5rm/uW+rLeH1jVBV9KmIhM6S3uUae5sOLU05i7HVIFfMCIdwCl9s X-Received: by 2002:a63:2c91:0:b0:3fd:3737:2803 with SMTP id s139-20020a632c91000000b003fd37372803mr20312651pgs.271.1654664437182; Tue, 07 Jun 2022 22:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654664437; cv=none; d=google.com; s=arc-20160816; b=ijeoHvKTeSfOnXrlqT4qP01+zibiHb+E8VmF8KlwQXaghNKlw4ng0dpQuJVpN+29Fk MXufArIgBK8lh74doVbPXfWl81yvAaxP5EjCaOWYAIIKS8N4WFAcRbbV8sWWfs6N0v1l Y+AsdkPvi4letbh+58m+97Jv2wfioz+2RaUGO2y4pRhNHeRy465FzfMV268dIq0qsSma uVZIW5m859EX/GeE1iL5mWtYa6jhWdYPSIo1hY/ImD9lHmpmz+Y1kXcGcHI6Vfc1UPiA uABwFAebfrmZ7q8mbcKB+FCwwZS6SW90syJfNC6/BF5tDOsjIAeAzQVdaePvMbFNYLKZ o6SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=8C0NEBO/ea6+vfvU3O1/xfsUBzcZiJoiCFBeBhlMW4s=; b=DoZbhb+OGWaGJQxH2/iOVks6R4grN7GDyIdRFpQNTtbmdqzuNhqMDT+oofJpbHSaXJ I3HdYuRzn6993WRtZomGRWEhG8utAei3SIU+wg6E5BNr8fCdVQzS8HBGbfwuGUB9XYkM rM+9UUBkNmCz4J0oTZ6aBbL1JCvSr3H131Yj5azcBgVIyuw2gf9Z7lxcj/3MT2J+y2yf 4G7z8Mcg0IIlvP+DggNPdp+gu5Itphu+O3wPoH4jyteCKtAt/x0OOtUF/2aJCUry2TrB g9vPDYJ2YYUsG7lXMu2u5f6lUkwhLWt4oUEeJ8nLjnA1kPL03mqp/VEHt/kFUhMmUWfu wGpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FZQX3Rou; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f18-20020a170902ce9200b0015e05374e86si29208334plg.443.2022.06.07.22.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:00:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FZQX3Rou; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BF45939FD78; Tue, 7 Jun 2022 21:29:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352699AbiFGSR2 (ORCPT + 99 others); Tue, 7 Jun 2022 14:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348950AbiFGR5t (ORCPT ); Tue, 7 Jun 2022 13:57:49 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 79B8F4FC4E for ; Tue, 7 Jun 2022 10:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654623645; h=from:from:reply-to:subject:subject: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=8C0NEBO/ea6+vfvU3O1/xfsUBzcZiJoiCFBeBhlMW4s=; b=FZQX3RouvbJMgGfzpBflRNhBCfCs7lbrsf25cf/MCDxWONo0H5Ejn/PPM6j88cQd0e+pt7 0GZ1BQFKu7QGi/dapdE5rIdXZDFht4quwjqsfFE6lYnnOxYe6Iq7wV2SJtofVg82a02GTF XOmOMTl8fDeK8RPjK8r039XULw6DiPA= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-8SPZt3LoMg2FMyuIDhAfJA-1; Tue, 07 Jun 2022 13:40:44 -0400 X-MC-Unique: 8SPZt3LoMg2FMyuIDhAfJA-1 Received: by mail-wr1-f70.google.com with SMTP id r13-20020adff10d000000b002160e9d64f8so2681577wro.0 for ; Tue, 07 Jun 2022 10:40:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=8C0NEBO/ea6+vfvU3O1/xfsUBzcZiJoiCFBeBhlMW4s=; b=jWtccbZ9kQRtvKyUr3ClyBfDg0B2VxnG41t8lFHPbAf4yQsWaJ6kQED55ShsTRtrgl HjadpMPr1nSfEm7UC1JOa//NdKlbq9Es7sQKezS/Pr2maONL1ZwsMW/ohm1aPS7vDFgd CiYIoyG7eGfJbYtdQvCAFu4165KNmULUsUWYXtatTYlsQ95dCJxIzfIdOI0vMnB3E+gi 0JfvUFu3EtpwWdsKlCX35z426Wh5x5kkcmJaIWMPi51Eq/BRHF8zXanrIq8aMkYa2jMu laZZj73kwBUKru9NE9Byc9z5jN/B/nSXgeFrMEjwOcUzC8YGErfvkCtXMmcG6fgwjEps kw/A== X-Gm-Message-State: AOAM533BmvMud/vV9A5eMwsaC8G4IISurEnDfnElkf3kQnKLni4sRA8B 2h6o919TByqoKEPAVnKnxQii658VzB5yw2UBwxUSh841+wvp5aW3Ltm0tfsxWPZZ2c3+GXFMVsF lsxNvrHQ7P41lhc8DzXwxCy8L X-Received: by 2002:a5d:6e01:0:b0:210:1a7c:7319 with SMTP id h1-20020a5d6e01000000b002101a7c7319mr28352630wrz.227.1654623642500; Tue, 07 Jun 2022 10:40:42 -0700 (PDT) X-Received: by 2002:a5d:6e01:0:b0:210:1a7c:7319 with SMTP id h1-20020a5d6e01000000b002101a7c7319mr28352599wrz.227.1654623642212; Tue, 07 Jun 2022 10:40:42 -0700 (PDT) Received: from [192.168.1.129] (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id v190-20020a1cacc7000000b003975c7058bfsm21166382wme.12.2022.06.07.10.40.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jun 2022 10:40:41 -0700 (PDT) Message-ID: Date: Tue, 7 Jun 2022 19:40:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 0/2] Improve vfio-pci primary GPU assignment behavior Content-Language: en-US To: Alex Williamson , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch Cc: kvm@vger.kernel.org, Laszlo Ersek , Gerd Hoffmann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <165453797543.3592816.6381793341352595461.stgit@omen> From: Javier Martinez Canillas In-Reply-To: <165453797543.3592816.6381793341352595461.stgit@omen> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Alex, On 6/6/22 19:53, Alex Williamson wrote: > Users attempting to enable vfio PCI device assignment with a GPU will > often block the default PCI driver from the device to avoid conflicts > with the device initialization or release path. This means that > vfio-pci is sometimes the first PCI driver to bind to the device. In > the case of assigning the primary graphics device, low-level console > drivers may still generate resource conflicts. Users often employ > kernel command line arguments to disable conflicting drivers or > perform unbinding in userspace to avoid this, but the actual solution > is often distribution/kernel config specific based on the included > drivers. > > We can instead allow vfio-pci to copy the behavior of > drm_aperture_remove_conflicting_pci_framebuffers() in order to remove > these low-level drivers with conflicting resources. vfio-pci is not > however a DRM driver, nor does vfio-pci depend on DRM config options, > thus we split out and export the necessary DRM apterture support and > mirror the framebuffer and VGA support. > > I'd be happy to pull this series in through the vfio branch if > approved by the DRM maintainers. Thanks, > I understand your issue but I really don't think that using this helper is the correct thing to do. We already have some races with the current aperture infrastructure As an example you can look at [0]. The agreement on the mentioned thread is that we want to unify the fbdev and DRM drivers apertures into a single list, and ideally moving all to the Linux device model to handle the removal of conflicting devices. That's why I don't feel that leaking the DRM aperture helper to another is desirable since it would make even harder to cleanup this later. But also, this issue isn't something that only affects graphic devices, right? AFAIU from [1] and [2], the same issue happens if a PCI device has to be bound to vfio-pci but already was bound to a host driver. The fact that DRM happens to have some infrastructure to remove devices that conflict with an aperture is just a coincidence. Since this is used to remove devices bound to drivers that make use of the firmware-provided system framebuffer. The series [0] mentioned above, adds a sysfb_disable() that disables the Generic System Framebuffer logic that is what registers the framebuffer devices that are bound to these generic video drivers. On disable, the devices registered by sysfb are also unregistered. Would be enough for your use case to use that helper function if it lands or do you really need to look at the apertures? That is, do you want to remove the {vesa,efi,simple}fb and simpledrm drivers or is there a need to also remove real fbdev and DRM drivers? [0]: https://lore.kernel.org/lkml/YnvrxICnisXU6I1y@ravnborg.org/T/ [1]: https://www.ibm.com/docs/en/linux-on-systems?topic=through-pci [2]: https://www.kernel.org/doc/Documentation/vfio.txt -- Best regards, Javier Martinez Canillas Linux Engineering Red Hat