Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3396C433ED for ; Mon, 3 May 2021 21:54:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6330E61165 for ; Mon, 3 May 2021 21:54:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6330E61165 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DC3786B0036; Mon, 3 May 2021 17:54:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D9BA26B006E; Mon, 3 May 2021 17:54:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEEBA6B0070; Mon, 3 May 2021 17:54:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id A5B526B0036 for ; Mon, 3 May 2021 17:54:31 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5663B8145 for ; Mon, 3 May 2021 21:54:31 +0000 (UTC) X-FDA: 78101274342.20.986E5F7 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2085.outbound.protection.outlook.com [40.107.94.85]) by imf09.hostedemail.com (Postfix) with ESMTP id E7C286000104 for ; Mon, 3 May 2021 21:54:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fBi/OOChs5l4gDd1iMndcau+ma+l15riW82pUTVao5cLyhos5lGs/1r8sGpY3ErCc9beW37/Xyz9DYAiwe3NLLvT+OmaU07nLZobZINPayamOtjZ6Z9w57tsSTcLJPygmjOArFKrduS/nYk9bFdXRKYxwhfRhLx5UzQeFXJ2P/z9fF8WcnyVArC+Zpt7htOM4Hh0Dl7d7dbtTEIHK9Y2rW0XNc3y1/KiBaUwQr46Rpssy0DtTp2sTDt81N7aH536KUviV6BolQIbrwuRvcB4xMIjH9qVnAzTsSDEPaZCAnm3ClJfOLgoiHx41P9vxOAGSDWRvIWzxSSN/8KrVPLcCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B/eXQHoHLkCUUS8AnR3Rc3m6o8iYd8IlCJLPkc/Ajng=; b=P1Gv3zUihlZPr3vPZZm8QRQEOv+FHag7tD/0mAdT1EYHKjPNi54rmTMARg6P40PmmKEGPjIaMaxLyh7zYVUNTH3iXdK8Vwxym/Z1uZK1FkoVpsiO59aDmWKKWcwMe7fU9nEe5nKRhWA2j2Ytb9U9YtrTRMiZ1YSNkIDfyrZKCvgsP96d+FMymHnRoQwkP7O8ChsGJDuCbvupNoM4Pl2kvFLK31Tkr9YeCW3ca3HKFce29ZFr75a3L02IJbEOxtmP/vxOU/9BvwKfQewSjTnHRZ4JjnzMT+fgUr85T4e+xxUeRfcFvKvHrSJsHI+jaLcJXFuvRznaKY1DrjbacNSlNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=raithlin.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B/eXQHoHLkCUUS8AnR3Rc3m6o8iYd8IlCJLPkc/Ajng=; b=VlrE+djMP0DJ2UcKe4tJRFK8dcCSnzj54Xxn4k6pG+/bDRl7QA1inrF3ofUT32GVxw5XB0wBVz7EgdYjd8G5Gncyfc9PQJPGZZlG5+9pt3dUB3QKbOm0qoclG7Nj6LZEo70A3cJAg2EQeWCOilw5AJ1oZiI9OOkX34G8DxUsyxLEUTlEPJTTlgSwtzy8e5IHJVoeaAHmAc4e2KNmYYpWDEjbEx7UQkaw5ghRmMYZCvMHagWu93vq0LxpfAFKCvGzxsbh176/s3lxQmiWZEvt5bzCNONyAIJ60T2UhEIhF3UfH4F14sfGcwTiToZ33u+U6SjCDgIjlMp20r48yzr+TA== Received: from MW4PR04CA0387.namprd04.prod.outlook.com (2603:10b6:303:81::32) by CH2PR12MB3704.namprd12.prod.outlook.com (2603:10b6:610:21::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.42; Mon, 3 May 2021 21:54:28 +0000 Received: from CO1NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::f3) by MW4PR04CA0387.outlook.office365.com (2603:10b6:303:81::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Mon, 3 May 2021 21:54:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; raithlin.com; dkim=none (message not signed) header.d=none;raithlin.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT003.mail.protection.outlook.com (10.13.175.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.27 via Frontend Transport; Mon, 3 May 2021 21:54:27 +0000 Received: from [10.2.50.162] (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 3 May 2021 21:54:27 +0000 Subject: Re: [PATCH 04/16] PCI/P2PDMA: Refactor pci_p2pdma_map_type() to take pagmap and device To: Logan Gunthorpe , , , , , , CC: Stephen Bates , Christoph Hellwig , Dan Williams , Jason Gunthorpe , =?UTF-8?Q?Christian_K=c3=b6nig?= , Don Dutile , Matthew Wilcox , Daniel Vetter , Jakowski Andrzej , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy References: <20210408170123.8788-1-logang@deltatee.com> <20210408170123.8788-5-logang@deltatee.com> From: John Hubbard Message-ID: Date: Mon, 3 May 2021 14:54:26 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c358ef6-f987-49c5-90cd-08d90e7e05f3 X-MS-TrafficTypeDiagnostic: CH2PR12MB3704: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +BdVOjqbOHr6LL68rz0bWz3Wri8f+WsOjQdc4gIp/gYwWFzHx7zEC1Za463tQIxMkpOCRpmMi0QzZr3NfPIMtIZgQtZbguCGozneBgOCUk75yHpPJEidHlQAYF9Bw5YEi6jiUpKPOCxglH6TFYZQWNJMJ1n/AJlhKTjz3nIE/xjV5QGlZExlJqLUXuaH7vRzDIsbLmwvSaC25Uz7Jpgii6rSWzXTSokTUCzxx6IWaXGckq2z1Um0ZrCI5Oj+xRs5GJG74Uhj9nJdUg8GT4LOfKwISZYDNfFpMtWHAJrMXVhFM7IsliMDVkv06z+jmGiiZL3yWu2ISL+3v98JBSvne4/jIlyIhZv/vZdBlVHU2fr/WS9fBPqLGg7ybZsOEMhtSyZ7K+cQQy0t+1huj04dvLuZolRIFuDXbBDYRYJVh+0iBX5HvXQQ5W+bse1ksEWpO57wuHwoJC29sSTXOMRitaN7L52AxYpuKdd79Gwm6IyhwnazELMXJRsx/IE+vS+m0ggeg9gl/xG89T0QfweuukZGScYDOo0aTg/VJStsJnrqAStJtOVHP6d1L/23JiSV1noRBexPrzM6IlLrtkuujNl0/r48/dpLDXHRWYWVYdUwTdDP7Rc2OowMq9t3atk6Oc3dj5UXBHNYF8XFrgDCL6JH14wuygA10u/EBwU6vyXoSuHICikXhB1++Hy9PduRCtN8fZoHykKBx/fxMG4PQg== X-Forefront-Antispam-Report: CIP:216.228.112.34;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid03.nvidia.com;CAT:NONE;SFS:(4636009)(346002)(396003)(136003)(39860400002)(376002)(46966006)(36840700001)(36756003)(110136005)(316002)(336012)(31686004)(356005)(16526019)(7636003)(53546011)(83380400001)(8936002)(70206006)(5660300002)(54906003)(16576012)(70586007)(47076005)(478600001)(31696002)(82310400003)(7416002)(426003)(186003)(2906002)(86362001)(4326008)(26005)(36906005)(8676002)(2616005)(82740400003)(36860700001)(2101003)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2021 21:54:27.6943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c358ef6-f987-49c5-90cd-08d90e7e05f3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.34];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3704 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=VlrE+djM; spf=none (imf09.hostedemail.com: domain of jhubbard@nvidia.com has no SPF policy when checking 40.107.94.85) smtp.mailfrom=jhubbard@nvidia.com; dmarc=pass (policy=none) header.from=nvidia.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E7C286000104 X-Stat-Signature: j65w84yne7mmxncuqeskrfbjjadiog7k Received-SPF: none (nvidia.com>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=NAM10-MW2-obe.outbound.protection.outlook.com; client-ip=40.107.94.85 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620078861-505266 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 5/3/21 11:56 AM, Logan Gunthorpe wrote: ... >> IMHO, it is better to have all of the pci_*() functions dealing with pci_dev >> instead of dev, but it is also true that this is a larger change, so I >> won't press the point too hard right now. > > As a general rule, I'd agree with you. However, it's not good to blindly > follow the rule when there might be good reasons to do it differently. > > In this case, the caller doesn't have PCI devices. The nvme fabrics code > has a number of block devices and an RDMA device. It doesn't even know > if these devices are backed by PCI devices and it doesn't have a direct > path to obtain the pci_dev. > > Each struct device, might be turned into a pci_dev using the static > function find_parent_pci_dev(). If any device is not a PCI device then > we reject the P2PDMA transaction as not supported. Pushing the > find_parent_pci_dev() logic into the callers is, IMO, just asking the > callers to replicate a bunch of logic it shouldn't even be aware of > creating messier code as a result. > I guess my main concern here is that there are these pci*() functions that somehow want to pass around struct device. If a layer is carefully named throughout with pci in the function names, then something is still misaligned. This can happen over time, of course. But the really best patchsets try to avoid or mitigate the effect, by keeping names and functionality carefully aligned. Anyway, I've bugged you enough, I should just wait and see what the next round looks like, at this point. :) thanks, -- John Hubbard NVIDIA