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=-7.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,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 AE7EAC433DF for ; Tue, 25 Aug 2020 14:42:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 57D4B20578 for ; Tue, 25 Aug 2020 14:42:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="K4M5BGdK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57D4B20578 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C16708E000A; Tue, 25 Aug 2020 10:42:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC6428D0001; Tue, 25 Aug 2020 10:42:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB5AE8E000A; Tue, 25 Aug 2020 10:42:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 9245E8D0001 for ; Tue, 25 Aug 2020 10:42:10 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4FA68181AEF23 for ; Tue, 25 Aug 2020 14:42:10 +0000 (UTC) X-FDA: 77189356020.07.event69_48122542705c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 0C7C01803FD61 for ; Tue, 25 Aug 2020 14:42:10 +0000 (UTC) X-HE-Tag: event69_48122542705c X-Filterd-Recvd-Size: 4846 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Tue, 25 Aug 2020 14:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598366528; 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: in-reply-to:in-reply-to:references:references; bh=1PxHK07pzXYHK1FypslTBPNlk/QUqT+EnjfLL/+phFE=; b=K4M5BGdKZRQzmlt1VXTTstlktQ9uP8dIhLGjOrpySNbLYq0dyiaH9CXEcuBTjEa4GZkZsh W71R2ateE/nWhqLKTf56T46WBoE43U6redlemXwTn5gSi2uum4fHDEtXsFHKj/HxCq/e0i +dJGn/J1jLB0Mir1PEAYLGIeFnrGKHI= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-558-rG6SUPgVMoWs_RbhtBoM7w-1; Tue, 25 Aug 2020 10:42:06 -0400 X-MC-Unique: rG6SUPgVMoWs_RbhtBoM7w-1 Received: by mail-qv1-f72.google.com with SMTP id l18so8811854qvq.16 for ; Tue, 25 Aug 2020 07:42:06 -0700 (PDT) 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=1PxHK07pzXYHK1FypslTBPNlk/QUqT+EnjfLL/+phFE=; b=KbzX0DTYI/L17UbwMa/lgsuJc4VbN0RnZo7XYBf0hHgWgCq5+O9mvt/RAEjiwjA4kZ 958OHdVyDw1X8tZBfqdRLFiahM9e5MRfgct1r9qWPgXqhzEN19Yw9UmVPDlklZmJlZbT yeYi79WN3h9cU8jfb8yisQY+FXG1P5/dXpAAuDLC+WIFGdYuUx344F/2BPY2kaFXyLzB On2zc4MkeGJA+LuoKpjxDN5xgCXfXeBgYFxFnlyF9TUnIwy6VGbbGM08yStoEeXSdk03 wnq43ztY6C8GL+4RuPTaIlKBa6cpRvGCz/LLDtxekz9tw2S93PNTjFI7f6RbaXrgtWCD 2n1w== X-Gm-Message-State: AOAM530FnnsfXdSRiQ1GU8bPQ3MwMKaH86MbMwuyXOM5Vzt1k6q2L6wf MuuIwj2S3WUfi2YISOdq7uDFKZXOZPqZ34HAhQfOV/dq/Q5jbzLnS+t+mFp9guB6BmDAulOy15J 82eDQV7GEWvk= X-Received: by 2002:a37:4d13:: with SMTP id a19mr7604506qkb.456.1598366525949; Tue, 25 Aug 2020 07:42:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6JqBcCZsWXYyvcmaeETW8DHBr1KnBqsO9L4MFzqfTnOnoaLsPJskqCpzvHf6djk6yAKGTSQ== X-Received: by 2002:a37:4d13:: with SMTP id a19mr7604480qkb.456.1598366525669; Tue, 25 Aug 2020 07:42:05 -0700 (PDT) Received: from xz-x1 (bras-vprn-toroon474qw-lp130-11-70-53-122-15.dsl.bell.ca. [70.53.122.15]) by smtp.gmail.com with ESMTPSA id q34sm14160230qtk.32.2020.08.25.07.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 07:42:04 -0700 (PDT) Date: Tue, 25 Aug 2020 10:42:03 -0400 From: Peter Xu To: Alistair Popple Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , =?utf-8?B?SsOpcsO0bWU=?= Glisse , John Hubbard , Ralph Campbell , stable@vger.kernel.org Subject: Re: [PATCH v2 2/2] mm/rmap: Fixup copying of soft dirty and uffd ptes Message-ID: <20200825144203.GA8235@xz-x1> References: <20200825064232.10023-1-alistair@popple.id.au> <20200825064232.10023-2-alistair@popple.id.au> MIME-Version: 1.0 In-Reply-To: <20200825064232.10023-2-alistair@popple.id.au> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Queue-Id: 0C7C01803FD61 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Tue, Aug 25, 2020 at 04:42:32PM +1000, Alistair Popple wrote: > During memory migration a pte is temporarily replaced with a migration > swap pte. Some pte bits from the existing mapping such as the soft-dirty > and uffd write-protect bits are preserved by copying these to the > temporary migration swap pte. > > However these bits are not stored at the same location for swap and > non-swap ptes. Therefore testing these bits requires using the > appropriate helper function for the given pte type. > > Unfortunately several code locations were found where the wrong helper > function is being used to test soft_dirty and uffd_wp bits which leads > to them getting incorrectly set or cleared during page-migration. > > Fix these by using the correct tests based on pte type. > > Fixes: a5430dda8a3a ("mm/migrate: support un-addressable ZONE_DEVICE page in migration") > Fixes: 8c3328f1f36a ("mm/migrate: migrate_vma() unmap page from vma while collecting pages") > Fixes: f45ec5ff16a7 ("userfaultfd: wp: support swap and page migration") > Signed-off-by: Alistair Popple > Cc: stable@vger.kernel.org Reviewed-by: Peter Xu -- Peter Xu