From patchwork Fri Nov 22 11:26:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11257897 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F7916C1 for ; Fri, 22 Nov 2019 11:27:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4C1502072D for ; Fri, 22 Nov 2019 11:27:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fv6dzuRP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C1502072D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2E5A16B04E6; Fri, 22 Nov 2019 06:27:30 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 297626B04E7; Fri, 22 Nov 2019 06:27:30 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AE186B04E8; Fri, 22 Nov 2019 06:27:30 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id 03E946B04E6 for ; Fri, 22 Nov 2019 06:27:30 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id C67666115 for ; Fri, 22 Nov 2019 11:27:29 +0000 (UTC) X-FDA: 76183687818.09.fish41_72fa8d597d1b X-Spam-Summary: 2,0,0,5f541495e99e1d80,d41d8cd98f00b204,3imbxxqykcaehmjefshpphmf.dpnmjovy-nnlwbdl.psh@flex--glider.bounces.google.com,:axboe@kernel.dk:luto@kernel.org:vegard.nossum@oracle.com:dvyukov@google.com:hch@lst.de::glider@google.com:viro@zeniv.linux.org.uk:adilger.kernel@dilger.ca:akpm@linux-foundation.org:andreyknvl@google.com:aryabinin@virtuozzo.com:ard.biesheuvel@linaro.org:arnd@arndb.de:hch@infradead.org:darrick.wong@oracle.com:davem@davemloft.net:dmitry.torokhov@gmail.com:ebiggers@google.com:edumazet@google.com:ericvh@gmail.com:gregkh@linuxfoundation.org:harry.wentland@amd.com:herbert@gondor.apana.org.au:iii@linux.ibm.com:mingo@elte.hu:jasowang@redhat.com:m.szyprowski@samsung.com:elver@google.com:mark.rutland@arm.com:martin.petersen@oracle.com:schwidefsky@de.ibm.com:willy@infradead.org:mst@redhat.com:monstr@monstr.eu:pmladek@suse.com:cai@lca.pw:rdunlap@infradead.org:robin.murphy@arm.com:sergey.senozhatsky@gmail.com:rostedt@goodmis.org:tiwai@suse.com:tytso@mit.edu :tglx@li X-HE-Tag: fish41_72fa8d597d1b X-Filterd-Recvd-Size: 5344 Received: from mail-qt1-f202.google.com (mail-qt1-f202.google.com [209.85.160.202]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Nov 2019 11:27:29 +0000 (UTC) Received: by mail-qt1-f202.google.com with SMTP id e2so4420529qtq.11 for ; Fri, 22 Nov 2019 03:27:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=SSKG5KTc216Z1LQMBKjVuOs2rSqhnE0kB0ren32tBIE=; b=fv6dzuRPnPOcdATRFIH2zWZHXCeUAwhI9Pbz7hFur0+TyTjAMdmHn71n6UiSj7YTTB bd4WUcPA9O88OuexhvZw20JI6cpfdGAPy7QcVlaSPJhOc38IhAsxXuaC3f13TEK4kSSI B/MhSkpwGuaAy6R2dbaqGa3qjawsXy86WH26ns8QEOWObKVkkL+qH0kHBSgnBSJgMgQh GrT5n+/9hlnq46HMs6/AKE6h0bHHg0AoqSRVS3GfRM87mPfifW7ArRdYTtpIf3aeOESh Oi1AyFSktzKesuClD7/rGz7r2YK0sBnYzhKVVi9SPquwgNexI2pXGS4HUSFh4sMb8mC9 MYgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=SSKG5KTc216Z1LQMBKjVuOs2rSqhnE0kB0ren32tBIE=; b=Sp//RvVLlwe2C8VuNGQZcSvRd54Ubj4+21/PphiEfF9+Il0ZZACImbHmL/icUyQdVL shutmGuuyw9fUsOtt2m7xd/8ZeA4YtvqzukaV7JpgerNrw+rZzEMHSQPUfRnRKJCGxZs GTrXJvf1T41e+vzfR4veCrsfS1D5aRYoExAX5vfJMsvQz3gpM97B24Wh8zQ9xBwStQYg dv43tTaqo+ATfMM+w+Ov2S1yjgVvQIvuPt77M8FwxFWmwY4xFDwdLilu/5t9eQ4Ei3BF xHs6ZlA637PyGX941DAwir5TQmi0AzHFUOaD6AP1jLdzEuoclj2fAb79J5fGL1pHO83U XsAg== X-Gm-Message-State: APjAAAWwYXYzIH0ZCD/ESJAbj4YMVowUGojVxfkLTJ2ZdZajMzctO5NT PpIPotAxdJS+ngdOoVdnr1YY2lzDW+Y= X-Google-Smtp-Source: APXvYqxwCbPn9mQpQ/sTugv2MRFdr2VlzBlA3nzsQXXV50IRT3WiEGPZnAmhZZKESc374hTiXxF8L5rgwXA= X-Received: by 2002:a05:620a:52b:: with SMTP id h11mr4262130qkh.297.1574422048481; Fri, 22 Nov 2019 03:27:28 -0800 (PST) Date: Fri, 22 Nov 2019 12:26:05 +0100 In-Reply-To: <20191122112621.204798-1-glider@google.com> Message-Id: <20191122112621.204798-21-glider@google.com> Mime-Version: 1.0 References: <20191122112621.204798-1-glider@google.com> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog Subject: [PATCH RFC v3 20/36] kmsan: x86: increase stack sizes in KMSAN builds From: glider@google.com To: Jens Axboe , Andy Lutomirski , Vegard Nossum , Dmitry Vyukov , Christoph Hellwig , linux-mm@kvack.org Cc: glider@google.com, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, akpm@linux-foundation.org, andreyknvl@google.com, aryabinin@virtuozzo.com, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@infradead.org, darrick.wong@oracle.com, davem@davemloft.net, dmitry.torokhov@gmail.com, ebiggers@google.com, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, harry.wentland@amd.com, herbert@gondor.apana.org.au, iii@linux.ibm.com, mingo@elte.hu, jasowang@redhat.com, m.szyprowski@samsung.com, elver@google.com, mark.rutland@arm.com, martin.petersen@oracle.com, schwidefsky@de.ibm.com, willy@infradead.org, mst@redhat.com, monstr@monstr.eu, pmladek@suse.com, cai@lca.pw, rdunlap@infradead.org, robin.murphy@arm.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, gor@linux.ibm.com, wsa@the-dreams.de X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: KMSAN instruments the code heavily, increasing register pressure and preventing functions from being inlined. As a result, the kernel requires more stack space to run. Rename KASAN_STACK_ORDER to EXTRA_STACK_ORDER and set EXTRA_STACK_ORDER to 2 for KMSAN builds, effectively making the stacks 4 times larger. Signed-off-by: Alexander Potapenko Cc: Jens Axboe Cc: Andy Lutomirski Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: Christoph Hellwig Cc: linux-mm@kvack.org Acked-by: Marco Elver --- Change-Id: I1d9df161419a885bf654abff141e247366895b68 --- arch/x86/include/asm/page_64_types.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index 288b065955b7..ea9fbf09f43b 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h @@ -7,18 +7,20 @@ #endif #ifdef CONFIG_KASAN -#define KASAN_STACK_ORDER 1 +#define EXTRA_STACK_ORDER 1 +#elif defined(CONFIG_KMSAN) +#define EXTRA_STACK_ORDER 2 #else -#define KASAN_STACK_ORDER 0 +#define EXTRA_STACK_ORDER 0 #endif -#define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER) +#define THREAD_SIZE_ORDER (2 + EXTRA_STACK_ORDER) #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER) +#define EXCEPTION_STACK_ORDER (0 + EXTRA_STACK_ORDER) #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) -#define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER) +#define IRQ_STACK_ORDER (2 + EXTRA_STACK_ORDER) #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) /*