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=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 84D67C433E1 for ; Thu, 25 Mar 2021 13:26:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 26F9F61A21 for ; Thu, 25 Mar 2021 13:26:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26F9F61A21 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 BA4E86B0070; Thu, 25 Mar 2021 09:26:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7C126B0071; Thu, 25 Mar 2021 09:26:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A44756B0072; Thu, 25 Mar 2021 09:26:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 8C3AF6B0070 for ; Thu, 25 Mar 2021 09:26:58 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 42085184906A8 for ; Thu, 25 Mar 2021 13:26:58 +0000 (UTC) X-FDA: 77958472116.37.DE2F9B7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id CB14740002CD for ; Thu, 25 Mar 2021 13:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616678817; 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=a7dXEhzDM8nht06maXaxbRAGJ8eg/xNLTmKGD4z3kwA=; b=EK18sTDaBj39PI23U13KMS80VoDglDlrpAVmVX/n0AIYSplsbp/giS6UjaXCmI5Ui2JcoB XBDRp70gXE7lRSKt1R9D/ZDrEYQEdpN8U+N+9gu0sJ1vQBGpDB0p3ZD+3vfMACzsKdK00f 5SkM1WURnmJzSYtZjsL+/6dhkeMv78E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-172-YCoyq08tM3i3hKt7da7ltA-1; Thu, 25 Mar 2021 09:26:53 -0400 X-MC-Unique: YCoyq08tM3i3hKt7da7ltA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 121D8108BD07; Thu, 25 Mar 2021 13:26:52 +0000 (UTC) Received: from [10.36.115.72] (ovpn-115-72.ams2.redhat.com [10.36.115.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0217269112; Thu, 25 Mar 2021 13:26:36 +0000 (UTC) Subject: Re: [PATCH v3 3/5] mm/migrate.c: fix potential indeterminate pte entry in migrate_vma_insert_page() To: Miaohe Lin , akpm@linux-foundation.org Cc: jglisse@redhat.com, shy828301@gmail.com, aquini@redhat.com, apopple@nvidia.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20210325131524.48181-1-linmiaohe@huawei.com> <20210325131524.48181-4-linmiaohe@huawei.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Thu, 25 Mar 2021 14:26:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210325131524.48181-4-linmiaohe@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Stat-Signature: taj53qbnpbcd94913a13c134g11pyxyb X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CB14740002CD Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=170.10.133.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616678814-166643 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 25.03.21 14:15, Miaohe Lin wrote: > If the zone device page does not belong to un-addressable device memory, > the variable entry will be uninitialized and lead to indeterminate pte > entry ultimately. Fix this unexpected case and warn about it. > > Fixes: df6ad69838fc ("mm/device-public-memory: device memory cache coherent with CPU") > Signed-off-by: Miaohe Lin > --- > mm/migrate.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/mm/migrate.c b/mm/migrate.c > index dacbdc9710ac..87bbad578127 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -2968,6 +2968,13 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate, > > swp_entry = make_device_private_entry(page, vma->vm_flags & VM_WRITE); > entry = swp_entry_to_pte(swp_entry); > + } else { > + /* > + * For now we only support migrating to un-addressable > + * device memory. > + */ > + pr_warn_once("Unsupported ZONE_DEVICE page type.\n"); > + goto abort; > } > } else { > entry = mk_pte(page, vma->vm_page_prot); > Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb