Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755537AbcJZPvx (ORCPT ); Wed, 26 Oct 2016 11:51:53 -0400 Received: from mail-ua0-f179.google.com ([209.85.217.179]:36823 "EHLO mail-ua0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752176AbcJZPvv (ORCPT ); Wed, 26 Oct 2016 11:51:51 -0400 MIME-Version: 1.0 In-Reply-To: References: From: Andy Lutomirski Date: Wed, 26 Oct 2016 08:51:29 -0700 Message-ID: Subject: Re: CONFIG_VMAP_STACK, on-stack struct, and wake_up_bit To: Andreas Gruenbacher , Linus Torvalds , Peter Zijlstra Cc: Andy Lutomirski , LKML , Bob Peterson , Steven Whitehouse Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1318 Lines: 46 On Wed, Oct 26, 2016 at 5:51 AM, Andreas Gruenbacher wrote: > Hi, > > CONFIG_VMAP_STACK has broken gfs2 and I'm trying to figure out what's > going on. What I'm seeing is the following: on a fresh gfs2 filesystem > created with: > > mkfs.gfs2 -p lock_nolock $DEVICE > > I get the following BUG with 4.9-rc2, CONFIG_VMAP_STACK and > CONFIG_DEBUG_VIRTUAL turned on: > > kernel BUG at arch/x86/mm/physaddr.c:26! > > Stack of kernel thread: > > __phys_addr(x) > bit_waitqueue(word, bit) > wake_up_bit(word = &gh->gh_iflags, bit = HIF_WAIT) > gfs2_holder_wake(gh) It's this: const struct zone *zone = page_zone(virt_to_page(word)); If the stack is vmalloced, then you can't find the page's zone like that. We could look it up the slow way (ick!), but maybe another solution would be to do: wait_queue_head_t *wait_table; if (virt_addr_valid(word)) wait_table = page_zone(virt_to_page(word))->wait_table; else wait_table = funny_wait_table; where funny_wait_table is an extra wait table just for funny addresses. This will scale poorly on very large NUMA systems where many zones are simultaneously using on-stack wait_bit bits, but I suspect this is a very rare use case. > > Is accessing a struct on another kernel thread's stack no longer working? That part should be fine.