Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp77497rwd; Sat, 13 May 2023 13:18:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4lrcmBFILYCxSg+hGjSdtwQkGQrcX8bGMVyrroMyhsusFvA4F0oTPZWqXBdsrqJB010Rny X-Received: by 2002:a05:6a20:8f01:b0:ff:d067:351 with SMTP id b1-20020a056a208f0100b000ffd0670351mr31036909pzk.54.1684009103706; Sat, 13 May 2023 13:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684009103; cv=none; d=google.com; s=arc-20160816; b=Uxj09WhabHXk3kgm6KKbJ+Md2kYfI86083SZRQDCLhpeaOUAf6jqax3cJpnZC/907t YRIa+Wg8TVXhdeG93J6W64cTPVqV1+9vb0AzhUAp14SfT1hn+nxhVe8tSYNASQ02KPQy 8bmGIu/9023PlE4orirQNUgwqTx5yhplhqHogXpw/ENF8PqM6AOsdJD93U4brohyb+ig 6wU19y/FB8O4zWZjSKXiYTzkOSi1Gidu9YmxtGB9IPUNeFvu8H/ZikdhfXavL7FNtYLf 0A7vFKeyZAGqASLR9Js7749kdB6HSbfPlMMm3lBRwZCVR/lhGKxyZ7SP47NaJ76JWqlg Rm/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=FRJAdQfSJl14BbyOaT4G3/hWq1xYQEBEbVi1WZwPfAA=; b=cUANqROUl3LCfO6GFhQRC+eC5VG0Ry+aF5mmMSzTIsYJ1sMdakInpba1u038peIuZm u9f5B4S56RoUY8N0E8qs7mTuHxV2zlAETjAKmeXrbQbvXB45l2aBH504iCXiGNA5zcA4 t+8LvThHcAJdGPGYBCz0J//dOWjAYYlisALZsUJO4/JZJILaLJEOl7VEYdYHc6x0Au1i 7UNGvt7FiWVJ33YNI9+3l2EZbbbotjDwoYoefgGbxXP7kgiGfEL6DBI7CBR7QZd2Upjn xIrRZDDMPqSxaL7yvqitq+w+eGHl5/Fru1VmWadqmLnXTFKYo8zwWVI5SS/+DI6Afqj9 Jtpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oodjUBRY; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 126-20020a620484000000b0063354a65327si12350039pfe.395.2023.05.13.13.18.09; Sat, 13 May 2023 13:18:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oodjUBRY; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233666AbjEMTeT (ORCPT + 99 others); Sat, 13 May 2023 15:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233804AbjEMTeR (ORCPT ); Sat, 13 May 2023 15:34:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACCF43AAE for ; Sat, 13 May 2023 12:34:15 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684006453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FRJAdQfSJl14BbyOaT4G3/hWq1xYQEBEbVi1WZwPfAA=; b=oodjUBRYhQ4Sr6ntQ/+hJQNIK5iKStrGgZHemRQ6OtOvoHdaynytszkFYlJK5ylHkLB1OA G0aQ+vd25ECoSdGPpgWvoeZcenm3ldvf0jmrieV7xDZ9VPKmCTduaNp/Ctwvo2nIP8EaFX 7dJw0OwbIgOngH8FOl6PqZdscC5oMj0TKFUYV3MWhj3VgxkvD78L8oPRH9QWQjwQRtq/di ax7NaeZkmrpSUMAj8yFHsqcwMm2A/qpHaLkoKd1L64TcoetR09qRaZVOm7hwqaEg3ZEIn+ 5atOHBoQzs9xfNfkk5eto6kcbk8fJ3knJh9ym6vWVSf+/LPQxWB4cw4Gmf+eaw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684006453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FRJAdQfSJl14BbyOaT4G3/hWq1xYQEBEbVi1WZwPfAA=; b=w/JX4RSWLIufLTIMepaSNIqHYwISqwOp25Qj+HXexDfZ573AzTH9VMmD6u3H0HdU9H9fJs VlWnNiDyhhhGzSCA== To: Ido Schimmel Cc: syzbot , linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Peter Zijlstra Subject: Re: [syzbot] [kernel?] possible deadlock in __hrtimer_run_queues In-Reply-To: References: <00000000000026b68305fb78c24d@google.com> <871qjldbes.ffs@tglx> Date: Sat, 13 May 2023 21:34:12 +0200 Message-ID: <87ilcw9gaz.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ido! On Sat, May 13 2023 at 12:37, Ido Schimmel wrote: > Thomas, I applied the fix on top of net-next (which includes > 0af462f19e63). I'm getting the splat below during boot and then the > systems hangs. Because I'm a moron. I got the same splat while testing, fixed it on the test machine and then did not sync it back before sending... Updated fix which also replaces GFP_ATOMIC with __GFP_HIGH to prevent the allocator to wake up the swap daemons, which causes yet another lock inversion issue. Thanks for testing! tglx --- --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -124,9 +124,9 @@ static const char *obj_states[ODEBUG_STA [ODEBUG_STATE_NOTAVAILABLE] = "not available", }; -static void fill_pool(void) +static void debug_objects_fill_pool(void) { - gfp_t gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; + gfp_t gfp = __GFP_HIGH | __GFP_NORETRY | __GFP_NOWARN; struct debug_obj *obj; unsigned long flags; @@ -157,6 +157,13 @@ static void fill_pool(void) raw_spin_unlock_irqrestore(&pool_lock, flags); } + /* + * On RT enabled kernels the pool refill must happen in preemptible + * context: + */ + if (IS_ENABLED(CONFIG_PREEMPT_RT) && !preemptible()) + return; + if (unlikely(!obj_cache)) return; @@ -587,16 +594,6 @@ static struct debug_obj *lookup_object_o return NULL; } -static void debug_objects_fill_pool(void) -{ - /* - * On RT enabled kernels the pool refill must happen in preemptible - * context: - */ - if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible()) - fill_pool(); -} - static void __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack) { @@ -690,13 +687,16 @@ int debug_object_activate(void *addr, co if (!debug_objects_enabled) return 0; - debug_objects_fill_pool(); - db = get_bucket((unsigned long) addr); - raw_spin_lock_irqsave(&db->lock, flags); + obj = lookup_object(addr, db); + if (!obj) { + raw_spin_unlock_irqrestore(&db->lock, flags); + debug_objects_fill_pool(); + raw_spin_lock_irqsave(&db->lock, flags); + obj = lookup_object_or_alloc(addr, db, descr, false, true); + } - obj = lookup_object_or_alloc(addr, db, descr, false, true); if (likely(!IS_ERR_OR_NULL(obj))) { bool print_object = false; @@ -901,13 +901,17 @@ void debug_object_assert_init(void *addr if (!debug_objects_enabled) return; - debug_objects_fill_pool(); - db = get_bucket((unsigned long) addr); - raw_spin_lock_irqsave(&db->lock, flags); - obj = lookup_object_or_alloc(addr, db, descr, false, true); + obj = lookup_object(addr, db); + if (!obj) { + raw_spin_unlock_irqrestore(&db->lock, flags); + debug_objects_fill_pool(); + raw_spin_lock_irqsave(&db->lock, flags); + obj = lookup_object_or_alloc(addr, db, descr, false, true); + } raw_spin_unlock_irqrestore(&db->lock, flags); + if (likely(!IS_ERR_OR_NULL(obj))) return;