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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED 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 2AAE4C43381 for ; Thu, 21 Feb 2019 15:57:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 058B52083E for ; Thu, 21 Feb 2019 15:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbfBUP5d (ORCPT ); Thu, 21 Feb 2019 10:57:33 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57618 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbfBUP5d (ORCPT ); Thu, 21 Feb 2019 10:57:33 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1LFnCSB010935 for ; Thu, 21 Feb 2019 10:57:32 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qsx65kcyq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 21 Feb 2019 10:57:31 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 21 Feb 2019 15:57:29 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 21 Feb 2019 15:57:25 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1LFvP5H20316376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 21 Feb 2019 15:57:25 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 057A842045; Thu, 21 Feb 2019 15:57:25 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 710FD42041; Thu, 21 Feb 2019 15:57:20 +0000 (GMT) Received: from skywalker.linux.ibm.com (unknown [9.199.55.4]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 21 Feb 2019 15:57:19 +0000 (GMT) X-Mailer: emacs 26.1 (via feedmail 11-beta-1 I) From: "Aneesh Kumar K.V" To: Jan Kara Cc: Jan Kara , Chandan Rajendra , mpe@ellerman.id.au, Dan Williams , linux-fsdevel@vger.kernel.org Subject: Re: write fault on dax mapping and usage of set_pte_at. In-Reply-To: <20190221151513.GB23071@quack2.suse.cz> References: <871s41a9mo.fsf@linux.ibm.com> <20190221121238.GB21533@quack2.suse.cz> <20190221151513.GB23071@quack2.suse.cz> Date: Thu, 21 Feb 2019 21:27:15 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 19022115-0008-0000-0000-000002C34431 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19022115-0009-0000-0000-0000222F7FED Message-Id: <87va1d878k.fsf@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-21_09:,, 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 mlxscore=0 impostorscore=0 mlxlogscore=842 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902210115 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Jan Kara writes: > On Thu 21-02-19 19:11:14, Aneesh Kumar K.V wrote: >> On 2/21/19 5:42 PM, Jan Kara wrote: >> > Hi Aneesh, >> > >> > On Thu 21-02-19 12:52:39, Aneesh Kumar K.V wrote: >> > > We found this while testing dax with XFS, but i guess this is true for >> > > other file systems too. The stack trace looks as >> > > >> > > [c00000000007610c] set_pte_at+0x3c/0x190 >> > > LR [c000000000378628] insert_pfn+0x208/0x280 >> > > Call Trace: >> > > [c0000002125df980] [8000000000000104] 0x8000000000000104 (unreliable) >> > > [c0000002125df9c0] [c000000000378488] insert_pfn+0x68/0x280 >> > > [c0000002125dfa30] [c0000000004a5494] dax_iomap_pte_fault.isra.7+0x734/0xa40 >> > > [c0000002125dfb50] [c000000000627250] __xfs_filemap_fault+0x280/0x2d0 >> > > [c0000002125dfbb0] [c000000000373abc] do_wp_page+0x48c/0xa40 >> > > [c0000002125dfc00] [c000000000379170] __handle_mm_fault+0x8d0/0x1fd0 >> > > [c0000002125dfd00] [c00000000037a9b0] handle_mm_fault+0x140/0x250 >> > > [c0000002125dfd40] [c000000000074bb0] __do_page_fault+0x300/0xd60 >> > > [c0000002125dfe20] [c00000000000acf4] handle_page_fault+0x18 >> > > >> > > >> > > Now that is WARN_ON in set_pte_at which is >> > > >> > > VM_WARN_ON(pte_hw_valid(*ptep) && !pte_protnone(*ptep)); >> > > >> > > Multiple architecture optimize set_pte_at based on the assumption that >> > > we will never use set_pte_at to update a valid pte entry. This helps in >> > > avoid flushing tlb etc. We should be using ptep_set_access_flags for >> > > this. >> > >> > Hum, I didn't know about this assumption and neither did lot of other >> > people reviewing DAX patches. Is this documented somewhere? > > Any answer here? > Not in the form of kernel documentation. But we had related fixes which got applied earlier cee216a696b2004017a5ecb583366093d90b1568 56eecdb912b536a4fa97fb5bfe5a940a54d79be6 Which also imply we possibly want to document this properly. We use: For a RO -> RW: update ptep_set_access_flags >From an invalid pte to valid: set_pte_at For read/modify/write sequence we have: ptep_prot_modify_start/ptep_prot_modify_commit ptep_set_access_flags do carry a comment which explains it is used when relaxing the access. -aneesh