Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp988351imm; Wed, 18 Jul 2018 14:27:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcXyCGSX2YH2rn+ecF0cTpIwXYCYRpRfwuIwiK+kn6vHQhxZhkKHkymxhPKSrlG8YwMzXby X-Received: by 2002:a63:5c52:: with SMTP id n18-v6mr7258249pgm.360.1531949230888; Wed, 18 Jul 2018 14:27:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531949230; cv=none; d=google.com; s=arc-20160816; b=t2aARWpTj+/n0FwKwnsB3JkRVhXem6/Tmqx6X/cASBg5Xw5805wc7XBkQvnnALxuw9 lcMd3ehpw5jzX4AeXDHjVkBEN6qWpGudglNCPOrsekU6AlYt7PX3GwQ6fFnGRdz1QoBg DzVg2/TdeAfvkuI7WdkPmqgvJ0rQ5MliNM1MhozwD4Pm0MLKrIiBlRrlVEMocY55msug brhiE8MRe69gjvBgBmFkqNzUDNg+OALtvbVgJ7BMsQJbzar1MyXZrtSTTrAlQTreoMdw s8N/dQ2geXH73ACDhfrm0iCEObD59oRsimw0oe6s3gWwc55JGY9mByvdwVrS3wincM6I NStg== 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=3daps+2mYMGJm3IgBbgcNjcgooFiAHEWng+fou/+cAc=; b=KnowdF7tbRjLSjUd5DUYRcbd4AAL2NU4Mpg56Ce9lZ89xtW3pkY4ihLUk/0RMrJNaR DGLR0WN6g9aVXF8DgHQEGmsts4vFeunFOc7g7t2f/MntZ3ikpz6AJEtp8NaIukR4krAp v10ge0/ACYgCDcidQiVqv64fgza4XvwzyG/+hBUFCHH5y1rom/hruKcX0BzR2ubr7KMe XFx6wfPV+uDqklIyOLq0RXhXcSkg2oZowtxOVnJZ64OLrAFCpbLbogJiZ8MBKOEy5kOP MGEP6zqosd1AgR5mH3+rGndnQ3tfYXSnHMF6mR6ltUw/DmylfljDZGEuEieaaG3ZympX /R4w== 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 d2-v6si3889652plh.387.2018.07.18.14.26.55; Wed, 18 Jul 2018 14:27:10 -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 S1730382AbeGRWFV (ORCPT + 99 others); Wed, 18 Jul 2018 18:05:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57958 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726680AbeGRWFV (ORCPT ); Wed, 18 Jul 2018 18:05:21 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BCBB030DECEC; Wed, 18 Jul 2018 21:25:33 +0000 (UTC) Received: from t450s.home (ovpn-116-29.phx2.redhat.com [10.3.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40A732010CBA; Wed, 18 Jul 2018 21:25:32 +0000 (UTC) Date: Wed, 18 Jul 2018 15:25:31 -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: <20180718152531.60f7df6b@t450s.home> In-Reply-To: References: <1531457777-11825-1-git-send-email-srinath.mannam@broadcom.com> <20180717092207.775e381c@t450s.home> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 18 Jul 2018 21:25:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Jul 2018 00:05:18 +0530 Srinath Mannam wrote: > Hi Alex, > > On Tue, Jul 17, 2018 at 8:52 PM, Alex Williamson > wrote: > > On Fri, 13 Jul 2018 10:26:17 +0530 > > Srinath Mannam wrote: > > > >> By default all BARs map with VMA access permissions > >> as pgprot_noncached. > >> > >> In ARM64 pgprot_noncached is MT_DEVICE_nGnRnE which > >> is strongly ordered and allows aligned access. > >> This type of mapping works for NON-PREFETCHABLE bars > >> containing EP controller registers. > >> But it restricts PREFETCHABLE bars from doing > >> unaligned access. > >> > >> In CMB NVMe drives PREFETCHABLE bars are required to > >> map as MT_NORMAL_NC to do unaligned access. > >> > >> Signed-off-by: Srinath Mannam > >> Reviewed-by: Ray Jui > >> Reviewed-by: Vikram Prakash > >> --- > > > > This has been discussed before: > > > > https://www.spinics.net/lists/kvm/msg156548.html > Thank you for inputs.. I have gone through the long list of mail chain > discussion. > > > > CC'ing the usual suspects from the previous thread. I'm not convinced > > that the patch here has considered anything other than the ARM64 > > implications and it's not clear that it considers compatibility with > > existing users or devices at all. Can we guarantee for all devices and > > use cases that WC is semantically equivalent and preferable to UC? If > > not then we need to device an extension to the interface that allows > > the user to specify WC. Thanks, > > > To implement with user specified WC flags, many changes need to be done. > Suppose In DPDK, prefetcable BARs map using WC flag, then also same > question comes > that WC may be different for different CPUs. > As per functionality, both WC and PREFETCHABLE are same, like merging writes and > typically WC is uncached. > So, based on prefetchable BARs behavior and usage we need to map bar memory. > Is it right to map prefetchable BARs as strongly ordered, aligned > access and uncached? Is it possible to answer that question generically? Whether to map a BAR as UC or WC is generally a question for the driver. Does the device handle unaligned accesses? Does the device need strong memory ordering? If this is a driver level question then the driver that needs to make that decision is the userspace driver. VFIO is just a pass-through here and since we don't offer the user a choice of mappings, we take the safer and more conservative mapping, ie. UC. You're suggesting that there are many changes to be done if we modify the vfio interface to expose WC under the user's control rather than simply transparently impose WC for all mappings, but is that really the case? Most devices on most platforms seem to work fine now. Perhaps WC is a performance optimization, but this is the first instance I've seen of it as a functional issue. Does that suggest that the imposed alignment on your platform is perhaps unique and the relaxed alignment should be implemented at the architecture specific memory flags for UC mappings? For instance, does x86 require this change for the same device? The chance for regressions of other devices on other platforms seems rather high as proposed. Thanks, Alex