From patchwork Fri Apr 15 08:38:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 8845911 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C23D29F54F for ; Fri, 15 Apr 2016 08:39:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EDCA20295 for ; Fri, 15 Apr 2016 08:39:10 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 349BC20279 for ; Fri, 15 Apr 2016 08:39:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0B1411A1FA4; Fri, 15 Apr 2016 01:39:09 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-pf0-x22f.google.com (mail-pf0-x22f.google.com [IPv6:2607:f8b0:400e:c00::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9F4471A1FA4 for ; Fri, 15 Apr 2016 01:39:07 -0700 (PDT) Received: by mail-pf0-x22f.google.com with SMTP id 184so55162038pff.0 for ; Fri, 15 Apr 2016 01:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=QBfexL3U8Otv5q0KR7G+ULc/eRmV1WG+veBJwG+ljeo=; b=PyyvyWErQXYl1KEuxG+rOeI0Y28ktTHcDjGxwavh7MUwISD23lZeOCLMuHXUfNb/6w oU7dHXw0XpgBQeyp9Je5UQ4zBKkClmvsCSUHVGmyYF8NWk9ZrEReV7T7lFC46mpRGso0 4ZZQ2X3G+yhGyhHR6xXMzfITZfXFj1xQCfTOxkRzrz3RGO8+uwnZYB9yYkTvDBoykM2x lZJ/5ResRv3zhhuirKmZQCIWQyx3YWS3AsX4VkR0Cp9OcWsStQ25JoCaXqkDaGKX366u Pnp993jWBeSpgwRrhYBa6eoZk1X14EtEbJDRgwyiCn9rCGJbyAI8AE22FV2+4D0rkrTJ jRXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=QBfexL3U8Otv5q0KR7G+ULc/eRmV1WG+veBJwG+ljeo=; b=DLaS0WZz2xxPaAm1Vf/NJYNO6RbmdncG7ppagaVWzZoa/1NAvzGxeJE1/IMiwfo22V T0Q9AeaVlZgoUFVXShB5WROx0k/TXSeykpmwFTFykYsM8X57niZtII9pWrZ/nD7N16YL 6SCTpOo+KHzMRb3RCEVe3EPPaUBpzw+Sezb9SHq+D07c6el8uMAMba5gf0xP06WyydCI Y/CyNyVBhqWFmnAq2dcTWS5Ld16j+X0vVxc/AwYcQo5I4Lk+l6vsTIklSuBF3oIxYxX+ v6S3N+7CFcel1e46mixys+TNfCLo/yyxh/k+iXIXaz53THXL5m0Ks6wfrTIAQKyq0pAv XDNw== X-Gm-Message-State: AOPr4FVxUVd92j3BF+qOFFNYoYfvv0Zv3B4ztz7y+JYe8A0yhfglji8Rog9IqxxGrvcQirfH X-Received: by 10.98.66.89 with SMTP id p86mr27498002pfa.42.1460709547078; Fri, 15 Apr 2016 01:39:07 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id d19sm62945657pfj.92.2016.04.15.01.39.05 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Apr 2016 01:39:06 -0700 (PDT) Date: Fri, 15 Apr 2016 01:38:57 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Xiong Zhou Subject: Re: binary execution from DAX mount hang since next-20160407 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org, hughd@google.com, "linux-kernel@vger.kernel.org" , linux-mm@kvack.org, Linux-Next , Linux-Fsdevel Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 15 Apr 2016, Xiong Zhou wrote: > Hi, all > > Since tag next-20160407 in linux-next repo, executing binary > from/in DAX mount hangs. > > It does not hang if mount without dax option. > It hangs with both xfs and ext4. > It does not hang if execute from a -t tmpfs mount. > It does not hang on next-20160406 and still hangs on 0414 tree. > > # ps -axjf > ... > S+ 0 0:00 | \_ sh -x thl.sh > R+ 0 42:33 | \_ [hl] > .. > # cat thl.sh > mkfs.ext4 /dev/pmem0 > mount -o dax /dev/pmem0 /daxmnt > cp hl /daxmnt > /daxmnt/hl > # cat hl.c > void main() > { > printf("ok\n"); > } > # cc hl.c -o hl > > Bisecting commits between 0406 and 0407 tag, points to this: > > d7c7d56ca61aec18e5e0cb3a64e50073c42195f7 is the first bad commit > commit d7c7d56ca61aec18e5e0cb3a64e50073c42195f7 > Author: Hugh Dickins > Date: Thu Apr 7 14:00:12 2016 +1000 > > huge tmpfs: avoid premature exposure of new pagetable > > Bisect log and config are attatched. Excellent and very helpful bug report: thank you very much for taking the trouble to make such a good report. I see why this happens now: I've not been paying enough attention to the DAX changes. The fix requires a repositioning of where I allocate the new page table: which is a change we knew we had to make for other reasons, but it did not appear to be a high priority compared with other things - until your bug report showing that I have broken DAX rather badly. In return for your excellent bug report, I can immediately offer the most shameful patch I have ever posted: which has the virtue of simplicity, and will work so long as you have plenty of free memory; but might deadlock if it has to go into page reclaim (or maybe not: perhaps the DAXness would leave it as merely a lockdep violation). Maybe not so much worse than the current hang, but still shameful: I'm appending it here just in case you're in a hurry to see your "ok" program working on DAX; but I think I'd better rearrange priorities and try to provide a proper fix as soon as possible. Never-to-be-Signed-off-by: an anonymous hacker --- 4.6-rc2-mm1/mm/memory.c 2016-04-10 10:12:06.167769232 -0700 +++ linux/mm/memory.c 2016-04-15 00:54:06.427085026 -0700 @@ -2874,7 +2874,7 @@ static int __do_fault(struct vm_area_str ret = VM_FAULT_HWPOISON; goto err; } - + out: /* * Use pte_alloc instead of pte_alloc_map, because we can't * run pte_offset_map on the pmd, if an huge pmd could @@ -2892,7 +2892,7 @@ static int __do_fault(struct vm_area_str ret = VM_FAULT_NOPAGE; goto err; } - out: + *page = vmf.page; return ret; err: