Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp620178pxu; Thu, 3 Dec 2020 08:35:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0UmoV9KeyiL04SkQgfLfhUc3sS387ATZ3NpPTq/1GgiVvRssI/jFD5wj/sazwtxvXuKrG X-Received: by 2002:a17:906:1a19:: with SMTP id i25mr3240967ejf.206.1607013354621; Thu, 03 Dec 2020 08:35:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607013354; cv=none; d=google.com; s=arc-20160816; b=YV01QbnfCt2JKFQHpkwXl2j7C2PiCpDVj5kZXLTwOJ3XinjhkK0AOUsw6xTBW/MVrp IO+smQJPP0Ba+XhlP1GHUdfXpGZbOHAZ8Eaz0kXa3tqqR3l5UkDdQ16QM8UloDuSKsAT TGjI3WE3v50LNObLS9l3BoU/z7uRfX5TXYQV5TRHg6RreE0P7vDP8f2jee3eel7+wRG3 EwPRNGiX3Rob4ZzH47sajRut4qC90PL0pSnYysLmEGz+UmdhH3hgsHOUJuI2ijkbz8Oo bV1OoDsRpihNgqLo9fvKurfbKGogCNbaB0fpwU2QmC2mW+6Oyg9bu82pA+GxJgpsDqpk 9oeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=YbhOMCEPP4bd8MYisBPrQGb0dlIsfdzrUQVeOS32Ifg=; b=vK2NKACL/alCcGSdCZpA+akdX6Wh3Y7rUclOCsRepZE9rTGLaY/t9b+DjiuqGEVOcs EAFIoWeFfV54tRUDhEkIj5gHUGwLue2JUhcqJ/3itgYzbt3gpOvVCSgS4G1x7l0NOL2s 0vswvq6SB+8bVQ9em7DZ16AcnWtz8FIBLuhGDXpHssmvrP+IDgfTSr+EVHROUKdlzmgV 6l3lRX39aTm1AwblwHLPeZj674p1nvNMRnliulh26Er3AhZp4ynChoX+aOUb9/u00QXZ azCRRvDi4uw0Qf8PxM25EQdLUvvM5FwZqkYHmGyfFQNU6DFxhBnNK9kFLD7awdoALpaj EyqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 38si1274552edr.163.2020.12.03.08.35.31; Thu, 03 Dec 2020 08:35:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731344AbgLCQbu (ORCPT + 99 others); Thu, 3 Dec 2020 11:31:50 -0500 Received: from foss.arm.com ([217.140.110.172]:44666 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731154AbgLCQbu (ORCPT ); Thu, 3 Dec 2020 11:31:50 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 17AF611D4; Thu, 3 Dec 2020 08:31:04 -0800 (PST) Received: from [10.37.8.53] (unknown [10.37.8.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7BE0E3F575; Thu, 3 Dec 2020 08:31:01 -0800 (PST) Subject: Re: [PATCH v2] lib: stackdepot: Add support to configure STACK_HASH_SIZE To: Andrey Konovalov , Catalin Marinas Cc: vjitta@codeaurora.org, Minchan Kim , Alexander Potapenko , Dan Williams , Mark Brown , Masami Hiramatsu , LKML , Andrew Morton , ylal@codeaurora.org, vinmenon@codeaurora.org, kasan-dev , Stephen Rothwell , Linux-Next Mailing List , Qian Cai References: <1606365835-3242-1-git-send-email-vjitta@codeaurora.org> <7733019eb8c506eee8d29e380aae683a8972fd19.camel@redhat.com> From: Vincenzo Frascino Message-ID: Date: Thu, 3 Dec 2020 16:34:18 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrey, On 12/3/20 4:15 PM, Andrey Konovalov wrote: > On Thu, Dec 3, 2020 at 5:04 PM Qian Cai wrote: >> >> On Thu, 2020-11-26 at 10:13 +0530, vjitta@codeaurora.org wrote: >>> From: Yogesh Lal >>> >>> Add a kernel parameter stack_hash_order to configure STACK_HASH_SIZE. >>> >>> Aim is to have configurable value for STACK_HASH_SIZE, so that one >>> can configure it depending on usecase there by reducing the static >>> memory overhead. >>> >>> One example is of Page Owner, default value of STACK_HASH_SIZE lead >>> stack depot to consume 8MB of static memory. Making it configurable >>> and use lower value helps to enable features like CONFIG_PAGE_OWNER >>> without any significant overhead. >>> >>> Suggested-by: Minchan Kim >>> Signed-off-by: Yogesh Lal >>> Signed-off-by: Vijayanand Jitta >> >> Reverting this commit on today's linux-next fixed boot crash with KASAN. >> >> .config: >> https://cailca.coding.net/public/linux/mm/git/files/master/x86.config >> https://cailca.coding.net/public/linux/mm/git/files/master/arm64.config > > Vincenzo, Catalin, looks like this is the cause of the crash you > observed. Reverting this commit from next-20201203 fixes KASAN for me. > > Thanks for the report Qian! > Thank you for this. I will try and let you know as well. >>> --- >>> lib/stackdepot.c | 27 ++++++++++++++++++++++----- >>> 1 file changed, 22 insertions(+), 5 deletions(-) >>> >>> diff --git a/lib/stackdepot.c b/lib/stackdepot.c >>> index 81c69c0..ce53598 100644 >>> --- a/lib/stackdepot.c >>> +++ b/lib/stackdepot.c >>> @@ -141,14 +141,31 @@ static struct stack_record *depot_alloc_stack(unsigned long *entries, int size, >>> return stack; >>> } >>> >>> -#define STACK_HASH_ORDER 20 >>> -#define STACK_HASH_SIZE (1L << STACK_HASH_ORDER) >>> +static unsigned int stack_hash_order = 20; >>> +#define STACK_HASH_SIZE (1L << stack_hash_order) >>> #define STACK_HASH_MASK (STACK_HASH_SIZE - 1) >>> #define STACK_HASH_SEED 0x9747b28c >>> >>> -static struct stack_record *stack_table[STACK_HASH_SIZE] = { >>> - [0 ... STACK_HASH_SIZE - 1] = NULL >>> -}; >>> +static struct stack_record **stack_table; >>> + >>> +static int __init setup_stack_hash_order(char *str) >>> +{ >>> + kstrtouint(str, 0, &stack_hash_order); >>> + return 0; >>> +} >>> +early_param("stack_hash_order", setup_stack_hash_order); >>> + >>> +static int __init init_stackdepot(void) >>> +{ >>> + int i; >>> + >>> + stack_table = kvmalloc(sizeof(struct stack_record *) * STACK_HASH_SIZE, GFP_KERNEL); >>> + for (i = 0; i < STACK_HASH_SIZE; i++) >>> + stack_table[i] = NULL; >>> + return 0; >>> +} >>> + >>> +early_initcall(init_stackdepot); >>> >>> /* Calculate hash for a stack */ >>> static inline u32 hash_stack(unsigned long *entries, unsigned int size) >> >> -- >> You received this message because you are subscribed to the Google Groups "kasan-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. >> To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/7733019eb8c506eee8d29e380aae683a8972fd19.camel%40redhat.com. -- Regards, Vincenzo