Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp385856pxf; Thu, 25 Mar 2021 06:30:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRCvPktDtNAtoodJGQtreeCTwHbKpiXt4iE7k8UIUS4K9L64iK/ThqYIU4wcJR47XkUZIE X-Received: by 2002:a17:906:400b:: with SMTP id v11mr9383940ejj.194.1616679034691; Thu, 25 Mar 2021 06:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616679034; cv=none; d=google.com; s=arc-20160816; b=qNe4ToIMcOp0j/gIn4WjSy68nCbPIsOH/kQyxYU8EWlyUnJpq9LWVmo0Lft5b0lrN4 dD4lfobt2nEqQDNTUXiBN/+qF62x5QRmjKnwGmSpJHTd7FxnXpwsxDqx4Mt1riWDjSMQ tQf+Lbb0NwSan605/3c+XuWPPfYzLz0nNDV4jOUSup8bjA/55X+yMTFYoQnmNxRUD7Ph 08shUgxlchj7/+IUJKSn9fhqFhFEKtc1QieQARvl/Od+3oIV76udwzVNmf+m1HClmDSF J0hLuroBKprIivh5zjVpPEZK9FdKSjCWBEJ/cvuzTuYBpYUBnWIeVcHdNQHpz9VAeWNk jxwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=a7dXEhzDM8nht06maXaxbRAGJ8eg/xNLTmKGD4z3kwA=; b=FJVA5joKYqt0nUQcAHbmFAu8PpGngDRDq5OhzeIjuWo8dsyIHbW/4tqOzOCw267LSg cIrz2pslMo4JsBxS7B1rEYqT8GCCZTnW1Sat2YUzJ0CETFaPph8OA0uS0k93WybkHAkh e+CZo57oSVUpRhoFFYluEQmT8wPqfr1g68OU2bDekUP+MwWm52Tu/8x6PNN7XHujSavK 94XoMmlngbYEkY4MOUZntQzxAy+2mzVuLv1eTyj/W5U2rlxLlR3vKFPo9mYNgeO/uQln Xy2xqz3fAUN5pevq2s7js9R4VcasDakkXYLlucAjJPLQiK4Y5ticthum2TYtV+KWcm77 C0bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EK18sTDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si4050781edd.229.2021.03.25.06.30.09; Thu, 25 Mar 2021 06:30:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EK18sTDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230348AbhCYN07 (ORCPT + 99 others); Thu, 25 Mar 2021 09:26:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45812 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbhCYN06 (ORCPT ); Thu, 25 Mar 2021 09:26:58 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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