Received: by 10.213.65.68 with SMTP id h4csp1904408imn; Thu, 5 Apr 2018 05:55:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/+mssgVAu3En+WCQTLMqih5DGdzm0FV4sA7NqjKM9e6V52U7RDcFVFafEUkI4ZG6RBytZ9 X-Received: by 10.98.87.193 with SMTP id i62mr11227194pfj.219.1522932900084; Thu, 05 Apr 2018 05:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522932900; cv=none; d=google.com; s=arc-20160816; b=hJ2i4i9QVN/KyaNq9p8cobwyaqWmfjwheqtVTFl+PAI/v44V4PFDd+U7Pwg0woB9F1 lFeucm0+OW3JRJVGp7iWw41hwLM4G3eFbq38zbfjkz+3Lx3tc3Y2sEwIF1xDkyhftm02 bwwKAL28G3ZHDjCuGgwdLHJ6I1Q2aGFpMOdg9fWfJHfw33ZFVdib6O9sS2KtqMEk6rwN zCKojT+ITSgtpuYwrHQJu338qCwp1Lty0CJtcQZh+y5u2QDzSyIuO92OYymkgBjkVUeK BqYHPJIb5C79bZDDUytxsvig+nheRtQqL+Enijq1xwaSsoWQ/w8+4vJqtd7nerpFp9vy umRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=Ba9vgyhG82b1q38ccYHm580Jn3gqw/YXd9imUuY0Dow=; b=RVxeAf53nWWKf8GdS7Plwt5Q4FJs35yKRytgw/fLg+RsIl5PCW9T0KbOQlR4DIYpN3 5/a/+/LmGzvnlob+yL8F5CGEJ4g2VpNYQPLim6ImWLJkY6iA6JFntYu8tD+VEas5e7MO ew01K4SjPnSudunkj1PVFigUVRRiHIcdlZLJDl5VSLB0YAbJDh0HHeP5ErxQR1OQXkEP QZ4+xzr9XVr+xPcqyiSxYOE766DIDLifJObcKXc+4Bwh4OvkywFCrS7klaN9qqUWVm+5 +xKNZrXVru5TmMVqSDUX+dzuNmmi6P46OzyRBgZy83aKnx0wAvSRJHa9/0TfgQsQypP9 S2Lw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z196si5414718pgz.349.2018.04.05.05.54.45; Thu, 05 Apr 2018 05:55:00 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751314AbeDEMxi (ORCPT + 99 others); Thu, 5 Apr 2018 08:53:38 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55458 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeDEMxg (ORCPT ); Thu, 5 Apr 2018 08:53:36 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w35CracM067304 for ; Thu, 5 Apr 2018 08:53:36 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h5khr9wsm-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 05 Apr 2018 08:53:33 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Apr 2018 13:53:30 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 5 Apr 2018 13:53:21 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w35CrLni54591594; Thu, 5 Apr 2018 12:53:21 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE9A5AE051; Thu, 5 Apr 2018 13:43:25 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9113BAE045; Thu, 5 Apr 2018 13:43:24 +0100 (BST) Received: from [9.101.4.33] (unknown [9.101.4.33]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 5 Apr 2018 13:43:24 +0100 (BST) Subject: Re: [PATCH v9 15/24] mm: Introduce __vm_normal_page() To: Jerome Glisse Cc: paulmck@linux.vnet.ibm.com, peterz@infradead.org, akpm@linux-foundation.org, kirill@shutemov.name, ak@linux.intel.com, mhocko@kernel.org, dave@stgolabs.net, jack@suse.cz, Matthew Wilcox , benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, Will Deacon , Sergey Senozhatsky , Andrea Arcangeli , Alexei Starovoitov , kemi.wang@intel.com, sergey.senozhatsky.work@gmail.com, Daniel Jordan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, haren@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com, npiggin@gmail.com, bsingharora@gmail.com, Tim Chen , linuxppc-dev@lists.ozlabs.org, x86@kernel.org References: <1520963994-28477-1-git-send-email-ldufour@linux.vnet.ibm.com> <1520963994-28477-16-git-send-email-ldufour@linux.vnet.ibm.com> <20180403193927.GD5935@redhat.com> <20180404215916.GC3331@redhat.com> From: Laurent Dufour Date: Thu, 5 Apr 2018 14:53:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180404215916.GC3331@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18040512-0008-0000-0000-000004E713AD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040512-0009-0000-0000-00001E7A2849 Message-Id: <6ebb4602-9455-65f3-ea60-bfaaee23a859@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-04-05_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804050135 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/04/2018 23:59, Jerome Glisse wrote: > On Wed, Apr 04, 2018 at 06:26:44PM +0200, Laurent Dufour wrote: >> >> >> On 03/04/2018 21:39, Jerome Glisse wrote: >>> On Tue, Mar 13, 2018 at 06:59:45PM +0100, Laurent Dufour wrote: >>>> When dealing with the speculative fault path we should use the VMA's field >>>> cached value stored in the vm_fault structure. >>>> >>>> Currently vm_normal_page() is using the pointer to the VMA to fetch the >>>> vm_flags value. This patch provides a new __vm_normal_page() which is >>>> receiving the vm_flags flags value as parameter. >>>> >>>> Note: The speculative path is turned on for architecture providing support >>>> for special PTE flag. So only the first block of vm_normal_page is used >>>> during the speculative path. >>> >>> Might be a good idea to explicitly have SPECULATIVE Kconfig option depends >>> on ARCH_PTE_SPECIAL and a comment for !HAVE_PTE_SPECIAL in the function >>> explaining that speculative page fault should never reach that point. >> >> Unfortunately there is no ARCH_PTE_SPECIAL in the config file, it is defined in >> the per architecture header files. >> So I can't do anything in the Kconfig file > > Maybe adding a new Kconfig symbol for ARCH_PTE_SPECIAL very much like > others ARCH_HAS_ > >> >> However, I can check that at build time, and doing such a check in >> __vm_normal_page sounds to be a good place, like that: >> >> @@ -869,6 +870,14 @@ struct page *__vm_normal_page(struct vm_area_struct *vma, >> unsigned long addr, >> >> /* !HAVE_PTE_SPECIAL case follows: */ >> >> +#ifdef CONFIG_SPECULATIVE_PAGE_FAULT >> + /* This part should never get called when the speculative page fault >> + * handler is turned on. This is mainly because we can't rely on >> + * vm_start. >> + */ >> +#error CONFIG_SPECULATIVE_PAGE_FAULT requires HAVE_PTE_SPECIAL >> +#endif >> + >> if (unlikely(vma_flags & (VM_PFNMAP|VM_MIXEDMAP))) { >> if (vma_flags & VM_MIXEDMAP) { >> if (!pfn_valid(pfn)) >> > > I am not a fan of #if/#else/#endif in code. But that's a taste thing. > I honnestly think that adding a Kconfig for special pte is the cleanest > solution. I do agree, but this should be done in a separate series. I'll see how this could be done but there are some arch (like powerpc) where this is a bit obfuscated for unknown reason. For the time being, I'll remove the check and just let the comment in place.