Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756273AbdCGUuP (ORCPT ); Tue, 7 Mar 2017 15:50:15 -0500 Received: from foss.arm.com ([217.140.101.70]:52330 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755900AbdCGUuM (ORCPT ); Tue, 7 Mar 2017 15:50:12 -0500 From: Punit Agrawal To: Tyler Baicar Cc: catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, james.morse@arm.com, akpm@linux-foundation.org, paul.gortmaker@windriver.com, sandeepa.s.prabhu@gmail.com, shijie.huang@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Jonathan \(Zhixiong\) Zhang" Subject: Re: [PATCH V2] arm64: hwpoison: add VM_FAULT_HWPOISON[_LARGE] handling References: <1487720205-14594-1-git-send-email-tbaicar@codeaurora.org> <87wpc7o7mo.fsf@e105922-lin.cambridge.arm.com> Date: Tue, 07 Mar 2017 19:56:15 +0000 In-Reply-To: <87wpc7o7mo.fsf@e105922-lin.cambridge.arm.com> (Punit Agrawal's message of "Thu, 02 Mar 2017 18:28:47 +0000") Message-ID: <874lz4oo80.fsf@e105922-lin.cambridge.arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2533 Lines: 75 Punit Agrawal writes: [...] > > The code looks good but I ran into some failures while running the > hugepages hwpoison tests from mce-tests suite[0]. I get a bad pmd error > in dmesg - > > [ 344.165544] mm/pgtable-generic.c:33: bad pmd 000000083af00074. > > I suspect that this is due to the huge pte accessors not correctly > dealing with poisoned entries (which are represented as swap entries). I think I've got to the bottom of the issue - the problem is due to huge_pte_at() returning NULL for poisoned pmd entries (which in turn is due to pmd_present() not handling poisoned pmd entries correctly) The following is the call chain for the failure case. do_munmap unmap_region unmap_vmas unmap_single_vma __unmap_hugepage_range_final # The test case uses hugepages __unmap_hugepage_range huge_pte_offset # Returns NULL for a poisoned pmd Reverting 5bb1cc0ff9a6 ("arm64: Ensure pmd_present() returns false after pmd_mknotpresent()") fixes the problem for me but I don't think that is the right fix. While I work on a proper fix, it would be great if you can confirm that reverting 5bb1cc0ff9a6 makes the problem go away at your end. > > I am investigating the failure but could you try running the tests at > your end as well. > > To run the tests, I cloned the repository[0]. It test needs a simple fix > at the end of this mail to run correctly. With that applied and running > as root - > > # cd mce-test/cases/function/hwpoison > # ./run_hugepage.sh > > > [0] https://git.kernel.org/cgit/utils/cpu/mce/mce-test.git/ > > --------->8-------------- > commit cb5c61f18dd86baf01b90404d4ecf51dd3d176c7 > Author: Punit Agrawal > Date: Thu Mar 2 18:24:40 2017 +0000 > > Use correct return type for getopt_long > > getopt_long returns an int. Fix the return type to avoid issues when > checking for negative error codes on architectures with unsigned char, > e.g., arm. > > Signed-off-by: Punit Agrawal > > diff --git a/cases/function/hwpoison/thugetlb.c b/cases/function/hwpoison/thugetlb.c > index 92dc7d2..fbcf426 100644 > --- a/cases/function/hwpoison/thugetlb.c > +++ b/cases/function/hwpoison/thugetlb.c > @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) > int forkflag = 0; > int privateflag = 0; > int cowflag = 0; > - char c; > + int c; > pid_t pid = 0; > void *expected_addr = NULL; > struct sembuf sembuffer;