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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 46C03C433E1 for ; Tue, 23 Jun 2020 00:05:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 221242076E for ; Tue, 23 Jun 2020 00:05:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ZqLlsVf8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731443AbgFWAFa (ORCPT ); Mon, 22 Jun 2020 20:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731328AbgFWAF3 (ORCPT ); Mon, 22 Jun 2020 20:05:29 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78695C061795 for ; Mon, 22 Jun 2020 17:05:27 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id z1so14125630qtn.2 for ; Mon, 22 Jun 2020 17:05:27 -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; bh=ZARmJJ7xCkdZZ2t8wNh4/tQvVIlLfUoBxGbPVnLj1no=; b=ZqLlsVf823WvkS6Pxei8NiC2W2IIsAJoQA2urO7e9M3j3n78WU8zuiQnBC/Hh13LQ7 W82cIEkI8yK1kig27JBpN1A+kBTvdyfep2zqFSsRZ3bneYMoHddrECdeOHAhBx3jAggE 8oQvGlZO4VuJSft8Izl2Bf/u/NJdZDmJmyKoVRcHZq2TKwggLrrOlhDeM/ysxoX7/Me3 dqRCX3t0aoqiPb12yGgusjNMnEL8ewMvbu4zIi2lDYR1tedgzPmqU85hNdNt9mW7kpmp xuKIYdmxHb1ZwHUACc5P3GQ4w7GIm5gpp47skdgCpNYwfEX9eupQQgKd/elWzUh05kv2 mhag== 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; bh=ZARmJJ7xCkdZZ2t8wNh4/tQvVIlLfUoBxGbPVnLj1no=; b=d/w+U4w75LgQ8akY5ZrFF4Wi7uu9E+egw+8OBU74uiytr8dQsjr7sX7rs9sGqEb3WO s+uFP+yHRDTaNgzRWSC6U3T6G7sSJtPvjdZG2iH8aDIjXItie5nk/3NNC7I5Lf8gAWmP YOhTvvUlpzzQiyIE2hgfAIqgCfZgpimPwBPssIgmUWyc49afh1+e3Uq8r1UXyEq9WtZO wLxsgw/12DPlzoE5nYirjjsXtirSt3fm17rEC8sRJ33+IZb+Wn4ylZzasAjLDUF3yrf8 OIZIE681+v0c2hdUMRnW45yLTEhk9hsIt28XBso/6pZdBPY7haFRP5udXhLKNMRhiHJK WFew== X-Gm-Message-State: AOAM532v48qgwtFyk+7rKVrg0xEwXTTh4f4SNpbRsqaRaQx6gX6C+S0S /+k6lZue9NNG4ljepSmWo8/EPA== X-Google-Smtp-Source: ABdhPJybLGEC9Vkbo3afR1e0rkiE4Uqi81y09rG7Z316acKAzGcUboScxSHByPFqPGL4yR3GT9b3Ew== X-Received: by 2002:ac8:279a:: with SMTP id w26mr18731669qtw.309.1592870726664; Mon, 22 Jun 2020 17:05:26 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id n143sm1204192qkn.94.2020.06.22.17.05.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 17:05:26 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.93) (envelope-from ) id 1jnWRJ-00CHPu-Cd; Mon, 22 Jun 2020 21:05:25 -0300 Date: Mon, 22 Jun 2020 21:05:25 -0300 From: Jason Gunthorpe To: Jerome Glisse Cc: Daniel Vetter , Thomas =?utf-8?B?SGVsbHN0csO2bSAoSW50ZWwp?= , DRI Development , linux-rdma , Intel Graphics Development , Maarten Lankhorst , LKML , amd-gfx list , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Thomas Hellstrom , Daniel Vetter , "open list:DMA BUFFER SHARING FRAMEWORK" , Christian =?utf-8?B?S8O2bmln?= , Mika Kuoppala Subject: Re: [Linaro-mm-sig] [PATCH 04/18] dma-fence: prime lockdep annotations Message-ID: <20200623000525.GX6578@ziepe.ca> References: <20200618172338.GM6578@ziepe.ca> <20200619113934.GN6578@ziepe.ca> <20200619151551.GP6578@ziepe.ca> <20200619172308.GQ6578@ziepe.ca> <20200619180935.GA10009@redhat.com> <20200619181849.GR6578@ziepe.ca> <20200619201011.GB13117@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200619201011.GB13117@redhat.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Fri, Jun 19, 2020 at 04:10:11PM -0400, Jerome Glisse wrote: > Maybe we can audit how user ptr buffer are use today and see if > we can define a usage pattern that would allow to cut corner in > kernel. For instance we could use mmu notifier just to block CPU > pte update while we do GUP and thus never wait on dma fence. The DMA fence is the main problem, if you can think of a way to avoid it then it would be great! > Then GPU driver just keep the GUP pin around until they are done > with the page. They can also use the mmu notifier to keep a flag > so that the driver know if it needs to redo a GUP ie: > > The notifier path: > GPU_mmu_notifier_start_callback(range) > gpu_lock_cpu_pagetable(range) > for_each_bo_in(bo, range) { > bo->need_gup = true; > } > gpu_unlock_cpu_pagetable(range) So some kind of invalidation tracking? But this doesn't solve COW and Fork problem? > > It is kind of unrelated to HMM, it just shouldn't be using mmu > > notifiers to replace page pinning.. > > Well my POV is that if you abide by rules HMM defined then you do > not need to pin pages. The rule is asynchronous device page table > update. I think one of the hmm rules is to not block notifiers for a long time, which these scheme seem to violate already. Pinning for a long time is less bad than blocing notifiers for a long time, IMHO Jason