From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752876AbcADWHe (ORCPT ); Mon, 4 Jan 2016 17:07:34 -0500 Received: from belmont80srvr.owm.bell.net ([184.150.200.80]:40267 "EHLO mtlfep02.bell.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751913AbcADWHa (ORCPT ); Mon, 4 Jan 2016 17:07:30 -0500 X-Greylist: delayed 1157 seconds by postgrey-1.27 at vger.kernel.org; Mon, 04 Jan 2016 17:07:30 EST Subject: Re: [GIT PULL] parisc huge page support for v4.4 To: Mikulas Patocka , Helge Deller References: <20151122115153.GA28471@p100.box> <5654892D.1030707@gmx.de> <20151124170020.GA13198@p100.box> <567E88BA.4010607@gmx.de> Cc: Linus Torvalds , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, James Bottomley From: John David Anglin Message-ID: <568AE89B.9030606@bell.net> Date: Mon, 4 Jan 2016 16:48:11 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Opwv-CommTouchExtSvcRefID: str=0001.0A020204.568AE89B.01D5,ss=1,re=0.000,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016-01-04 4:24 PM, Mikulas Patocka wrote: > > On Sat, 26 Dec 2015, Helge Deller wrote: > >> On 26.12.2015 13:09, Mikulas Patocka wrote: >> >>> BTW. I looked at this in arch/parisc/mm/hugetlbpage.c:set_huge_pte_at >>> "*ptep = entry;" and it seems like a bad bug. PA-RISC doesn't have atomic >>> instructions to modify page table entries, so it takes spinlock in the TLB >>> handler and modifies the page table entry non-atomically. If you modify >>> the page table entry without the spinlock, you may race with TLB handler >>> on another CPU and your modification may be lost. >> Right. >> >>> The comment says something about double locking on pa_tlb_lock, but >>> pa_tlb_lock isn't held when that function is called. >> I have a work-in-progress patch for that in one of my trees, e.g.: >> http://git.kernel.org/cgit/linux/kernel/git/deller/parisc-linux.git/commit/?h=parisc-next&id=5c76b525cbdb097401f46522b27b1eb6244f34f9 >> It's lightly tested though. >> >> Helge > I tested the patch and it works OK for me so far. > > BTW. what happens if some kernel code takes the TLB spinlock and then TLB > miss in kernel space happens? (it would attempt to lock the spinlock > recursively) Is it assumed that the TLB is big enough that this can't > happen? No. If you look at the TLB handler, you will see that locking is not done for misses in kernel space. So, this deadlock doesn't occur. Dave -- John David Anglin dave.anglin@bell.net