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 41156C54EE9 for ; Fri, 2 Sep 2022 06:49:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDEC6800C4; Fri, 2 Sep 2022 02:49:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B678D8008D; Fri, 2 Sep 2022 02:49:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E16A800C4; Fri, 2 Sep 2022 02:49:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 89D788008D for ; Fri, 2 Sep 2022 02:49:26 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 566ECA099B for ; Fri, 2 Sep 2022 06:49:26 +0000 (UTC) X-FDA: 79866219132.22.EB6B542 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf06.hostedemail.com (Postfix) with ESMTP id DD9FB18003F for ; Fri, 2 Sep 2022 06:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662101365; 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=Gn1/pFkVAm17ZLauzUxMQF2RNXwPzrIq/JD90gpJ8rE=; b=JHzNlzhUeuc+1rmM5aeW+PuK3y4xPlRRhod0WldM+v67gkO71IY4U0ACaLRkD9RXwAJXX3 W3QJIS80AtPG8y12UCvrJ4ehaBi0HNOKFrwHKan2L23D7NNEQvmKVluBYbQKDWEt+yTuQd eoq/lltCnFhuyIkSKBGvAONKD/HPx6k= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-557-KbRbmgooOgSzDwVnhp8_ug-1; Fri, 02 Sep 2022 02:49:22 -0400 X-MC-Unique: KbRbmgooOgSzDwVnhp8_ug-1 Received: by mail-wm1-f69.google.com with SMTP id a17-20020a05600c349100b003a545125f6eso2497528wmq.4 for ; Thu, 01 Sep 2022 23:49:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=Gn1/pFkVAm17ZLauzUxMQF2RNXwPzrIq/JD90gpJ8rE=; b=3I8x+/GCJAD5gc9DihLgo3bSNkEwEDK5zNQZg+b3jFuI4fwHp0a5B2mVY1K/p0GUsD eFsHQ2CkmTlM94cLbpZjfKkILvMB0MUurNqVE304DkIQ0BpBkTDSpfeTqRBxwwFbAgLL Xl81w/N+bqn49R2RMEtf2URNCukdyb6DwFDXMas2P6dBRFI8HuqICSX+opbpNRqq89jT MBv2OLMLJFaZypFA0sa6K61YWQwFa3tu70KkR8cx4z/YSzN3JJi9Csg310wf48l4ylug 4uurQuLo5xuNJFSeQs2Uw0tqsSugTLwHDutA9LC37/7EBkf0F0Y8+Mj1tcyKa3vj9Dc2 Dimw== X-Gm-Message-State: ACgBeo1tLNv72BRum+a+qcLWCn7h6PwL3ECMb4fQ3D0tqa7e7emmnm7m qcJl4JOP0ci5QgE/GJ92DVW6YORoHxRboBeNMJ03Df8THoHBtvL9Qb9qYL0Dih+zFcMhheztzHN 6JXj3/nQ4Clo= X-Received: by 2002:a05:6000:817:b0:226:3d89:ebb4 with SMTP id bt23-20020a056000081700b002263d89ebb4mr17030582wrb.699.1662101361045; Thu, 01 Sep 2022 23:49:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR6On1hWE9c9E9R4xYZDbPw8MSd6lWCiA5BI3pDap4N3u8UFtfr1D4s/X8k/SOFVxoKi18Qhbg== X-Received: by 2002:a05:6000:817:b0:226:3d89:ebb4 with SMTP id bt23-20020a056000081700b002263d89ebb4mr17030567wrb.699.1662101360797; Thu, 01 Sep 2022 23:49:20 -0700 (PDT) Received: from ?IPV6:2003:cb:c714:4800:2077:1bf6:40e7:2833? (p200300cbc714480020771bf640e72833.dip0.t-ipconnect.de. [2003:cb:c714:4800:2077:1bf6:40e7:2833]) by smtp.gmail.com with ESMTPSA id g13-20020a05600c4ecd00b003a4c6e67f01sm9088534wmq.6.2022.09.01.23.49.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Sep 2022 23:49:20 -0700 (PDT) Message-ID: <093bae05-419d-737d-73f0-6de59b39b34a@redhat.com> Date: Fri, 2 Sep 2022 08:49:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, Jason Gunthorpe , John Hubbard , Andrea Arcangeli , Hugh Dickins , Peter Xu , Alistair Popple , Nadav Amit , Yang Shi , Vlastimil Babka , Michal Hocko , Mike Kravetz , Andrea Parri , Will Deacon , Peter Zijlstra , "Paul E. McKenney" , Christoph von Recklinghausen , Don Dutile References: <20220901083559.67446-1-david@redhat.com> <20220901153512.a59e9e584fb00a350788f56e@linux-foundation.org> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v1] mm: fix PageAnonExclusive clearing racing with concurrent RCU GUP-fast In-Reply-To: <20220901153512.a59e9e584fb00a350788f56e@linux-foundation.org> 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662101366; a=rsa-sha256; cv=none; b=2LJ40i2AM/riZb4bfsX3NNd4bGWgVFvvXO1xEQfVWGuuwvhJQ1Ikycd0eOFyuMME7wS85a Ifg3Y+NvgOIt7xcAKX+UClMChopCUsNj2x+bW+jd4a8hONM3f5G5m8NFasBlHshCJmTTvY HPNGCwWqDK0AVoMZoEmvfuFEm89dMms= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JHzNlzhU; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf06.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662101366; h=from:from:sender: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:dkim-signature; bh=Gn1/pFkVAm17ZLauzUxMQF2RNXwPzrIq/JD90gpJ8rE=; b=uYou7zxKTZhVWMCMwtxySERrz/0YLF+pKeU+6MLLTAmEABLIn3S89llempKOgZEDudgswj R3A0Z2UbY6Q4RYAJRvjkFSpAQyZ94Fx0FkM4kI6wcyOPqPsXf9EibgS0dT419BcNR/HFBD 0y80FSQPM8uCuA3OrAfmX9SjX+BLoTc= X-Rspamd-Server: rspam09 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=JHzNlzhU; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf06.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com X-Rspam-User: X-Stat-Signature: q7zkmfr9tiip1zhb99gz5igqotmzh8gr X-Rspamd-Queue-Id: DD9FB18003F X-HE-Tag: 1662101365-200466 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 02.09.22 00:35, Andrew Morton wrote: > On Thu, 1 Sep 2022 10:35:59 +0200 David Hildenbrand wrote: > >> The possible issues due to reordering are of theoretical nature so far >> and attempts to reproduce the race failed. >> >> Especially the "no PTE change" case isn't the common case, because we'd >> need an exclusive anonymous page that's mapped R/O and the PTE is clean >> in KSM code -- and using KSM with page pinning isn't extremely common. >> Further, the clear+TLB flush we used for now implies a memory barrier. >> So the problematic missing part should be the missing memory barrier >> after pinning but before checking if the PTE changed. > > Obscure bug, large and tricky patch. Is a -stable backport really > justifiable? Fair question, was asking myself the same. As you're wondering about the same, I don't think so. Let's drop it. Out of the CONFIG_HAVE_FAST_GUP supporting architectures primarily only the 32bit architectures can even lose the PageAnonExclusive during swapout (until we make them all preserve it in the swp PTE), the other ones already support preserve it. So unless fork() would be involved at the wrong time as well, x86-64, s390x, aarch64, ppc64 book3s ... wouldn't even have a real issue with this race. (note that the actual code changes are small -- but yes, I think linux-stable rules always consider the full patch LOC) -- Thanks, David / dhildenb