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 69D8CC433C1 for ; Tue, 23 Mar 2021 10:26:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 06863619B7 for ; Tue, 23 Mar 2021 10:26:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06863619B7 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 7AF4D6B0147; Tue, 23 Mar 2021 06:26:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 785D06B0148; Tue, 23 Mar 2021 06:26:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64DF66B0149; Tue, 23 Mar 2021 06:26:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0084.hostedemail.com [216.40.44.84]) by kanga.kvack.org (Postfix) with ESMTP id 4B5DB6B0147 for ; Tue, 23 Mar 2021 06:26:51 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0AB9068AE for ; Tue, 23 Mar 2021 10:26:51 +0000 (UTC) X-FDA: 77950760622.38.CF0B390 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf21.hostedemail.com (Postfix) with ESMTP id E528FE0011ED for ; Tue, 23 Mar 2021 10:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616495209; 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=o1EVILgqN9eA2HDPMaXw6IaWbPaZYV9gku0uNytAiDc=; b=TePDuk/T3Q4pQT9YksXU/iShCPKATtNsyz3j3G5tBV3c0xW4NFsj/Ceuxiou83qzKZMAu5 1R5NwUpCR/2h59WL1D0yT8Gvz6UNL+MYL95w2j+L7LvJvbk3rvMKwqB3N4XrsTUROmnUPe NVpv8BR5u2U4veeBWPA1g9GPBBIGNuQ= 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-149-PDZt6JGdOoCUdWrE5Fv-7A-1; Tue, 23 Mar 2021 06:26:47 -0400 X-MC-Unique: PDZt6JGdOoCUdWrE5Fv-7A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E7E481007467; Tue, 23 Mar 2021 10:26:45 +0000 (UTC) Received: from [10.36.115.54] (ovpn-115-54.ams2.redhat.com [10.36.115.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D26521ECB; Tue, 23 Mar 2021 10:26:44 +0000 (UTC) Subject: Re: [PATCH 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, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20210320093701.12829-1-linmiaohe@huawei.com> <20210320093701.12829-4-linmiaohe@huawei.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <0bee2243-5771-4969-7b92-aaca67abc90c@redhat.com> Date: Tue, 23 Mar 2021 11:26:43 +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: <20210320093701.12829-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.84 on 10.5.11.23 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E528FE0011ED X-Stat-Signature: dkyj1aca8u8k7b933riddxzb98earsc5 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616495209-700321 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 20.03.21 10:36, 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 unexpectant case and warn about it. s/unexpectant/unexpected/ > > 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 20a3bf75270a..271081b014cb 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -2972,6 +2972,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. > + */ > + WARN_ON(1); > + goto abort; Fix it by crashing the kernel with panic_on_warn? :) If this case can actual happen, than no WARN_ON() - rather a pr_warn_once(). If this case cannot happen, why do we even care (it's not a fix then)? -- Thanks, David / dhildenb