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 88FD9C433EF for ; Tue, 8 Mar 2022 17:48:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F69E8D0010; Tue, 8 Mar 2022 12:48:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 07FB08D0001; Tue, 8 Mar 2022 12:48:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3EB18D0010; Tue, 8 Mar 2022 12:48:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id D2CF78D0001 for ; Tue, 8 Mar 2022 12:48:03 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A96D161B9C for ; Tue, 8 Mar 2022 17:48:03 +0000 (UTC) X-FDA: 79221952446.02.22D28FB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 12880C0010 for ; Tue, 8 Mar 2022 17:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646761682; 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=FakVQP6MiE/Zi0gwIeYZLkyYTc78bBZSuWUh+KCXbNw=; b=ea0pueiQQ1mFi7hd1K005YrhMPmodHDRol0SxPyiwW0IPfYgnLlNvQYa9G23h4B6cgW9d+ bbJ2J6AHhKTsNmfH6v0EfZlgksFvvLi1ns39GKTcdrUW9uv07bcldLKLMYL4UkqSOVbEvs VnGMFlQ7T6nwZBd7eyGVyVUtGsrkMpY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-j5_xUK_uMOec4xorm1x1oQ-1; Tue, 08 Mar 2022 12:47:59 -0500 X-MC-Unique: j5_xUK_uMOec4xorm1x1oQ-1 Received: by mail-wm1-f69.google.com with SMTP id i83-20020a1c3b56000000b00389a203e5adso2136676wma.2 for ; Tue, 08 Mar 2022 09:47:58 -0800 (PST) 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=FakVQP6MiE/Zi0gwIeYZLkyYTc78bBZSuWUh+KCXbNw=; b=BA2cRSlW28dLLuJP+nAghWWVkNNNbtbfJ6W0Y7pjISpZPAWVZxvoLrMGAzQdA0nCQw 3m4Vc72dxSfC/Zna3Hts+R6xf93H8P/xDtON683nGxbjBTjip+luvRL83QVMPejodYd0 1l1kgDpUK+D9IMpXUgx6GAOQx4a7qnD310UHH+sx1ZjGayC1frDzOGmqGces01KIcHSv nkPgzincGp0eBT4qG8/SAisP3CN+JmqcrF9NY/NEh7ShX1f12q6rEzadG4HA3p5TgJE9 nXe/9dr+zF/GvLzkmip110Tvyzn8jbuWIHB2k4C15Y35wiNc/YrBV+BDDLTJx5/0Z3Ka Mtsg== X-Gm-Message-State: AOAM530v8BvNOgkCWN9E1dwZnS7MgNWgfRjB2SK3jNPFJa3b+BxJTvgt fqqMYvDQ3a/wpfqXiYxMGnSfUB6mRTz2XR84eifDZCM8/SdppmFa7rouaBtf54REQC0fNbODVr0 f8buAM21iXbE= X-Received: by 2002:a5d:4487:0:b0:1f1:232b:794f with SMTP id j7-20020a5d4487000000b001f1232b794fmr13637142wrq.715.1646761677978; Tue, 08 Mar 2022 09:47:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSc5uWGLBJT5WFw8W0WWnMeFJYAnXme99qyz4GnTqJ1cWsvoBhhkzFi7FmWm0wZEHWPxW2pQ== X-Received: by 2002:a5d:4487:0:b0:1f1:232b:794f with SMTP id j7-20020a5d4487000000b001f1232b794fmr13637130wrq.715.1646761677718; Tue, 08 Mar 2022 09:47:57 -0800 (PST) Received: from ?IPV6:2003:cb:c708:b000:acda:b420:16aa:6b67? (p200300cbc708b000acdab42016aa6b67.dip0.t-ipconnect.de. [2003:cb:c708:b000:acda:b420:16aa:6b67]) by smtp.gmail.com with ESMTPSA id z2-20020a056000110200b001e7140ddb44sm14380253wrw.49.2022.03.08.09.47.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Mar 2022 09:47:57 -0800 (PST) Message-ID: <6614d129-7635-5908-bab4-bb1f121e1742@redhat.com> Date: Tue, 8 Mar 2022 18:47:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 To: Linus Torvalds Cc: Andreas Gruenbacher , Alexander Viro , linux-s390 , Linux-MM , linux-fsdevel , linux-btrfs References: From: David Hildenbrand Organization: Red Hat Subject: Re: Buffered I/O broken on s390x with page faults disabled (gfs2) 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-Rspamd-Server: rspam10 X-Rspam-User: X-Stat-Signature: cab7gtci66k7p9n5tsw3pu4gmfjacm47 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ea0pueiQ; spf=none (imf22.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Queue-Id: 12880C0010 X-HE-Tag: 1646761682-950595 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 08.03.22 18:26, Linus Torvalds wrote: > On Tue, Mar 8, 2022 at 12:21 AM David Hildenbrand wrote: >> >> As raised offline already, I suspect >> >> shrink_active_list() >> ->page_referenced() >> ->page_referenced_one() >> ->ptep_clear_flush_young_notify() >> ->ptep_clear_flush_young() >> >> which results on s390x in: >> >> static inline pte_t pte_mkold(pte_t pte) >> { >> pte_val(pte) &= ~_PAGE_YOUNG; >> pte_val(pte) |= _PAGE_INVALID; >> return pte; >> } > > Yeah, that looks likely. > > It looks to me like GUP just doesn't care about _PAGE_INVALID on s390, > and happily looks up that page despite it not being "present" as far > as hardware is concerned. > > Your actual patch looks pretty nasty, though. We avoid marking it > accessed on purpose (to avoid atomicity issues wrt hw-dirty bits etc), > but still, that patch makes me go "there has to be a better way". It certainly only works if we don't have hw dirty bits that might get set concurrently -- for example, on s390x there is no such requirement. As raised by Gerald, arch_faults_for_dirty_pte (and existing arch_faults_on_old_pte) might be one option to get rid of the s390x special-casing, and detect any arch that might update the dirty bit concurrently. Interestingly, mm/huge_memory.c:touch_pmd() doesn't seem to care about concurrent dirty-bit updates by the hardware. Hmm. But, of course, I'm open for alternatives, maybe we could adjust fault_in_safe_writeable() to not use GUP as raised by you in the other reply. -- Thanks, David / dhildenb