From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 23BF5C0044D for ; Mon, 16 Mar 2020 19:23:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D65D520753 for ; Mon, 16 Mar 2020 19:23:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="CFIdmYKP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D65D520753 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6E8806B0003; Mon, 16 Mar 2020 15:23:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 699026B0005; Mon, 16 Mar 2020 15:23:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 561506B0007; Mon, 16 Mar 2020 15:23:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 34F726B0003 for ; Mon, 16 Mar 2020 15:23:11 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BFA6982499A8 for ; Mon, 16 Mar 2020 19:23:10 +0000 (UTC) X-FDA: 76602198540.30.lip39_55edff219ac2b X-HE-Tag: lip39_55edff219ac2b X-Filterd-Recvd-Size: 4402 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Mon, 16 Mar 2020 19:23:10 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id h16so15273481qtr.11 for ; Mon, 16 Mar 2020 12:23:10 -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:content-transfer-encoding:in-reply-to :user-agent; bh=japvuDOw9SGBqSZApCc07hbPuberx25oVTkg1eTKZyE=; b=CFIdmYKPQbgW8rXZ3LC8dolLHGk7btoV/9hlvb5sqVhK0DUjJDXu0iZhOjxeCn2MXG /GdpkxMBbg8aF1rAo+EIq7OH9mCMBe/2T+Mh4ULqx3GrLCMKdXErAZkN3EWgrvUYiE/9 YOsEl53+z1kUZvnp9AIkcpOSLh2XFfGBeR7YGg5KYZoOCJ6Llm4hGbCu+XkywWZBzH6h lD7jhCnLSACgr36Z/dqlVpfUUV//Vd/IFcrfepwwWKxrbVILimo/2vBi7XDedG9mtfvN spfwCyQk9XfHm7OxqBw8vX0OWPo5Guzt+vsjlAGKsVxpRbMFXYbmNK2g1DeKIpHUtd2q IWtQ== 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:content-transfer-encoding :in-reply-to:user-agent; bh=japvuDOw9SGBqSZApCc07hbPuberx25oVTkg1eTKZyE=; b=Ss+nyq5CEpkkAfKuDquhIc1Yf6Nf0YsXkJTh+4q4F9of42q7pVCROvlEPt9wiRzBTX ziqrOdhMBPStKbjnf/3it8RBB+7Jp2SzXJSWLpT2PEbhCQ2hwZGJ3ZOEOZkdUZ9a8jQJ /sk/pqkdn6+I5MIIxMBoAWVC666DnmEbcDb3kyRVCLtPad/rdWUyiOzHrO+lSau72KLa bLhymiaRmTjLrOeiCfle/DA/QsNTQkYFkcsoa2pHsoPbK9gHB51SrlUDRk6JM6UrLbLy RAtqowPcTJl2nUaobpw7jhVsTGVTx1YrDoU5uqx7AVK/8vlPtKHgPaLDE1GOEvlUe2vX zeGQ== X-Gm-Message-State: ANhLgQ2JGwup4jDeYWKsFkku9MOitN36iFxGizXEIFk/NCRw7z/sJFn5 JnjqEtcbiWHC2GWmZNvAY2b+Fg== X-Google-Smtp-Source: ADFU+vvVMnfIMif/CgGrxSyHwE3QBkrQjxwCDJ989v5erqtbWFOprWqGIpfeC4BCoYoIRoAt/XoJLQ== X-Received: by 2002:aed:32e7:: with SMTP id z94mr1723801qtd.382.1584386589754; Mon, 16 Mar 2020 12:23:09 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id w30sm528758qtw.21.2020.03.16.12.23.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Mar 2020 12:23:09 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jDvKO-0006vf-S6; Mon, 16 Mar 2020 16:23:08 -0300 Date: Mon, 16 Mar 2020 16:23:08 -0300 From: Jason Gunthorpe To: Christoph Hellwig Cc: Jerome Glisse , Ralph Campbell , Felix.Kuehling@amd.com, linux-mm@kvack.org, John Hubbard , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Philip Yang Subject: Re: [PATCH hmm 2/8] mm/hmm: don't free the cached pgmap while scanning Message-ID: <20200316192308.GO20941@ziepe.ca> References: <20200311183506.3997-1-jgg@ziepe.ca> <20200311183506.3997-3-jgg@ziepe.ca> <20200316090250.GB12439@lst.de> <20200316180713.GI20941@ziepe.ca> <20200316181324.GA24533@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200316181324.GA24533@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000308, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Mar 16, 2020 at 07:13:24PM +0100, Christoph Hellwig wrote: > On Mon, Mar 16, 2020 at 03:07:13PM -0300, Jason Gunthorpe wrote: > > I chose this to be simple without having to goto unwind it. > >=20 > > So, instead like this: >=20 > As =D1=95aid, and per the previous discussion: I think just removing t= he > pgmap lookup is the right thing to do here. Something like this patch: OK. I think I get it now. We don't even signal that the pfn is a pgmap to the caller, so the caller must assume the pfn is CPU memory and can be dma mapped. At that point it doesn't matter what kind of pgmap it is. Races here are resolved by notifiers as we can't destroy the pgmap without triggering invalidation of the pte So removing is the right thing to do, and the fixing for the device_private case is closer to the hunk I just sent. Jason