From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,BIGNUM_EMAILS, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C4F5C433E0 for ; Fri, 22 Jan 2021 07:40:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D578922DBF for ; Fri, 22 Jan 2021 07:40:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726986AbhAVHkk (ORCPT ); Fri, 22 Jan 2021 02:40:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37186 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726919AbhAVHki (ORCPT ); Fri, 22 Jan 2021 02:40:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611301151; 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=X9lvA5UDm4oX9uf5clHSyw8y7oQMIw3ieGwQZk1aJOw=; b=VMCn5kyqPGf8pGFQmMhqUqFfwYIgwP4NvK4XMcZmEv/9YkISV7vwZnFwFea6gUZ3ymfQVY xPRxB+zRdJ0OI8cd+l5+Ip/SuUn7SF5/Ar9k3/Uyiu3RixRkNKr8lzZccXgHhMEy2nOGnZ nxwcUR5xKx3p6CQwT0AqsZg+naOysrs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-Y9ZXzACiMKquMwXmK7Y2qw-1; Fri, 22 Jan 2021 02:39:07 -0500 X-MC-Unique: Y9ZXzACiMKquMwXmK7Y2qw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 039AA1005504; Fri, 22 Jan 2021 07:39:06 +0000 (UTC) Received: from localhost (ovpn-12-183.pek2.redhat.com [10.72.12.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6DC5100238C; Fri, 22 Jan 2021 07:39:01 +0000 (UTC) Date: Fri, 22 Jan 2021 15:38:59 +0800 From: Baoquan He To: "Rafael J. Wysocki" Cc: Pingfan Liu , Dave Young , Kexec Mailing List , Dan Carpenter , Linux PM Subject: Re: [bug report] PM / reboot: Eliminate race between reboot and suspend Message-ID: <20210122073859.GA4797@MiWiFi-R3L-srv> References: <20201118185917.GA433776@mwanda> <20210120093015.GE20161@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 01/21/21 at 03:42pm, Rafael J. Wysocki wrote: > On Thu, Jan 21, 2021 at 10:14 AM Pingfan Liu wrote: > > > > On Wed, Jan 20, 2021 at 5:30 PM Baoquan He wrote: > > > > > > Hi, > > > > > > On 11/18/20 at 09:59pm, Dan Carpenter wrote: > > > > Hello Pingfan Liu, > > > > > > > > The patch 55f2503c3b69: "PM / reboot: Eliminate race between reboot > > > > and suspend" from Jul 31, 2018, leads to the following static checker > > > > warning: > > > > > > > > kernel/power/main.c:27 lock_system_sleep() > > > > warn: called with lock held. '&system_transition_mutex' > > > > > > This is a good finding. I think we can simply remove the lock/unlock > > > pair of system_transition_mutex in kernel_kexec() function. The dead > > > lock should be easily triggered, but it hasn't caused any failure report > > > because the feature 'kexec jump' is almost not used by anyone as far as > > > I know. We may need to find out who is using it and where it's used > > > through an inquiry. Before that, we can just remove the lock operation > > > inside CONFIG_KEXEC_JUMP ifdeffery scope. Thanks. > > > > > > > > > diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c > > > index 80905e5aa8ae..a0b6780740c8 100644 > > > --- a/kernel/kexec_core.c > > > +++ b/kernel/kexec_core.c > > > @@ -1134,7 +1134,6 @@ int kernel_kexec(void) > > > > > > #ifdef CONFIG_KEXEC_JUMP > > > if (kexec_image->preserve_context) { > > > - lock_system_sleep(); > > > pm_prepare_console(); > > > error = freeze_processes(); > > > if (error) { > > > @@ -1197,7 +1196,6 @@ int kernel_kexec(void) > > > thaw_processes(); > > > Restore_console: > > > pm_restore_console(); > > > - unlock_system_sleep(); > > > > This should work since the only caller syscall_reboot has already > > placed kernel_kexec() under the protection of system_transition_mutex. > > > > Thanks for the fix. > > > > Reviewed-by: Pingfan Liu > > OK, so can anyone please submit that patch formally (Cc linux-pm, please)? I will submit a patch with Pingfan's ack, thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2r2G-0001ox-LV for kexec@lists.infradead.org; Fri, 22 Jan 2021 07:39:13 +0000 Date: Fri, 22 Jan 2021 15:38:59 +0800 From: Baoquan He Subject: Re: [bug report] PM / reboot: Eliminate race between reboot and suspend Message-ID: <20210122073859.GA4797@MiWiFi-R3L-srv> References: <20201118185917.GA433776@mwanda> <20210120093015.GE20161@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: "Rafael J. Wysocki" Cc: Kexec Mailing List , Dave Young , Dan Carpenter , Pingfan Liu , Linux PM On 01/21/21 at 03:42pm, Rafael J. Wysocki wrote: > On Thu, Jan 21, 2021 at 10:14 AM Pingfan Liu wrote: > > > > On Wed, Jan 20, 2021 at 5:30 PM Baoquan He wrote: > > > > > > Hi, > > > > > > On 11/18/20 at 09:59pm, Dan Carpenter wrote: > > > > Hello Pingfan Liu, > > > > > > > > The patch 55f2503c3b69: "PM / reboot: Eliminate race between reboot > > > > and suspend" from Jul 31, 2018, leads to the following static checker > > > > warning: > > > > > > > > kernel/power/main.c:27 lock_system_sleep() > > > > warn: called with lock held. '&system_transition_mutex' > > > > > > This is a good finding. I think we can simply remove the lock/unlock > > > pair of system_transition_mutex in kernel_kexec() function. The dead > > > lock should be easily triggered, but it hasn't caused any failure report > > > because the feature 'kexec jump' is almost not used by anyone as far as > > > I know. We may need to find out who is using it and where it's used > > > through an inquiry. Before that, we can just remove the lock operation > > > inside CONFIG_KEXEC_JUMP ifdeffery scope. Thanks. > > > > > > > > > diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c > > > index 80905e5aa8ae..a0b6780740c8 100644 > > > --- a/kernel/kexec_core.c > > > +++ b/kernel/kexec_core.c > > > @@ -1134,7 +1134,6 @@ int kernel_kexec(void) > > > > > > #ifdef CONFIG_KEXEC_JUMP > > > if (kexec_image->preserve_context) { > > > - lock_system_sleep(); > > > pm_prepare_console(); > > > error = freeze_processes(); > > > if (error) { > > > @@ -1197,7 +1196,6 @@ int kernel_kexec(void) > > > thaw_processes(); > > > Restore_console: > > > pm_restore_console(); > > > - unlock_system_sleep(); > > > > This should work since the only caller syscall_reboot has already > > placed kernel_kexec() under the protection of system_transition_mutex. > > > > Thanks for the fix. > > > > Reviewed-by: Pingfan Liu > > OK, so can anyone please submit that patch formally (Cc linux-pm, please)? I will submit a patch with Pingfan's ack, thanks. _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec