Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1251536imm; Wed, 1 Aug 2018 12:40:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcPhKW27SZSank77Uhv1D5ZSF8SL5aM5YjxEq7+zX1KaslkiAfeRKPBj4gnxmPzdpqHGsfU X-Received: by 2002:a17:902:22:: with SMTP id 31-v6mr26129573pla.190.1533152402362; Wed, 01 Aug 2018 12:40:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533152402; cv=none; d=google.com; s=arc-20160816; b=K8mETv4+UWQugGyNPtlqxnZIOIrrEDArWXwp+1VotB3SEBzDK/t0TV6HKQJXmYm6OM LKzoWFNUcSnRmdVyZaRaz3uk/QvJbCYtBLgmvFFMt4EHOV+u9AuslH4vdu3zHjvPvwwI trEwvU3/8awyrkPoHu5NfIfk1l2TfEAtPshgl+wVXJzy97zwIZilhiZJ90dWSZZLnb72 WWGghZuzCGllvFDAYwwtruRNHKXWymoZ7rrVk/7Kp4tO/1li3oOtqlcU8U7kF1FkqCTY cOhxSt4JQRNoxdy2uV1F9SOqHuskr3zQCxrfPW+3dq1bvFoxV0Kmx/jaS0qJoTNBqPKW ayuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=mZunJANQ9l1E4Btrxd3JmKDeXJ+3ZeiLvbNiyllE/1w=; b=aNAKI4GkISDZG4hiyML4l0t/Xeyk0FEymrzOSEne0DlXDAICTnJr/RCpQoBNpEQNtP le/sfAtcwu/bC99JWqoSvod93vi4gtKh6HKeJCk6yT6OU2h/yOoy/akwNQLilajnxsGd 3xZqGejjcohwVNTeS4NRfNhycFoROpcBvga53QAAdjyKwCRsFOpPoKagy591DW9WsqEu Cp3fjs1BxhSiXPXzVrVWNiaZcOZSt8wsEzqZOXeP5Kqj4hhFgKXTkquRz72N0SfSLB7y ua3ylVW7Sb9TJxAz7JE+GofQiOiSbCdvfbOTpyCGVOGTelE+IDw6N+k22eDQ0wvvY3s2 qavw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 194-v6si19496103pfz.101.2018.08.01.12.39.48; Wed, 01 Aug 2018 12:40:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732381AbeHAV0R (ORCPT + 99 others); Wed, 1 Aug 2018 17:26:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40082 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730149AbeHAV0Q (ORCPT ); Wed, 1 Aug 2018 17:26:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03500308FB9B; Wed, 1 Aug 2018 19:38:57 +0000 (UTC) Received: from t450s.home (ovpn-116-35.phx2.redhat.com [10.3.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 076526A036; Wed, 1 Aug 2018 19:38:54 +0000 (UTC) Date: Wed, 1 Aug 2018 13:38:54 -0600 From: Alex Williamson To: Srinath Mannam Cc: Ray Jui , Vikram Prakash , Scott Branden , kvm@vger.kernel.org, BCM Kernel Feedback , Linux Kernel Mailing List , aik@ozlabs.ru, David Gibson , benh@kernel.crashing.org Subject: Re: [RFC PATCH] vfio/pci: map prefetchble bars as writecombine Message-ID: <20180801133854.62b872f9@t450s.home> In-Reply-To: References: <1531457777-11825-1-git-send-email-srinath.mannam@broadcom.com> <20180717092207.775e381c@t450s.home> <20180718152531.60f7df6b@t450s.home> <20180719091252.749f2433@t450s.home> <20180720142728.572dd2d7@t450s.home> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 01 Aug 2018 19:38:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Aug 2018 23:28:53 +0530 Srinath Mannam wrote: > Hi Alex, > > In user space UIO driver (DPDK) implementation, sysfs interface > "/sys/devices/pci/.../resource0_wc" is used to map prefetchable PCI > resources as WC. > Platforms which support write-combining maps of PCI resources have > arch_can_pci_mmap_wc() flag enabled. So that it allows to map resources as WC. > In this approach mmap calls "pci_mmap_resource_range" kernel function > with write_combine parameter set. > "drivers/pci/pci-sysfs.c" kernel file has this implementation. > > If this approach fits to vfio driver, then code change in vfio driver are > > if (arch_can_pci_mmap_wc() && > (pci_resource_flags(pdev, index) & IORESOURCE_PREFETCH)) > vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); > else > vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); > > Please provide your feedback. Let me see if I've got this straight, UIO (in reality pci-sysfs) provides a separate interface such that a driver can *choose* to get either a UC or, at their discretion, a WC mapping to a region, and you're using that as justification that vfio-pci should arbitrarily convert all existing users from UC mappings to WC mappings, without their consent, any time the architecture supports WC mappings. The fact that pci-sysfs provides separate interfaces such that drives can choose their preferred mapping attributes only reaffirms to me that this needs to be a driver decision. How would we ever validate that a change like you're proposing above would not introduce regressions for existing users? Thanks, Alex