Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp997051imu; Fri, 11 Jan 2019 12:59:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN4aZSRIlSHPkZ7A9WYxmRIU7ILmv1jCk5vEif1ZFfPbBh+cpoa0wJE4V0kACFuu016GVFYk X-Received: by 2002:a63:d547:: with SMTP id v7mr4607248pgi.339.1547240370743; Fri, 11 Jan 2019 12:59:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547240370; cv=none; d=google.com; s=arc-20160816; b=wJzua62AZPxGHCzRC9KYlq5wRe3BEcBUiIpbCEMZoBNxzyeAgCbjk91W+bGU84oqlZ sNJcbIoo/01f/TW8ptAosGHchFqB+XnkI86MhB4Agi/2aYFgS0ISQ4w52/JEYY0EwASm fB0A5l1suqpvY4xMQ+QS6VbjnUCBrozB1nOQyLGQoZx7LEYz30DtF+Jdq/KSu1mVUC0D +4z2AYrYs/DUXr+ezhNA894/ik1H/rAfnbQvRj4bW56s7OAfcNurXi4b1kLzuefPb12L TtAzT0p9mcADh3MYkp2wF/+mDhuEF5HSpv+gB0FPNyxf0judgLiivempHMj+4l5bcG6P RMCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:references:cc:to :subject:dkim-signature; bh=/s71TfZYnT4b+cU9IZji4pYMHFgF8q3jPAT5srEn2UA=; b=X+7UJpLuH5/F6rI4uRfw6dGmlDyslxbUWPrymcdkIbL/ZLavAmnrUyCrnzu4K2orM0 JgYFOXk81cipHOzfrw0gFXW241BwbgCJjIa7ONx3l8OvExNQSgn5+HfaEG5N/H0jASYr 3GI8GBWQ/WLmQsWwrca8vh4veN7/BpqfzPOwyHyAMTliadqThlYTJKIteRzQOHgIrRub RSfJrB34uQa0gayhIH3mXySz/Mpr51ahbR0XGY65oSJwUpHthuHTDIyb4zBbfoYsSm2U TmOzEkJoek3nqquEdwte0VCRz33/P/1erdnTYFrK3Rpqd60XjfMV0YfPkaaz0xVDCF1f K2vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=zCo0V5QR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si76923978pfe.203.2019.01.11.12.59.15; Fri, 11 Jan 2019 12:59:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=zCo0V5QR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388193AbfAKS3J (ORCPT + 99 others); Fri, 11 Jan 2019 13:29:09 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:47440 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729711AbfAKS3I (ORCPT ); Fri, 11 Jan 2019 13:29:08 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0BIO1MC157825; Fri, 11 Jan 2019 18:28:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type; s=corp-2018-07-02; bh=/s71TfZYnT4b+cU9IZji4pYMHFgF8q3jPAT5srEn2UA=; b=zCo0V5QR+ZscUJCIWaOQaUq0OqmWLt026J/fdBzB+sqU00wB2KiYvNjXVyAAnUoxvYRp ZQsqrSs0CLIERis2TX3L3H1PNfgaY1WtO/DHwr5NXIW5FCG2496XBJZJCKa5eC08D7He ECRzzcvtI+nA8NNAdvRzfQlK91lMI9CzNgsm2pg9OLg3xaTLBy9zmLSy4G1/0Hduxulu LIqPmeLG8nx6a9QW8qulf6L8Qq/SF+1BcXjARB0Gb3sn6C9hZACDCibvS6UCh8MJEAKF wqvnxs+OpLko9EK8989F2ALhNMTFSY5t1OlmVxv2e1GD9/NkJfe+3oDDGXNr0gOKeR+H NQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2ptj3eenn2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Jan 2019 18:28:20 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0BISJxY030482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Jan 2019 18:28:20 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x0BISIwN025077; Fri, 11 Jan 2019 18:28:18 GMT Received: from [192.168.1.44] (/24.9.64.241) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 11 Jan 2019 10:28:18 -0800 Subject: Re: [RFC PATCH v7 07/16] arm64/mm, xpfo: temporarily map dcache regions To: Tycho Andersen Cc: juergh@gmail.com, jsteckli@amazon.de, ak@linux.intel.com, torvalds@linux-foundation.org, liran.alon@oracle.com, keescook@google.com, konrad.wilk@oracle.com, Juerg Haefliger , deepa.srinivasan@oracle.com, chris.hyser@oracle.com, tyhicks@canonical.com, dwmw@amazon.co.uk, andrew.cooper3@citrix.com, jcm@redhat.com, boris.ostrovsky@oracle.com, kanth.ghatraju@oracle.com, joao.m.martins@oracle.com, jmattson@google.com, pradeep.vincent@oracle.com, john.haxby@oracle.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, hch@lst.de, steven.sistare@oracle.com, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20190111145445.GA4102@cisco> From: Khalid Aziz Organization: Oracle Corp Message-ID: <19e61a22-bbae-d0ae-8d41-158d4b46bf01@oracle.com> Date: Fri, 11 Jan 2019 11:28:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190111145445.GA4102@cisco> Content-Type: multipart/mixed; boundary="------------3BB60CD6A7EC85D34E24789D" Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9133 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901110147 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------3BB60CD6A7EC85D34E24789D Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 1/11/19 7:54 AM, Tycho Andersen wrote: > On Thu, Jan 10, 2019 at 02:09:39PM -0700, Khalid Aziz wrote: >> From: Juerg Haefliger >> >> If the page is unmapped by XPFO, a data cache flush results in a fatal= >> page fault, so let's temporarily map the region, flush the cache, and = then >> unmap it. >> >> v6: actually flush in the face of xpfo, and temporarily map the underl= ying >> memory so it can be flushed correctly >> >> CC: linux-arm-kernel@lists.infradead.org >> Signed-off-by: Juerg Haefliger >> Signed-off-by: Tycho Andersen >> Signed-off-by: Khalid Aziz >> --- >> arch/arm64/mm/flush.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c >> index 30695a868107..f12f26b60319 100644 >> --- a/arch/arm64/mm/flush.c >> +++ b/arch/arm64/mm/flush.c >> @@ -20,6 +20,7 @@ >> #include >> #include >> #include >> +#include >> =20 >> #include >> #include >> @@ -28,9 +29,15 @@ >> void sync_icache_aliases(void *kaddr, unsigned long len) >> { >> unsigned long addr =3D (unsigned long)kaddr; >> + unsigned long num_pages =3D XPFO_NUM_PAGES(addr, len); >> + void *mapping[num_pages]; >=20 > Does this still compile with -Wvla? It was a bad hack on my part, and > we should probably just drop it and come up with something else :) I will make a note of it. I hope someone with better knowledge of arm64 than me can come up with a better solution ;) -- Khalid >=20 > Tycho >=20 >> if (icache_is_aliasing()) { >> + xpfo_temp_map(kaddr, len, mapping, >> + sizeof(mapping[0]) * num_pages); >> __clean_dcache_area_pou(kaddr, len); >> + xpfo_temp_unmap(kaddr, len, mapping, >> + sizeof(mapping[0]) * num_pages); >> __flush_icache_all(); >> } else { >> flush_icache_range(addr, addr + len); >> --=20 >> 2.17.1 >> --------------3BB60CD6A7EC85D34E24789D Content-Type: application/pgp-keys; name="pEpkey.asc" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pEpkey.asc" -----BEGIN PGP PUBLIC KEY BLOCK----- mQGNBFwdSxMBDACs4wtsihnZ9TVeZBZYPzcj1sl7hz41PYvHKAq8FfBOl4yC6ghp U0FDo3h8R7ze0VGU6n5b+M6fbKvOpIYT1r02cfWsKVtcssCyNhkeeL5A5X9z5vgt QnDDhnDdNQr4GmJVwA9XPvB/Pa4wOMGz9TbepWfhsyPtWsDXjvjFLVScOorPddrL /lFhriUssPrlffmNOMKdxhqGu6saUZN2QBoYjiQnUimfUbM6rs2dcSX4SVeNwl9B 2LfyF3kRxmjk964WCrIp0A2mB7UUOizSvhr5LqzHCXy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