From patchwork Fri Jun 9 07:50:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Shuai X-Patchwork-Id: 105383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp792081vqr; Fri, 9 Jun 2023 01:23:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bmdMFd/fj8OCybZiNDrRQcnwseQ+APJ2KJMr1sfVldT1ltqgQ8xRehzyo/iQ8eJHRYKh/ X-Received: by 2002:a17:90b:1b50:b0:24d:fbaf:e0b1 with SMTP id nv16-20020a17090b1b5000b0024dfbafe0b1mr453738pjb.19.1686298983764; Fri, 09 Jun 2023 01:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686298983; cv=none; d=google.com; s=arc-20160816; b=L827VvYFcNx421mbtX4UOOslUpHqcx9OUeShCRG6peNgjkQgVNXXblsMKimSZ3Y4LK PPeeh0qP6iUxugWzqHzzCys/K2OuyERh+sUuZwRZpbBVOUlkzBXDytr2bQRNx/Ha/gq2 rS38ED+vRogi65YroYyKCOO5tRcGZ8Ft0wWWk8TxJw8nyfrXUu7dNhB9h9fX6tB/Jx12 qEvi1JEaVfAMH7R8mUTeT6DCsJHKHC8LXzp82XZMq/GH1VoudXCXTKpmywTDtHWT62IW Sz7KigauQIIkU35BoJ8eDdUlZLfouFTYEMe/sfnkBYe9tCVFyW24PGg1Unovpy3yoE6H AlKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=IlrabuExy81wa2jjbNsw5UztXDKHt/aFUCH3BK9QAik=; b=hSB1KAgpRgCjERKDS3ekKRML1jyqWrtQ7MO+9ZqSiSIKzHo6+QAEchJMtmFoTff0Dt JVI5ccPQymNz7C05nSKOSOZMcK+zfz+HAa0rwUSSEQWfLoYmnjtiNP7rbwfq6udpQBdY pdn76JC4vwyJ6cJgoD8xUwTi6yntmqEk06PiCfZ60xkU7QILejIgSXjCRxKft0gZ/SNJ 4qg00dEWZ+3OC/H7au/BDHe20Agsw9xb62zumGaZya5txuKcS/KrLeg4ODOlkNPo1aUt yT/dZKArfUF0oTRYeKkxDVISf3GCdhUlZGUDdK6Bw2lRCS95yfMQKdIfBgReqRi3A/n9 wIaA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lk2-20020a17090b33c200b00259609d53cesi4201170pjb.68.2023.06.09.01.22.49; Fri, 09 Jun 2023 01:23:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240057AbjFIIDi (ORCPT + 99 others); Fri, 9 Jun 2023 04:03:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230334AbjFIIDJ (ORCPT ); Fri, 9 Jun 2023 04:03:09 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 154354EFD for ; Fri, 9 Jun 2023 01:01:31 -0700 (PDT) X-QQ-mid: bizesmtp75t1686297183t5b49ol1 Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 09 Jun 2023 15:53:01 +0800 (CST) X-QQ-SSF: 01200000000000908000000A0000000 X-QQ-FEAT: LE7C6P2vL8Slpzrm1XqX/NSEq4Gh8yu/0CJVEhG8vffk67PxM+PX5fPKMAlLY cgVx+LApeHIIP4dPRnWhGhFCTTNr3/nY1V9COFfHlHFW3kufcVYPY5wQiaID8SLjuxaLa2E uNUE3Nl33XPXZcR1sazoJ3lDRQ30XwbCdCW4r+ZJucfFTDmZpCIP74QOunzFYPg6xcoXQyE r5zlMKRlUYcxQxsQYmrteRd1dE/L1azUwb5i68qYa04kwxAB2Aq+olALF7hzEyQk9Jvky04 BjIzBrbmsS/uJOC516TK+B+lockpx9YGn5dcNW7fLP+YGmzayoXwCx7bchmeld3f3gBgVRC j6WpjWtsSXld/DrLKqb6MjXzfXcYREx6UdmcvNfMW7tFSSThGRKJJoUOie62w== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 15822184315123759459 From: Song Shuai To: catalin.marinas@arm.com, will@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, chris@zankel.net, jcmvbkbc@gmail.com, songshuaishuai@tinylab.org, steven.price@arm.com, vincenzo.frascino@arm.com, leyfoon.tan@starfivetech.com, mason.huo@starfivetech.com, jeeheng.sia@starfivetech.com, conor.dooley@microchip.com, ajones@ventanamicro.com Cc: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH V2 1/4] ARM: hibernate: remove WARN_ON in save_processor_state Date: Fri, 9 Jun 2023 15:50:46 +0800 Message-Id: <20230609075049.2651723-2-songshuaishuai@tinylab.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230609075049.2651723-1-songshuaishuai@tinylab.org> References: <20230609075049.2651723-1-songshuaishuai@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768212643181665690?= X-GMAIL-MSGID: =?utf-8?q?1768212643181665690?= 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. In the case of CONFIG_PM_SLEEP_SMP=n, freeze_secondary_cpus is not defined, but 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. So remove the unnecessary checking in save_processor_state. Signed-off-by: Song Shuai --- arch/arm/kernel/hibernate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/kernel/hibernate.c b/arch/arm/kernel/hibernate.c index 2373020af965..84abccf3221a 100644 --- a/arch/arm/kernel/hibernate.c +++ b/arch/arm/kernel/hibernate.c @@ -33,7 +33,6 @@ int pfn_is_nosave(unsigned long pfn) void notrace save_processor_state(void) { - WARN_ON(num_online_cpus() != 1); local_fiq_disable(); } From patchwork Fri Jun 9 07:50:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Shuai X-Patchwork-Id: 105359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp785821vqr; Fri, 9 Jun 2023 01:07:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7O8dgvsS5/4OcFlrJ1sp2ughZdzFTH1VXxWTIuJnuTnd0WJDae4+zv7xQPSxWYvi663ipw X-Received: by 2002:a05:6a21:6808:b0:118:b2e1:9adb with SMTP id wr8-20020a056a21680800b00118b2e19adbmr542557pzb.61.1686298064672; Fri, 09 Jun 2023 01:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686298064; cv=none; d=google.com; s=arc-20160816; b=u3CS8D62vDEwZINr0g5m3JcELgawNnPlgZEmaTN6bPvCwEJ+f6gJENy5VRs6to9fCo RoEyPvlmYpnlP9GVLTjx55pSBHt7PB/LSOQFTMmHQ/ZhB/+pKuVbuBHQeLAjWWCyZDMu uKj8/Bsr+5lpZ+hhKzE6QNCiEvmKTC2BeDZneunaccauWXxzob12JvekX7emO3tw14oF hYZU/CVJln0wDrVDNuTiZJq5xW8ScUES9GjBlJpS80FBI/dPf3cysD7NbSQFcLssjNQF v55CmZorjhxUktgwQj9+5jsalYSnp/97YwRXFF6n79trkrZpKu1XTtTDoI2hl22Wdz/S /Atw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=cOXELgq6k6BiKMNNgntEHlGDk878F8pFtCnjlYmy8qw=; b=zoCfuGOs/DnAYGGT0r/W2C7uoLstAITpiUdPlnX6aIZu7z/UodYdIqc7ZfI8ewwVgE BjY3p1g3C58JLfsRv9exG0FEkXap0GjATdlCYcas4S+T38E11bRAsV7ITMzUkJr7/2aL szSeap0bhXCa75Mv1aaU4QwHwRrcWLDc+71B6lh/r4x6hz95xUwQERfxoMT5z8Tq4qky OhSRCE1aLqXC+cZk8pm88GOo37RqMmj12q7vd6w+FGrItmIJXVXWsoSpm5eWkXxkjimK O3N/7LlOgtKLFdlQrkZpUdtmeNNOWs3PhZdrj/bmQZPuspt2Z9EhzFi4KPXIHWJJZNJq av+g== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020a637b4b000000b00543f6a35a43si2363799pgn.306.2023.06.09.01.07.30; Fri, 09 Jun 2023 01:07:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238268AbjFIHzm (ORCPT + 99 others); Fri, 9 Jun 2023 03:55:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239848AbjFIHzN (ORCPT ); Fri, 9 Jun 2023 03:55:13 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B9B33AB2 for ; Fri, 9 Jun 2023 00:54:53 -0700 (PDT) X-QQ-mid: bizesmtp75t1686297188t6m0bx24 Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 09 Jun 2023 15:53:05 +0800 (CST) X-QQ-SSF: 01200000000000908000000A0000000 X-QQ-FEAT: UMQM+3VOEYsTPC6jMH0yzyXH1849klDsTAUlAptToZKS6J3/4lSimAAJC/4Gj WEUddFwIUU/2iF8bNZxbaQuHxqLUg5SxFyhEmhcPQC534imMFNhOcwHDyehWwvHQii490Zr cnCZorPfAhuqS4hv4C3m/udby3n0mIAvc5zXEG/oeEmxLYGywlgqwxeD0xRGvWfw77lbRKV Vu1L/Fe5f+BRDZPeTPFPWK33uLeuc9WQHaUcuJn8VUUGtDiWWO/JbsTAnVsRta3kqtiGwqe jA1gbcit/YVp+S79o12TSH6qmlBAnmXWtCrNSplYOBBWlUdNVfYES64zkcDROxPzNplA+zD d7eptdHA752wVCXgT2bSBhpDPTXeAiPDt448w1sOQRbijVWdOpLDcg/G0wjKQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 18318848536038158331 From: Song Shuai To: catalin.marinas@arm.com, will@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, chris@zankel.net, jcmvbkbc@gmail.com, songshuaishuai@tinylab.org, steven.price@arm.com, vincenzo.frascino@arm.com, leyfoon.tan@starfivetech.com, mason.huo@starfivetech.com, jeeheng.sia@starfivetech.com, conor.dooley@microchip.com, ajones@ventanamicro.com Cc: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH V2 2/4] arm64: hibernate: remove WARN_ON in save_processor_state Date: Fri, 9 Jun 2023 15:50:47 +0800 Message-Id: <20230609075049.2651723-3-songshuaishuai@tinylab.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230609075049.2651723-1-songshuaishuai@tinylab.org> References: <20230609075049.2651723-1-songshuaishuai@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768211679628475805?= X-GMAIL-MSGID: =?utf-8?q?1768211679628475805?= 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. In the case of CONFIG_PM_SLEEP_SMP=n, freeze_secondary_cpus is not defined, but 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. So remove the unnecessary checking in save_processor_state. Signed-off-by: Song Shuai Acked-by: Will Deacon --- arch/arm64/kernel/hibernate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index 788597a6b6a2..02870beb271e 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -99,7 +99,6 @@ int pfn_is_nosave(unsigned long pfn) void notrace save_processor_state(void) { - WARN_ON(num_online_cpus() != 1); } void notrace restore_processor_state(void) From patchwork Fri Jun 9 07:50:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Shuai X-Patchwork-Id: 105357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp785550vqr; Fri, 9 Jun 2023 01:07:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6UoLn6UUStu95ylfRA5wVfVhJ7vK0I0rDfZ4nsXasmSA3v8czEeEX8OyctU8qw/Nl9x9Gz X-Received: by 2002:a05:6a20:4403:b0:103:b585:b587 with SMTP id ce3-20020a056a20440300b00103b585b587mr1349298pzb.13.1686298028837; Fri, 09 Jun 2023 01:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686298028; cv=none; d=google.com; s=arc-20160816; b=aiZxU2Rf/BAnWZbL/X1E0rW+Uz1bSQEw4lan2f1en4ON6lKiY9sC7qZaLe0bSdBCUb vivCOnYyph9xmdnnmUkcsjcNA0NFl25iN0/W9y8PhLzqSCEvtgZb7dgwTOpUBLC8jkyT /LIKbvNmTynnv4GFIAS1q1UtQq4/t2bt+kwY+MEEAqUcmg6dMZ7RuEeBsO9zZWzurnWn xG2/fc65uE6eVTnunpuU1sAc6Hgg1A8NDpRybREGg6/4XPzuZshywWtr3wCDo4rKVhVN /Uy4jUEENl+DA3ikzmYX8ZbujR8ZAOIHhFVITAm2zQzRcCXe45eOxATd1gwGHt91G4yW 6dWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=LSq2huYFiL+Jeb28UiLXaPg8oSbTAymigPOLt/9OuPw=; b=k4iA2f2G+5c4Snc0csl1zcYicslCdmtDWaU/2z/osUZiCl9WePqxELdhz3qPq9cH0F EIj9adRuH3qKvmvhkirPdSprLdYHGiVJxEZN7pQ0a1bhREMxXNjz3pdu7VLGHFr1mk9K ReXo1miVw16t9ZdJyyOScbL/0kAmQ9bmoQ1ThW/5/yY/h+WvfS8T/GUmZBxLXrWfCURS lbEFYeloe6ImiK6Fc4xq0JWMwFQF00rEEMmSCZEZ9xkfdC0BmnYvTbasnCmsldAwWOpu FxhDitTpJJwbpsJ8+3THUz8VN7G4c8lsjEWt7vM8bnI+31uEh0hzLx0Foo3Yv5HSGLQn HKJw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020aa79616000000b0065ba0464407si2115662pfg.116.2023.06.09.01.06.54; Fri, 09 Jun 2023 01:07:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238757AbjFIH7Y (ORCPT + 99 others); Fri, 9 Jun 2023 03:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238935AbjFIH61 (ORCPT ); Fri, 9 Jun 2023 03:58:27 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26BF23ABC for ; Fri, 9 Jun 2023 00:57:17 -0700 (PDT) X-QQ-mid: bizesmtp75t1686297192tngrrsv3 Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 09 Jun 2023 15:53:11 +0800 (CST) X-QQ-SSF: 01200000000000908000000A0000000 X-QQ-FEAT: 3M0okmaRx3ggkGfYbCwXKFcJVxYo7gx8Sd8QId2cLz94QTT20Ue9kVFXfH7mk XRXlTwTPdy4vaDs5QViLJiCIfTnjIdM9r0mNkM/Lo3tRdqRvMoViq+uW6suj/6O70CZSodZ yBkndruclxcfHizm+Fcgr3DrJVwpcAoftfoXGn+7GgsyQkty+8LJ4UE1s3/3RBGpPMOHVeK ATBQplGoG5mPSJPc3SB14N13nmWOdlD/iBdWVzvi5FYQ2rgb/sK7huHvdmi2+iOBgjNj3p+ efTBedwnRLQ+FO9VOscQFfyuQWNvAHv9gArJiuKQYS+RslHMEsQxfCrZNFCY3pvsv1MQX35 Zk6sV93P4gpMhJFjQp1Zd3fFu6+4uY89VJEcQV3S3Cg0AvEvqQ8ahkzsyLvhQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 10720794791275635707 From: Song Shuai To: catalin.marinas@arm.com, will@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, chris@zankel.net, jcmvbkbc@gmail.com, songshuaishuai@tinylab.org, steven.price@arm.com, vincenzo.frascino@arm.com, leyfoon.tan@starfivetech.com, mason.huo@starfivetech.com, jeeheng.sia@starfivetech.com, conor.dooley@microchip.com, ajones@ventanamicro.com Cc: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH V2 3/4] riscv: hibernate: remove WARN_ON in save_processor_state Date: Fri, 9 Jun 2023 15:50:48 +0800 Message-Id: <20230609075049.2651723-4-songshuaishuai@tinylab.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230609075049.2651723-1-songshuaishuai@tinylab.org> References: <20230609075049.2651723-1-songshuaishuai@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768211641869363103?= X-GMAIL-MSGID: =?utf-8?q?1768211641869363103?= 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. In the case of CONFIG_PM_SLEEP_SMP=n, freeze_secondary_cpus is not defined, but 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. So remove the unnecessary checking in save_processor_state. Fixes: c0317210012e ("RISC-V: Add arch functions to support hibernation/suspend-to-disk") Signed-off-by: Song Shuai Reviewed-by: Conor Dooley --- arch/riscv/kernel/hibernate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/riscv/kernel/hibernate.c b/arch/riscv/kernel/hibernate.c index 395f835f067c..86f1c9ab6b0b 100644 --- a/arch/riscv/kernel/hibernate.c +++ b/arch/riscv/kernel/hibernate.c @@ -119,7 +119,6 @@ int pfn_is_nosave(unsigned long pfn) void notrace save_processor_state(void) { - WARN_ON(num_online_cpus() != 1); } void notrace restore_processor_state(void) From patchwork Fri Jun 9 07:50:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Shuai X-Patchwork-Id: 105375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp789478vqr; Fri, 9 Jun 2023 01:16:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7IOOCMiucUt3V+s66mCGWouS3r6rQdDZffaPNOTDvAagx0XrS535LBRcIhZJRdDr17w/Aa X-Received: by 2002:a17:90b:4a4c:b0:24e:14a4:9b92 with SMTP id lb12-20020a17090b4a4c00b0024e14a49b92mr1384269pjb.5.1686298582906; Fri, 09 Jun 2023 01:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686298582; cv=none; d=google.com; s=arc-20160816; b=tA2JjlNOlkuZ/YC+mEKtvT/O5LA2JGtY5JwqYD7hnbcNsCAr7zhLzXMSqDVOTpM+jM ISWn/Q7jfEKM+Cv/xM7aR2r9eMZTs1uts0ziOyFJZ08eEob1BX2AOH/ES9bezUHLYdZJ ds/OHjjDmglAjd98+lQBd3GIA7V8IYU73ZsiFhjakPsRrdjlRC+YiGZz/nRhTHVHWSR7 EDOUz9k4XksAO/pKGWeFTq7QL5ZjzS8oyoHydYhFfV74bxlUisf0wg+HZAciPJfmeDXp La5R3fgmwF7VUjv68SmlFbzFmcD9lYq7giYIKp/JIXq5Vep6IOxqMuZYhSaTd0nziD7e OO/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=/2bfth/BagJ5lE+ig4GB9W1+Vx6SGMp5Ma3sslUc8SU=; b=EXvH97U43X70PahI8XIJ8+PIg5ttsG5HzFB8w9zh2yg7CsIGBK8CXtFi8vKayi3jdC oOZKR7EOPcxnhlQUe+I01FL/MwOG6vQaeMt8B8m6F+CW1zSxr8kBo31gRhhxi6hM8jk0 2MjtIZyl4Hhi+Wa5c/IlkZEDAaOF1ObXxLTe+ioFfOAxHNSEvYVu+S3vXTskTa0fiLs1 ddz35kam1p91uGLmi1M/n/p7oXzZ4Z3kWxHOJn9Ec1qiqqHC6itskTg4bNtdDbPmcccW AQQdkE1+ooYyAs8XkMTnl3oWPROKYL40+6O7QiPleYa4BVUsExmw63VhxdWbcrRnxC2Z 5ZNA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v16-20020a63d550000000b00543c8ad57f1si2405604pgi.67.2023.06.09.01.16.07; Fri, 09 Jun 2023 01:16:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238922AbjFIH71 (ORCPT + 99 others); Fri, 9 Jun 2023 03:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbjFIH60 (ORCPT ); Fri, 9 Jun 2023 03:58:26 -0400 X-Greylist: delayed 141 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 09 Jun 2023 00:57:18 PDT Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 153D73AB8 for ; Fri, 9 Jun 2023 00:57:17 -0700 (PDT) X-QQ-mid: bizesmtp75t1686297197t84smj5p Received: from localhost.localdomain ( [58.240.82.166]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 09 Jun 2023 15:53:16 +0800 (CST) X-QQ-SSF: 01200000000000908000000A0000000 X-QQ-FEAT: eSZ1CZgv+JDrzqJXUyJ/mcu057NGxL1xBlezD+yoPQqZOp/XEym+SAkiqR8mP y/mpdUlUsr3GccK7aytaQDnPMxaiHL0++ERM3P1l+Z/Ht3BibeLCrNg1poYm/nD5zSwsdMD x72PQm0lIBAV69smXv3fYf+3+HlF6GoJyEZQNabbUaICIzb/E+0kXyTuI+T+To9yodHmBDi lHBYo3hnlIeaXt+2+yLenDhJTnsQ2nxYthPnKi+X7qAPucOcklQ2F4jIZVhOcufgT5JU8AT Y+xJXmSZCBgWSYe/O0u0TIksw1pW0bqCG4b+661yftYmZawpM3HxK5RHa0LJQUgbugjwNuR WIICypWsMDvDee8ZyVamLyn6/2XgGOU6joVIrGjkqnxJHXfJbmwurL5VSNFuQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 2352795355600838194 From: Song Shuai To: catalin.marinas@arm.com, will@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, chris@zankel.net, jcmvbkbc@gmail.com, songshuaishuai@tinylab.org, steven.price@arm.com, vincenzo.frascino@arm.com, leyfoon.tan@starfivetech.com, mason.huo@starfivetech.com, jeeheng.sia@starfivetech.com, conor.dooley@microchip.com, ajones@ventanamicro.com Cc: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH V2 4/4] xtensa: hibernate: remove WARN_ON in save_processor_state Date: Fri, 9 Jun 2023 15:50:49 +0800 Message-Id: <20230609075049.2651723-5-songshuaishuai@tinylab.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230609075049.2651723-1-songshuaishuai@tinylab.org> References: <20230609075049.2651723-1-songshuaishuai@tinylab.org> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768212222761073247?= X-GMAIL-MSGID: =?utf-8?q?1768212222761073247?= 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. In the case of CONFIG_PM_SLEEP_SMP=n, freeze_secondary_cpus is not defined, but 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. So remove the unnecessary checking in save_processor_state. Signed-off-by: Song Shuai --- arch/xtensa/kernel/hibernate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/xtensa/kernel/hibernate.c b/arch/xtensa/kernel/hibernate.c index 06984327d6e2..314602bbf431 100644 --- a/arch/xtensa/kernel/hibernate.c +++ b/arch/xtensa/kernel/hibernate.c @@ -14,7 +14,6 @@ int pfn_is_nosave(unsigned long pfn) void notrace save_processor_state(void) { - WARN_ON(num_online_cpus() != 1); #if XTENSA_HAVE_COPROCESSORS local_coprocessors_flush_release_all(); #endif