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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 B29D6C34031 for ; Tue, 18 Feb 2020 03:36:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 62D8E206D5 for ; Tue, 18 Feb 2020 03:36:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62D8E206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A85536B0003; Mon, 17 Feb 2020 22:36:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A353E6B0006; Mon, 17 Feb 2020 22:36:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 923C26B0007; Mon, 17 Feb 2020 22:36:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id 782AD6B0003 for ; Mon, 17 Feb 2020 22:36:12 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 10B6B8248D52 for ; Tue, 18 Feb 2020 03:36:12 +0000 (UTC) X-FDA: 76501834584.12.swim30_8d47f87b9d659 X-HE-Tag: swim30_8d47f87b9d659 X-Filterd-Recvd-Size: 5830 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Feb 2020 03:36:10 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Feb 2020 19:36:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,455,1574150400"; d="scan'208";a="407944737" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga005.jf.intel.com with ESMTP; 17 Feb 2020 19:36:08 -0800 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 17 Feb 2020 19:36:08 -0800 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 17 Feb 2020 19:36:07 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.5]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.98]) with mapi id 14.03.0439.000; Tue, 18 Feb 2020 11:36:05 +0800 From: "Tian, Kevin" To: Christian Borntraeger , Janosch Frank CC: KVM , Cornelia Huck , "David Hildenbrand" , Thomas Huth , "Ulrich Weigand" , Claudio Imbrenda , Andrea Arcangeli , linux-s390 , Michael Mueller , "Vasily Gorbik" , "linux-mm@kvack.org" , Andrew Morton Subject: RE: [PATCH 01/35] mm:gup/writeback: add callbacks for inaccessible pages Thread-Topic: [PATCH 01/35] mm:gup/writeback: add callbacks for inaccessible pages Thread-Index: AQHV3auCSG5HedHt7Uq9KhpGUrrOXKggXHoQ Date: Tue, 18 Feb 2020 03:36:05 +0000 Message-ID: References: <20200207113958.7320-1-borntraeger@de.ibm.com> <20200207113958.7320-2-borntraeger@de.ibm.com> In-Reply-To: <20200207113958.7320-2-borntraeger@de.ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiM2JlMDg5ZWQtNjU4Ni00YzdiLTg2Y2QtZTg3NDAzZGIxMGZiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiSDhLbmFEUEgydnpGREt1ZThIZ2p2dXJzTVVudWdPam5Ya2ZUaTlZNHA5elNJXC9xMkVnSkNVbzllaUVLbDZjODUifQ== dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: > From: Christian Borntraeger > Sent: Friday, February 7, 2020 7:39 PM >=20 > From: Claudio Imbrenda >=20 > With the introduction of protected KVM guests on s390 there is now a > concept of inaccessible pages. These pages need to be made accessible > before the host can access them. >=20 > While cpu accesses will trigger a fault that can be resolved, I/O > accesses will just fail. We need to add a callback into architecture > code for places that will do I/O, namely when writeback is started or > when a page reference is taken. What about hooking the callback to DMA API ops? >=20 > Signed-off-by: Claudio Imbrenda > Signed-off-by: Christian Borntraeger > --- > include/linux/gfp.h | 6 ++++++ > mm/gup.c | 2 ++ > mm/page-writeback.c | 1 + > 3 files changed, 9 insertions(+) >=20 > diff --git a/include/linux/gfp.h b/include/linux/gfp.h > index e5b817cb86e7..be2754841369 100644 > --- a/include/linux/gfp.h > +++ b/include/linux/gfp.h > @@ -485,6 +485,12 @@ static inline void arch_free_page(struct page *page, > int order) { } > #ifndef HAVE_ARCH_ALLOC_PAGE > static inline void arch_alloc_page(struct page *page, int order) { } > #endif > +#ifndef HAVE_ARCH_MAKE_PAGE_ACCESSIBLE > +static inline int arch_make_page_accessible(struct page *page) > +{ > + return 0; > +} > +#endif >=20 > struct page * > __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int > preferred_nid, > diff --git a/mm/gup.c b/mm/gup.c > index 7646bf993b25..a01262cd2821 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -257,6 +257,7 @@ static struct page *follow_page_pte(struct > vm_area_struct *vma, > page =3D ERR_PTR(-ENOMEM); > goto out; > } > + arch_make_page_accessible(page); > } > if (flags & FOLL_TOUCH) { > if ((flags & FOLL_WRITE) && > @@ -1870,6 +1871,7 @@ static int gup_pte_range(pmd_t pmd, unsigned > long addr, unsigned long end, >=20 > VM_BUG_ON_PAGE(compound_head(page) !=3D head, page); >=20 > + arch_make_page_accessible(page); > SetPageReferenced(page); > pages[*nr] =3D page; > (*nr)++; > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index 2caf780a42e7..0f0bd14571b1 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -2806,6 +2806,7 @@ int __test_set_page_writeback(struct page *page, > bool keep_write) > inc_lruvec_page_state(page, NR_WRITEBACK); > inc_zone_page_state(page, NR_ZONE_WRITE_PENDING); > } > + arch_make_page_accessible(page); > unlock_page_memcg(page); > return ret; >=20 > -- > 2.24.0