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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A85B0C433F5 for ; Wed, 16 Feb 2022 19:21:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0CB8A6B0074; Wed, 16 Feb 2022 14:21:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 07BBA6B0075; Wed, 16 Feb 2022 14:21:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E84796B0078; Wed, 16 Feb 2022 14:21:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id DA2C26B0074 for ; Wed, 16 Feb 2022 14:21:22 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0BF66181AC9CC for ; Wed, 16 Feb 2022 19:21:21 +0000 (UTC) X-FDA: 79149611562.21.7E6ED89 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf19.hostedemail.com (Postfix) with ESMTP id 782131A0013 for ; Wed, 16 Feb 2022 19:21:20 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A1618B81FC7 for ; Wed, 16 Feb 2022 19:21:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08225C340F9 for ; Wed, 16 Feb 2022 19:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645039277; bh=xVJhQv2N+t/b1QKR6ESSmdKPDVDMHh6xIUIeUWMzHo0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=k+aEFJjhitH/g+iZUKGCYbj8dkMVFYAHmFjivuX833DieaVFIY/hrBALaHOWYdK6t wY9whU+EMfyKpQKcUMWVUqpmUq+Nm17z6EB7o0M5dXh5/nLhTvf3CDYz5bEQoxRurb rGdg8ndG44kOWwaJHhEd/2UF7U3HL89C+SRq2YZWGZUU1lydU37Amy2XsG0wX6ZDr7 EqdGAWNgStZVV5PIoALiZ/BrNUTgVt+F6OdPOUucKa4tQEhwzQE+T9p8YGU/6fYPZ/ uyxRA7MIgLLSqroqgoAEWvA8ByHNftbEX+SB9evdFXm3JEJtvgOpmnoP+9FHp5KMEq x94GA/ZvRZ8fg== Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-2d66f95f1d1so9663737b3.0 for ; Wed, 16 Feb 2022 11:21:16 -0800 (PST) X-Gm-Message-State: AOAM530G9rawfVd1ZYPmYISDoAtb43zXthCzA7CwZd4mw7sB4ubg4y2M VwjklyRQ/YJTaEG/xeNLgZNSZFMqpCNVPaD1W0w= X-Google-Smtp-Source: ABdhPJwR4ZTHAWlv6WG1amfCcdTCRPzx8xNifoprVymvxos5k0ZbWavHyZomK65dliV+z6ad38p0ufYBDpizWKpTOF4= X-Received: by 2002:a81:5354:0:b0:2ca:287c:6b5e with SMTP id h81-20020a815354000000b002ca287c6b5emr3833390ywb.3.1645039275845; Wed, 16 Feb 2022 11:21:15 -0800 (PST) MIME-Version: 1.0 References: <20200917112538.GD8409@ziepe.ca> <20200917193824.GL8409@ziepe.ca> <20200918164032.GA5962@xz-x1> <20200918173240.GY8409@ziepe.ca> <20200918204048.GC5962@xz-x1> <0af8c77e-ff60-cada-7d22-c7cfcf859b19@nvidia.com> <20200919000153.GZ8409@ziepe.ca> <20200921083505.GA5862@quack2.suse.cz> <20200921120301.GD8409@ziepe.ca> In-Reply-To: From: Oded Gabbay Date: Wed, 16 Feb 2022 21:20:49 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification To: Linus Torvalds Cc: David Hildenbrand , Jason Gunthorpe , Jan Kara , John Hubbard , Leon Romanovsky , Linux-MM , Linux Kernel Mailing List , "Maya B . Gokhale" , Yang Shi , Marty Mcfadden , Kirill Shutemov , Oleg Nesterov , Jann Horn , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton , Daniel Vetter , Greg Kroah-Hartman , Peter Xu , dave@sr71.net Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=k+aEFJjh; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf19.hostedemail.com: domain of ogabbay@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=ogabbay@kernel.org X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 782131A0013 X-Stat-Signature: bhm7848wkws6x1kx5nxndkphock6ekfs X-HE-Tag: 1645039280-15975 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 Wed, Feb 16, 2022 at 9:04 PM Linus Torvalds wrote: > > [ Added David Hildenbrand to the participants. David, see > > https://bugzilla.kernel.org/show_bug.cgi?id=215616 > > for details ] > > On Wed, Feb 16, 2022 at 8:59 AM Oded Gabbay wrote: > > > > All the details are in the bug, but the bottom line is that somehow, > > this patch causes corruption when the numa balancing feature is > > enabled AND we don't use process affinity AND we use GUP to pin pages > > so our accelerator can DMA to/from system memory. > > Hmm. I thought all the remaining issues were related to THP - and > David Hildenbrand had a series to fix those up. > > The fact that it also shows up with numa balancing is a bit > unfortunate, because I think that means that that patch series may not > have caught that case. > > That said - what does "we use GUP to pin pages" mean? Does it actually > use the pinning logic, or just regular old GUP? > > I'm assuming this is just the existing pin_user_pages_fast() (ie a > proper pin) in drivers/misc/habanalabs/common/memory.c. But I wanted > to confirm that it's not some other situation. > > Linus > [Adding dave hansen as we chatted about it in irc] It uses the pinning logic, simply calling pin_user_pages_fast with the relevant gup flags to pin the userspace memory so we can after that dma map it and give the bus address to the h/w. And afaik, the gup flags combination we use (FOLL_FORCE | FOLL_WRITE | FOLL_LONGTERM) is the correct combination, at least according to the last time it was discussed with Daniel, Jason and other people. Oded