Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8625017ybn; Tue, 1 Oct 2019 10:45:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCiuZvN1LYj/oiLp1EtVwLdL3ZaD5qPNT+OOZv2zY3OkUyeT6G3d6tWYvtQ5rYK41Vo7tX X-Received: by 2002:a50:e718:: with SMTP id a24mr27166030edn.289.1569951926739; Tue, 01 Oct 2019 10:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569951926; cv=none; d=google.com; s=arc-20160816; b=yb3iIqYRtrlyqIseooDaT0VL/75DSf0cZ3LxhxDqc6mGNE22Ru9Ont6YmCT0Ms1DL7 ySfsGsanEueZw11U3EMSZ9FXSdCJzQwy5BiuMp91EVHkWgHguiejAKAgNyTdk8a9aELp NRDMMjgU70H3Q0uuxNfMpAw5dCblFCWL5GShCei9a7YmHntRRjlmm/JPA0riI+x2Ew6W 5IsbVMdUyUObZArsY7NR+ghB3s/Ezkc/9PRJ5x7NBaH16VCCqdss//krDKNplM/KK/6w Gn+/nnty78+BFd3CfC0G9yP9BXsNpKduiYP/NOn1zCVX2tJno7phyHQVxBdaxqz5JBb6 lIaQ== 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=iEhC4rBksrqGUyOLde28S6MdRltK4FanlvR62miO8Ng=; b=IqzxiVeEchozwPgK/26hrW/hqINDAFq+1FSbfXNFy7wLsCFt2tkvjHh5lZWRoFGXUr b896KFa6x61biV71wmlapzwAKapMdQUuSDudvI2fkVdeBT+huC1cckHbBw7EScRTcxTV qC/0dsC35dxHui7vhRB5wOTHwHGNXuC6rojRh1bIYHY0xiBQF7nAyfrio++vRZbNIJbT 2f3Gm1IhRsYInFLHGgPbChmzL+ct2L/Y9YUuDatc05RJKV9g5NmEdFE7Qbz8n1EzI0EJ OsL0bjflpXCeI8XBuhp2b21/IjIlFdMeCy/KCtW3oopfNqYiAfhssc4jCx1M7VRzMXOa SyBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=XDzxFVBl; 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 f16si9232460ejc.73.2019.10.01.10.45.02; Tue, 01 Oct 2019 10:45:26 -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=pass header.i=@ziepe.ca header.s=google header.b=XDzxFVBl; 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 S1728197AbfJARoC (ORCPT + 99 others); Tue, 1 Oct 2019 13:44:02 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:33868 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726096AbfJARoC (ORCPT ); Tue, 1 Oct 2019 13:44:02 -0400 Received: by mail-qk1-f195.google.com with SMTP id q203so12113102qke.1 for ; Tue, 01 Oct 2019 10:44:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iEhC4rBksrqGUyOLde28S6MdRltK4FanlvR62miO8Ng=; b=XDzxFVBlNwrv8acclBscPjFygnMn27IiO/iYUcxaTV5UgMssfzgFoUQQmxnoujgRSn 9nO6IvoD5m3afkh6JDhc0+mCaIPR3iEJRQ7wnNvRI8NXNs+PV0n7+5H46/AO6/nkQVRQ FzOFJLW5TRsX2nJjZBbvncdSqUtO5MY1ENWBed2U85HhmkQuc2LYx9Sr0XHxl8F0pqMw VedHc425xtXTg5XXT7abXEAOudNDdwWpGxAZ69yveZfEabeFJOy2vZD/tXxrWpAVgZB2 VpvdPu35rpgwn0Sl9oD8266enQ6P/krd/5cGT16mQeQBRk1pCTtcbIes5D3dai1ThFZT pJGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iEhC4rBksrqGUyOLde28S6MdRltK4FanlvR62miO8Ng=; b=QXoSTgCk/bjPd4skNPvgBZNbhcxQByi3J72P2VaKKMHp3og+sqc6EaV6RvffCUnx6F G8PpJNxMA6IFZRl2p6me8L2EmU+QdaRDjOirxGXuv8ha3HaYTVTGWeoT7Zf8Irf5dIHt u9kB6//kMRUKqo9n/+wZalU9ULfXKgNhcg+Hip21JKhJx1FYrMZgYBdzlv4zNpdew6Z1 3/L4mLJ+wbCfQ2EhgIZcmwFlkXaKzVPVOdHsY8sbZ8oe9XqfqyNVKRQkXtJTjhO8GzML /xnKcaSYmZHkr1PQ8cPJyMZbofWjxImhy592QvGWx8hGyU/Pe7QTL61zUNixmcHzFd7x 7f6w== X-Gm-Message-State: APjAAAUduW1ntTtuVUISow2f1yNImlOF4DV3j6NAApK4G5Tt82Q5lozD gPw7FBhGRYLGtPm00XCOBQxMcQ== X-Received: by 2002:a37:4d02:: with SMTP id a2mr7378463qkb.63.1569951839878; Tue, 01 Oct 2019 10:43:59 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-180.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.180]) by smtp.gmail.com with ESMTPSA id k17sm11991937qtk.7.2019.10.01.10.43.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Oct 2019 10:43:59 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1iFMBq-0005M4-Sj; Tue, 01 Oct 2019 14:43:58 -0300 Date: Tue, 1 Oct 2019 14:43:58 -0300 From: Jason Gunthorpe To: Alan Mikhak Cc: linux-kernel@vger.kernel.org, martin.petersen@oracle.com, alexios.zavras@intel.com, ming.lei@redhat.com, gregkh@linuxfoundation.org, tglx@linutronix.de, christophe.leroy@c-s.fr, Palmer Dabbelt , Paul Walmsley Subject: Re: [PATCH] scatterlist: Validate page before calling PageSlab() Message-ID: <20191001174358.GG22532@ziepe.ca> References: <1569885755-10947-1-git-send-email-alan.mikhak@sifive.com> <20191001121623.GA22532@ziepe.ca> <20191001171220.GF22532@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 01, 2019 at 10:26:38AM -0700, Alan Mikhak wrote: > > > Cost of adding page structs to a large PCI I/O address range can be > > > quite substantial. Allowing PCI I/O pages without page structs may be > > > desirable. Perhaps it is worth considering this cost. > > > > This is generally agreed, but nobody has figured out a solution. > > > > > Scatterlist has no problem doing its memcpy() from pages without a > > > page struct that were obtained from ioremap(). It is only at > > > > Calling memcpy on pointers from ioremap is very much not allowed. Code > > has to use the iomem safe memcpy. > > Is it in the realm of possible to add support for such PCI I/O pages > to scatterlist? Perhaps some solution is possible by adding a new > function, say sg_set_iomem_page(), and a new SG_MITER_IOMEM flag that > tells scatterlist to use iomem safe memcpy functions when the page is > not backed by page struct because it was obtained from ioremap(). This > flag can also be used at sg_miter_stop() to not call PageSlab() or > flush_kernel_dcache_page(). People have tried many different things so far, it is more comple than just the copy functions as there is also sg_page to worry about. > If supporting PCI I/O pages is not possible, would it be possible to > check for invalid page pointers in sg_set_page() and communicate the > requirement for a page struct backing in its description? Clarifying the comments seems reasonable to me. Jason