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 919B4C433EF for ; Mon, 7 Mar 2022 23:18:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 149C18D0002; Mon, 7 Mar 2022 18:18:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F8B38D0001; Mon, 7 Mar 2022 18:18:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F01958D0002; Mon, 7 Mar 2022 18:18:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id DD28A8D0001 for ; Mon, 7 Mar 2022 18:18:22 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A2F36A944A for ; Mon, 7 Mar 2022 23:18:22 +0000 (UTC) X-FDA: 79219156044.28.612A7BC Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf19.hostedemail.com (Postfix) with ESMTP id 04FB01A000B for ; Mon, 7 Mar 2022 23:18:21 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id w7so15379603lfd.6 for ; Mon, 07 Mar 2022 15:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bvag9d2yKnVQ2WA/+ZCk8meLFVTu4t3Z/Y+Vhn7jLqs=; b=iE1Mpo/4WNvmX4KVx+vCPrRdmpw6OvR5A+gP5peGjMWmvtI9qqXJ7QVWhM5mmjDAr9 OxRVuE27WlAcAJxgb2qcdgwfIEVoyYkX+FP20GgX2hzl8hfi+DISfSMg4WgSb2Dw6/4C iRVzuKCVR8of2ZBhjlZfemAtmupGO2kDD76nQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bvag9d2yKnVQ2WA/+ZCk8meLFVTu4t3Z/Y+Vhn7jLqs=; b=hVeYUhh7pbYir+aTzBeGw3vz41PEyFM3VIcHalPXsmHHw723jeB1291+PIlU/LUnfo Oh7O27Yz99g+hCcXnANapjaHijAlMo+DQHDx8EaW2WnNGq/xk6jqIrQyykvO757uk5iR /kZWo1wHi0ABdMyIU0+JHc018QkqB6ro21DBTRhPrl9YRUmIF7TOgB7J+Xfb2kOpFos9 mPW61LiAvw2CF3Lamih0pVBWNGmzPwSCUd6dJuYRIBHiikSErC57MYo1EEZK4CYxGhNw tDIGmxmTZ5Ms7ZTs8T4pfRSK7t9UFFt9ZA+3N/A9mnQpOPFF18c4/sNkVcxsKiIEDZa7 VXXQ== X-Gm-Message-State: AOAM532Yu/e4NRBWrG69W/GjJpGd4F1AgNnm2rnAey0MesBHSexm3q1Y tB/kahlwEuNVeyfqlCHQbG8aScZpjmWLd+Wijhg= X-Google-Smtp-Source: ABdhPJwOH8gh+6658t/7beyrDggasAZHqZmiMXqh29NtMN3FOcKKilbd0YWjNK7gLrA32e+zSKNn7g== X-Received: by 2002:a05:6512:2812:b0:448:39f5:2211 with SMTP id cf18-20020a056512281200b0044839f52211mr1293061lfb.582.1646695099953; Mon, 07 Mar 2022 15:18:19 -0800 (PST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id n16-20020a0565120ad000b00443c3f383c5sm3105164lfu.231.2022.03.07.15.18.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Mar 2022 15:18:18 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id z11so13680251lfh.13 for ; Mon, 07 Mar 2022 15:18:18 -0800 (PST) X-Received: by 2002:a05:6512:3049:b0:447:d55d:4798 with SMTP id b9-20020a056512304900b00447d55d4798mr8957028lfb.531.1646695098272; Mon, 07 Mar 2022 15:18:18 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Mon, 7 Mar 2022 15:18:02 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Buffered I/O broken on s390x with page faults disabled (gfs2) To: Andreas Gruenbacher Cc: Alexander Viro , linux-s390 , Linux-MM , linux-fsdevel , linux-btrfs , David Hildenbrand Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 04FB01A000B X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b="iE1Mpo/4"; spf=pass (imf19.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.167.54 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Stat-Signature: ydubhkh9d69qgbgkcceuj1wwmawa5go1 X-HE-Tag: 1646695101-380776 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 Mon, Mar 7, 2022 at 2:52 PM Andreas Gruenbacher wrote: > > After generic_file_read_iter() returns a short or empty read, we fault > in some pages with fault_in_iov_iter_writeable(). This succeeds, but > the next call to generic_file_read_iter() returns -EFAULT and we're > not making any progress. Since this is s390-specific, I get the very strong feeling that the fault_in_iov_iter_writeable -> fault_in_safe_writeable -> __get_user_pages_locked -> __get_user_pages path somehow successfully finds the page, despite it not being properly accessible in the page tables. And it's presumably something specific in the s390x page table functionality that makes that happen. The places I'd look at in particular is to make sure that follow_page_mask() actually has the same rules as a real page table lookup on s390x. IOW, if follow_page_mask() finds the page and thinks it's writable, then it will return a 'page' successfully, and the __get_user_pages() code will be happy and say "it's there". But if then accessing the page by trying to write to it using the virtual address fails despite that, then you'll get the behavior you describe. I'd take a look at that can_follow_write_pte() case in particular, since this is a FOLL_WRITE thing, but it could be any of the pte checking details. Have you tried tracing through that path? Linus