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 3CD73C433EF for ; Tue, 19 Apr 2022 12:12:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BCED18D006B; Tue, 19 Apr 2022 08:12:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B56FD8D0047; Tue, 19 Apr 2022 08:12:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AAB18D006B; Tue, 19 Apr 2022 08:12:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 85BAD8D0047 for ; Tue, 19 Apr 2022 08:12:46 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 507E9221C for ; Tue, 19 Apr 2022 12:12:46 +0000 (UTC) X-FDA: 79373517132.20.AE6D698 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 735064000B for ; Tue, 19 Apr 2022 12:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650370365; 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=bpFSXrBn9i8XVmZWcxjOCjor87VdZpZNStC/r8yG5AE=; b=Mkt2zo+1Td8hGp2LSMIQpwP6Uiovn/d3oCUQLsRDVMANcL5X7Ge6KpVI2fS1AUODQlB4Mf eX9nLYtdEGuM5StSUHcVwpr+8umCE8lLfrDN9E3tZniG4HcMtpQg5t3a2mpu+7mUD9+TWD 5VTQCrQ8nGMl70vm6WDvLyTb8peNv2U= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-ms0apgYqPeifqyNyxmEzrw-1; Tue, 19 Apr 2022 08:12:44 -0400 X-MC-Unique: ms0apgYqPeifqyNyxmEzrw-1 Received: by mail-wr1-f72.google.com with SMTP id s13-20020adfa28d000000b00205e049cff2so1882226wra.17 for ; Tue, 19 Apr 2022 05:12:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=bpFSXrBn9i8XVmZWcxjOCjor87VdZpZNStC/r8yG5AE=; b=WGmbnjvvzc7Tlai+S9O0f8MxjG0ZyY1YhblYUiU0m7YPohaP5+dB6vpxvVCC4rGH3e qapKp0qEGLvPqQoOfu8KL8autXIFmHPOKvofLxcH1YVa9c55snaOeBBVLdCa0W0rbPnF yvHcdD6Ixk0GDcWPTGY55H9PLSl+/dKF0OJ4w2Kd2DhRhF799pO2wX+QZ6QcILCCQj+q bUZ1EK0rNwlI6kEc3Y34OgzJWdyVcPuzpQSIp2q4NLxWWBaH30hHn9DmG1XiLwjOv0w7 jg4U+YgJ6kgIMHGj27hOk6J9Q1q129zNqefkKEaPZU/nUI3KKJDr+uCVy7byjpzSP93U tyTg== X-Gm-Message-State: AOAM532WiXxXtNT3eKrfofeCYHpr3MSyFduM1fmw89kN1Ra6GY/tdnBY AaDUsIM2kB9ZbmrZ3MWjnTD3msR9KiXMe+30nX5eLlu52obx4mG+wTpr8BNfA8tWeDVqQcaiEMN R9qZOHgKmRGE= X-Received: by 2002:a05:600c:1e1e:b0:38e:baaa:aae0 with SMTP id ay30-20020a05600c1e1e00b0038ebaaaaae0mr15235092wmb.157.1650370362916; Tue, 19 Apr 2022 05:12:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/QTfXp55+8oe5vjVX8Svx2TIPDgx3b4qKD4rBNj7p2vVxT+AoJNVa0rGfqlm+fH7v+GYhnQ== X-Received: by 2002:a05:600c:1e1e:b0:38e:baaa:aae0 with SMTP id ay30-20020a05600c1e1e00b0038ebaaaaae0mr15235068wmb.157.1650370362644; Tue, 19 Apr 2022 05:12:42 -0700 (PDT) Received: from ?IPV6:2003:cb:c704:5d00:d8c2:fbf6:a608:957a? (p200300cbc7045d00d8c2fbf6a608957a.dip0.t-ipconnect.de. [2003:cb:c704:5d00:d8c2:fbf6:a608:957a]) by smtp.gmail.com with ESMTPSA id 9-20020a056000154900b0020a849e1c41sm9323296wry.13.2022.04.19.05.12.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Apr 2022 05:12:42 -0700 (PDT) Message-ID: <7308d733-1e0b-7d2e-bc34-0757555d39d6@redhat.com> Date: Tue, 19 Apr 2022 14:12:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 To: Miaohe Lin , akpm@linux-foundation.org Cc: willy@infradead.org, vbabka@suse.cz, dhowells@redhat.com, neilb@suse.de, apopple@nvidia.com, surenb@google.com, minchan@kernel.org, peterx@redhat.com, sfr@canb.auug.org.au, rcampbell@nvidia.com, naoya.horiguchi@nec.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220416030549.60559-1-linmiaohe@huawei.com> <1b614ac3-02c0-ec66-b51a-e9b7e1a375ad@huawei.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v2] mm/swapfile: unuse_pte can map random data if swap read fails In-Reply-To: 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 X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 735064000B X-Stat-Signature: rst3skyfcbrd3c3bab5xxwj5eop5hkoc Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Mkt2zo+1; spf=none (imf12.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1650370364-131568 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 19.04.22 14:00, Miaohe Lin wrote: > On 2022/4/19 19:46, David Hildenbrand wrote: > ... >>> Do you mean that we should set the pfn to 0 for the hwpoison marker so that we can >>> distinguish swapin error case from real hwpoison case? >> >> I am not sure if we really have to distinguish. However, "0" seems to >> make sense to indicate "this is not an actual problematic PFN, the >> information is simply no longer around due to a hardware issue. >> > > IMHO, we have to distinguish. For example, we might need to return VM_FAULT_SIGBUS > instead of VM_FAULT_HWPOISON when user accesses the error page. Or should we simply > return VM_FAULT_HWPOISON to simplify the handling? Hm, you're right. In e.g., x86 do_sigbus() we would send an BUS_MCEERR_AR. So yes, if we reuse is_hwpoison_entry() we'd have to convert to either VM_FAULT_HWPOISON or VM_FAULT_SIGBUS. Something like "is_error_entry()" that can further be refined to hwpoison or swapin could make sense. But what you have here is straight forward to me as well. Whatever you/others prefer. Acked-by: David Hildenbrand NIT: I'd make the terminology make_swapin_error_entry() consistent with SWAP_READ_ERROR and especially existing SWP_. For example, calling the latter SWP_SWAPIN_ERROR -- Thanks, David / dhildenb