Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752196AbdFNOGz (ORCPT ); Wed, 14 Jun 2017 10:06:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60588 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112AbdFNOGw (ORCPT ); Wed, 14 Jun 2017 10:06:52 -0400 Date: Wed, 14 Jun 2017 16:06:36 +0200 From: Martin Schwidefsky To: "Kirill A. Shutemov" Cc: Andrew Morton , Vlastimil Babka , Vineet Gupta , Russell King , Will Deacon , Catalin Marinas , Ralf Baechle , "David S. Miller" , Heiko Carstens , "Aneesh Kumar K . V" , Andrea Arcangeli , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [HELP-NEEDED, PATCH 0/3] Do not loose dirty bit on THP pages In-Reply-To: <20170614135143.25068-1-kirill.shutemov@linux.intel.com> References: <20170614135143.25068-1-kirill.shutemov@linux.intel.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17061414-0040-0000-0000-000003AA29C4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17061414-0041-0000-0000-000025A34046 Message-Id: <20170614160636.43647f26@mschwideX1> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-14_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706140236 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1448 Lines: 38 Hi Kirill, On Wed, 14 Jun 2017 16:51:40 +0300 "Kirill A. Shutemov" wrote: > Vlastimil noted that pmdp_invalidate() is not atomic and we can loose > dirty and access bits if CPU sets them after pmdp dereference, but > before set_pmd_at(). > > The bug doesn't lead to user-visible misbehaviour in current kernel, but > fixing this would be critical for future work on THP: both huge-ext4 and THP > swap out rely on proper dirty tracking. > > Unfortunately, there's no way to address the issue in a generic way. We need to > fix all architectures that support THP one-by-one. > > All architectures that have THP supported have to provide atomic > pmdp_invalidate(). If generic implementation of pmdp_invalidate() is used, > architecture needs to provide atomic pmdp_mknonpresent(). > > I've fixed the issue for x86, but I need help with the rest. > > So far THP is supported on 8 architectures. Power and S390 already provides > atomic pmdp_invalidate(). x86 is fixed by this patches, so 5 architectures > left: For s390 the pmdp_invalidate() is atomic only in regard to the dirty and referenced bits because we use a fault driven approach for this, no? More specifically the update via the pmdp_xchg_direct() function is protected by the page table lock, the update on the pmd entry itself does *not* have to be atomic (for s390). -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.