Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1007832rwd; Thu, 8 Jun 2023 10:37:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zE4WHFMbR60jUwWUMXQfwhQVSq5ffFoe8A76/D5o6hCocspi4y6T+nTWoO0hw87dDiEeU X-Received: by 2002:a05:6a00:39a6:b0:662:e5f1:1760 with SMTP id fi38-20020a056a0039a600b00662e5f11760mr4733281pfb.0.1686245839238; Thu, 08 Jun 2023 10:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686245839; cv=none; d=google.com; s=arc-20160816; b=r4uoJoZnNs67R6APKfsJ+hLWd1VFCFvL478cvrL32TpWcoS0XKb6uUHnYtB4zMSw+a VFlsSFp93C9+NTx72HJHpQyW9I7jd1diJLWQ30VRfw+yOLIoCTnkReBk4p+hDcbxHRW5 wcAEZfY4Ja/lOx/7EOWWRFTiibs+og3mrGRUcYzwTWYQbpHttIeFp/V3PRcUx+Mgm2NR e4VwT0b9nOl5cAbyLKYD4DEpHYggwErSXlHu0ZK0KVDpvtwilif7ewkaWQN6rlGheN83 NQtdVAInZTiT9TgDK+zcopBnjm4OSom0Y23uupu0bf2jgFR37blmBfWTBudqACOb4Brt PlTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7WqGVFPJQkEPBRkk5We3xRQLyfZGSlvWE3eEC8OY/y0=; b=HYiYZO6UN8+8jjlMhO9skErgp9JtYrrnUUWd1AssLKPGHJvF1EJdPgKDxtt/uOveR3 vjgDUDCd0BH0mWwWxd412fga6RZd47u6eiRN8zHi8ILrCoYuyteNwvBss6zT9CseT2aG gqbhECefnQhKvjDwnKJhkEYTg1GpN4tYT/HypPuJyGFNE/nZ6Qbw4PJkWVLVY/Zvy/wA pTI/bcUA33EQux3xOm+n4wwz1GgoxnmgTmkG6gwlptKIiyDG4kdiwnR1MiLCVoFBuEOw GuY5113OJXeS6SyZAQQf9gt9oEW6EmdGrhuu12wzFOTiU2xML2NkmPUNR9WzLYdVdKOx 5pUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tLrmcXZz; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020aa79a12000000b0063d45a6d0e5si1132187pfj.17.2023.06.08.10.37.06; Thu, 08 Jun 2023 10:37:19 -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=@kernel.org header.s=k20201202 header.b=tLrmcXZz; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237235AbjFHR1R (ORCPT + 99 others); Thu, 8 Jun 2023 13:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237114AbjFHR1P (ORCPT ); Thu, 8 Jun 2023 13:27:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FBB72D56 for ; Thu, 8 Jun 2023 10:27:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7501564FF4 for ; Thu, 8 Jun 2023 17:27:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3C4CC4339C; Thu, 8 Jun 2023 17:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686245224; bh=nOqZblan5c5tTtOJCM+nEcD7kzkArHJjMVIRKk2SO90=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tLrmcXZzHFoldfmbo/NvgkBX1vpwL6vrcwjMTfcwyd/e0RqBFqn48AVPRv9gAp1am owwWRYtL/c5YdjLWEGRC5DnGA9xLEQk1/h4NPKMj0RNQdU4IKpVtAMbppcPU2JNbkx aDGt4cAYAlaRFb0NNNmmGOTxrXYPJzD0oRxaEag+TJkSjwERtdm9VKJXp8as47G9g3 JUHm9urC/uLmwrO65WGgicbLPIQBxzcbzleW1+oy6B5qpqlskdKNoj5c/7ozP//4X9 T+Kpez3QOgiYrANvmOMs9PLZCrhNvEKNDjXx3k9FDlUA4goT3wuwQUcoXx2Paz6T5a r+UG4KAfONcVA== Date: Thu, 8 Jun 2023 18:26:58 +0100 From: Will Deacon To: Song Shuai Cc: catalin.marinas@arm.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, chris@zankel.net, jcmvbkbc@gmail.com, steven.price@arm.com, vincenzo.frascino@arm.com, pcc@google.com, wangxiang@cdjrlc.com, ajones@ventanamicro.com, conor.dooley@microchip.com, jeeheng.sia@starfivetech.com, leyfoon.tan@starfivetech.com, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH 2/4] arm64: hibernate: remove WARN_ON in save_processor_state Message-ID: <20230608172656.GB1606@willie-the-truck> References: <20230525025555.24104-1-songshuaishuai@tinylab.org> <20230525025555.24104-3-songshuaishuai@tinylab.org> <20230605142857.GE21212@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, Jun 07, 2023 at 11:00:08AM +0800, Song Shuai wrote: > > > 在 2023/6/5 22:28, Will Deacon 写道: > > On Thu, May 25, 2023 at 10:55:53AM +0800, Song Shuai wrote: > > > During hibernation or restoration, freeze_secondary_cpus > > > checks num_online_cpus via BUG_ON, and the subsequent > > > save_processor_state also does the checking with WARN_ON. > > > > > > So remove the unnecessary checking in save_processor_state. > > > > This is a very terse summary of why this is safe. > > > > Looking at the code, freeze_secondary_cpus() does indeed check > > num_online_cpus(), or it returns an error which then causes the hibernation > > to fail. However, this is all in the CONFIG_PM_SLEEP_SMP=y case and it's > > far less clear whether your assertion is true if that option is disabled. > > > > Please can you describe your reasoning in more detail, and cover the case > > where CONFIG_PM_SLEEP_SMP=n as well, please? > > With HIBERNATION enabled, the sole possible condition to disable > CONFIG_PM_SLEEP_SMP > is !SMP where num_online_cpus is always 1. We also don't have to check it in > save_processor_state. Thanks. Please add that to the commit message. Will