Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5728312rwd; Mon, 5 Jun 2023 07:49:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Cyug4pQ2fL4enfDXghjRTfJcNGJXdKJLkcpm2MSmCrfIeyyyrCLGvnhfdHrhBEon3Dl/w X-Received: by 2002:a05:6a00:a24:b0:645:8a69:faad with SMTP id p36-20020a056a000a2400b006458a69faadmr14827966pfh.14.1685976598934; Mon, 05 Jun 2023 07:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685976598; cv=none; d=google.com; s=arc-20160816; b=H8zmeEYO+C1B8ltgGut7ZRgISQ8ghPw4Q2VGHH+l20rkaLSPVWs9Hu/h2/k178YeRx imonIa+9sgezXgmYJi4EP0PygixVIfrL3hoZgE8Zpaj3aro7NEw+k3oyKDPhEgREXGd7 vBWVHKlUbzjW+XLuz0N7KFrZDzrbrbbWmWwGL8H9yTdG9HzWyb9KLaVXYU1lln+SKYkc 9qmHVZD2gWFMd6e5CIrqf1TdNC588g5ejGvZbpQma5gKONW5kNZAemG36X/2njDE7jyH g17ObWB8CWk9OapfOV1Jy/gwJZzwlBkmRKZoRWcdo2+/5Qhz8VvdOZ5DEMalmbg6XMMO 0H/w== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=3J27GNOAaYAcg2/OQpiA0yRvMrVxHWe6WRS5SogWUdA=; b=drtX5OqfR4FoSF9pH1FKdxzzfmuw4xgIqHAOLyS7B8XfzT41xbfDg5ljcdc/TS8W0/ clbyRWhttCYrxmogUhW8nRvdxAQ+z6Y7E8iDe5LE6PIO8303dXaN6GxDuHAOCxqXS0Fj XiDB+VamXRIkJiAh/hff8R42oJEjY/QUAeMnrAUBsEomO5hzLdCTlgEalNMx0SakUa/3 MjmlJzKY/mV0XELStfKauW9VxX3/M6G9vIesq09yT/I2PEN8PvqExAjrZHEbhHqx/2E1 +QLdEir9o/9DRUmlwHmmOa+zkxwH+ZAOOdAhcwTzW6G0Xux59h65HbdkyDRzfXb8cDTw 0ZRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YkFIZcwv; 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 p11-20020aa79e8b000000b0064583a79521si3733728pfq.283.2023.06.05.07.49.43; Mon, 05 Jun 2023 07:49:58 -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=YkFIZcwv; 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 S233708AbjFEO3I (ORCPT + 99 others); Mon, 5 Jun 2023 10:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbjFEO3G (ORCPT ); Mon, 5 Jun 2023 10:29:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 014FD9E for ; Mon, 5 Jun 2023 07:29:06 -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 91DA461299 for ; Mon, 5 Jun 2023 14:29:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5852C433EF; Mon, 5 Jun 2023 14:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685975345; bh=hZ87ZYTbpDOaTiFT09YI6BJw7NRtzjXefqSYa6e0NqY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YkFIZcwvKrxwZMZ4QVYNpyLfbt4KUpf5M8zr3ZdHC6RtfW7UqKbn/gNUtc0ldQK/W ++5AcyzPv3Ei5fshhQL5/+Dk4QFyUpsUFZ+G2TmRxCkmPQGXX+S8WJkJNS3QvmAHEG LoFFb9o1fCMurmj20vEZXK0lp2VCjsUW279AFo6Klr5ltnKowH4HINIh4Wq0pM1HIs UsevQ+8/vI9bzLRGuLet4bA5A7QhrMSZlx6C2SdEA99/gQYs45t73Kg3+0HTcSq4Hf ax1ETZm5L8ks2//V6Qj/How4qf0VbBOv+X1163Frad0anoZ8aIyx4D11udTTSVgg+K OJ8WXGnkkptOA== Date: Mon, 5 Jun 2023 15:28: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: <20230605142857.GE21212@willie-the-truck> References: <20230525025555.24104-1-songshuaishuai@tinylab.org> <20230525025555.24104-3-songshuaishuai@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230525025555.24104-3-songshuaishuai@tinylab.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 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? Will