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 6563EC433EF for ; Wed, 16 Feb 2022 19:24:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D73126B0074; Wed, 16 Feb 2022 14:24:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF9E96B0075; Wed, 16 Feb 2022 14:24:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4EB46B0078; Wed, 16 Feb 2022 14:24:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id A385B6B0074 for ; Wed, 16 Feb 2022 14:24:18 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 674E08249980 for ; Wed, 16 Feb 2022 19:24:18 +0000 (UTC) X-FDA: 79149618996.26.1636B97 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id A122E40010 for ; Wed, 16 Feb 2022 19:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645039457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AsqS7+VmvWZcYN9LZSwD5nLjJsRjkPDbXjgKl7v7Go4=; b=Tlf6bFCZwLs84t71e4Mu9/PBoWedmbwRma3Ehk2CFjop34m+GOF5hwneE2ICwEmiLoeUpl b9zV9C8kSrfhg6nXjGqj3aj/BKBZVNAbzrZi3GnLso2H8vveV5hnxrb+nU/u1FDQs3T8f8 dBkKVbL9riUe/2IrJfGx+AKUXz+UcxE= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-MA80QnEQMoGBmj4mIclxxw-1; Wed, 16 Feb 2022 14:24:15 -0500 X-MC-Unique: MA80QnEQMoGBmj4mIclxxw-1 Received: by mail-ed1-f69.google.com with SMTP id cr7-20020a056402222700b0040f59dae606so2173511edb.11 for ; Wed, 16 Feb 2022 11:24:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=AsqS7+VmvWZcYN9LZSwD5nLjJsRjkPDbXjgKl7v7Go4=; b=b8yTbSus6/CZyAoxKGKa72ivhyJHcIN5qLOKP149QYShl/3Z1dofmmdNKgqz9mYmQN SdH4VLORNASLvzhy8hROGoLGF3CGmo7MDbwCgpIk5tm6UHSp3J8SWEKvHxztzvkqhFn6 EFwnpvQ/R6v6WA4EOJBo/MA3HiOtC6HfX3zviPUQLyNy41amNO2t5GF9Y+DF30Lbmcuf rF9TadrIPFi18+aWKPPjAdDd5Nh+ywP2hlPKOzH0EkDBNTCTjMz2c8SRC/D3Qs/Pa63D 73TOGWoPDnOBpMQf4nA9Yc5UBViCK9I2CNwB2Qij+8OhpM38krut5isQb6bgGhj7kmni KSxQ== X-Gm-Message-State: AOAM533Xlg7ZZc8EeBWDoGE6DtY3awXqVlLfTUmn/3ALRjMgjQWJz/y4 4GodVJtNAcYHwMX0fryiynrnBRb+/mZ7UPxncbx4da1hyWY29AqpZ7W5v6H7vfpcTz2fNpF62D7 J2zY65s9FSLo= X-Received: by 2002:a05:6402:2753:b0:410:b9a4:399e with SMTP id z19-20020a056402275300b00410b9a4399emr4670800edd.187.1645039454669; Wed, 16 Feb 2022 11:24:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJybomThG6iWBChnuKd2KiR+xifx00F8DOt/ReKiiZEgpvB3l6rMkzRx8hXMQJcqbQp/w4IK4Q== X-Received: by 2002:a05:6402:2753:b0:410:b9a4:399e with SMTP id z19-20020a056402275300b00410b9a4399emr4670769edd.187.1645039454462; Wed, 16 Feb 2022 11:24:14 -0800 (PST) Received: from ?IPV6:2003:cb:c70b:600:4ff7:25c:5aad:2711? (p200300cbc70b06004ff7025c5aad2711.dip0.t-ipconnect.de. [2003:cb:c70b:600:4ff7:25c:5aad:2711]) by smtp.gmail.com with ESMTPSA id r6sm240566ejd.100.2022.02.16.11.24.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Feb 2022 11:24:14 -0800 (PST) Message-ID: <39d17db6-0f8a-0e54-289b-85b9baf1e936@redhat.com> Date: Wed, 16 Feb 2022 20:24:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 To: Linus Torvalds , Oded Gabbay Cc: 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 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> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A122E40010 X-Stat-Signature: qi6ar9498mox5mk9ks6zpzzzh5z69kkr Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Tlf6bFCZ; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf27.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1645039457-29955 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 16.02.22 20:04, Linus Torvalds wrote: > [ Added David Hildenbrand to the participants. David, see > > https://bugzilla.kernel.org/show_bug.cgi?id=215616 > > for details ] > Thanks for sharing. > 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. What I shared so far recently [1] was part 1 of my COW fixes to fix the COW security issues -- missed COW. This fixes 1) of [2]. Part 2 is around fixing "wrong COW" for FOLL_PIN a.k.a. memory corruption. That's essentially what PageAnonExclusive() will be all about, making sure that we don't lose synchronicity between GUP and mm due to a wrong COW. This will fix 3) of [2] Part 3 is converting O_DIRECT to use FOLL_PIN instead of FOLL_GET to similarly fix "wrong COW" for O_DIRECT. John is working on that. This will fix 2) of [2]. > > 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? If it uses FOLL_PIN it might be handled by part 2, if it uses O_DIRECT magic it might be covered by part 3. If neither of both, more work might be needed to convert it to FOLL_PIN, as with the new COW logic we won't be able to have the same guarantees for FOLL_GET as we'll have for FOLL_PIN (which is a difference to our original plans to fix it all [3]). [1] https://lkml.kernel.org/r/20220126095557.32392-1-david@redhat.com [2] https://lore.kernel.org/all/3ae33b08-d9ef-f846-56fb-645e3b9b4c66@redhat.com/ [3] https://lore.kernel.org/all/20211217113049.23850-1-david@redhat.com/T/#u -- Thanks, David / dhildenb