Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5737941ybp; Tue, 15 Oct 2019 04:24:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRP41P4a0/KqsSAeQ0ZSF01K9llrUUm7ePjUma4Xf5Nd/Tbv0CpvSdZENfaIadjQrqcfpW X-Received: by 2002:a17:906:c317:: with SMTP id s23mr34919600ejz.251.1571138675472; Tue, 15 Oct 2019 04:24:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571138675; cv=none; d=google.com; s=arc-20160816; b=rypSgSuHDcO08Lfhbm6qSW4go1AEZLkf20Se4iNZTO1KRL3zJRkKN1vYCaLMh4QRN2 XNt3aix1+rZsL7NnPOSrmBQPAjzZvNZNwdsbbn+rbag/faUS9KAHOpAmcbpoEy8BVQkD fOV1oTeke0mEQQlyv6q1lbndOFGN/fZCt/1ru+KMSKzKzU8wxTnGdMwH0qwgn99c6+JV eNRRjJvxT8JwRb5dpTdk8UXio3qr3vBzR/pGzP8SsTs9TYh4Qe3bK1wZVppUG4cfXFFF u3PekdCcT8WB3qSrvcCBTbDmFBOWTso/9mQk8svFCNRPxUR36pqe1STzUV6czBoroA09 JDzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hr+RREDY0gkDQuh1EXg6I88ldv6MsMnbJyp3fbrjZ9c=; b=Z8Cv9PDhurvYuMLETq3Bko29MlVQpwkc7rwWqqoe72RC6Hm3KpI7pBY51M+ebALpBI USN1o4EdFPHH0tR1YgjA3NMjx7jfiPf3YFjVKcDVCxtIObSXclLHE+OD2sq8FEGHeWYH NtlRW5Ps9zbqSqtWJwnT7deBs588pKcpUeHrBHYPwLzmvcPN45uIPF7yW13QtJ7GneWl mYR268CE43bl2hhrV7IqzxkxZygIsvSTIdg6fMWw1XEG4MMSlB+PA5fj0C/o9gwkiF1b xyGBcecfBkDDm+c9LwcQoRsEBLt37WJPc1TneISx2X9NB8R3xq8ZG8NDEQlkpJLwTbK6 CRpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XQ8LlaEG; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si12138281edx.273.2019.10.15.04.24.12; Tue, 15 Oct 2019 04:24:35 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=XQ8LlaEG; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730114AbfJOJzY (ORCPT + 99 others); Tue, 15 Oct 2019 05:55:24 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37604 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbfJOJzX (ORCPT ); Tue, 15 Oct 2019 05:55:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hr+RREDY0gkDQuh1EXg6I88ldv6MsMnbJyp3fbrjZ9c=; b=XQ8LlaEG49W9Hba6vY1gJ743n sBLmbC6uC+DcTc6D7WwOIh0CoGlU4x8kvKpDrrYtbSNJpvAsycrdpyHUAziC8LDS3H6rZcAfymbK5 qyO/p4d6OGRu6n5uYHYW5DJuVaPjOtkgwnzCPLPgA6vJ9PLhq5Bipvwcmg/JGXQX0BEVuu/kPNBWy WgFnG9rYzY+hAfX6nRhxyJnywde/75ndGqV2/THaiKTkunFlj6XXBSj5859SkzA3Ae/+NGbSmR3QO wOxH6uPF1xcfckQdJYaGIRmqfJPTj46FkH+T8BTAM59O7tar2it6ux5SAT2Gjg9m1iCXNSzJ9jVBd rRGhWZ1iw==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKJY2-0001Z9-LB; Tue, 15 Oct 2019 09:55:22 +0000 Date: Tue, 15 Oct 2019 02:55:22 -0700 From: Christoph Hellwig To: Alan Mikhak Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, martin.petersen@oracle.com, alexios.zavras@intel.com, ming.lei@redhat.com, gregkh@linuxfoundation.org, tglx@linutronix.de, Jason Gunthorpe , christophe.leroy@c-s.fr, Palmer Dabbelt , Paul Walmsley , Logan Gunthorpe Subject: Re: [PATCH] scatterlist: Validate page before calling PageSlab() Message-ID: <20191015095522.GA22551@infradead.org> References: <1569885755-10947-1-git-send-email-alan.mikhak@sifive.com> <20191007061324.GB17978@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 07, 2019 at 02:13:51PM -0700, Alan Mikhak wrote: > > My goal is to not modify the Linux NVMe target code at all. The NVMe > > endpoint function driver currently does the work that is required. You will have to do some modifications, as for example in PCIe you can have a n:1 relationship between SQs and CQs. And you need to handle the Create/Delete SQ/CQ commands, but not the fabrics commands. And modifying subsystems in Linux is perfectly acceptable, that is how they improve. Do you have a pointer to your code? > > In my current platform, there are no page struct backing for the PCIe > > memory address space. In Linux there aren't struct pages for physical memory remapped using ioremap(). But if you want to feed them to the I/O subsystem you have to use devm_memremap_pages to create a page backing. Assuming you are on a RISC-V platform given your affiliation you'll need to ensure your kernel allows for ZONE_DEVICE pages, which Logan (added to Cc) has been working on. I don't remember what the current status is. > Please consider the following information and cost estimate in > bytes for requiring page structs for PCI memory if used with > scatterlists. For example, a 128GB PCI memory address space > could require as much as 256MB of system memory just for > page struct backing. In a 1GB 64-bit system with flat memory > model, that consumes 25% of available memory. However, > not all of the 128GB PCI memory may be mapped for use at > a given time depending on the application. The cost of PCI > page structs is an upfront cost to be paid at system start. I know the pages are costly. But once you want to feed them through subsystems that do expect pages you'll have to do that. And anything using scatterlists currently does. A little hack here and there isn't going to solve that.