Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2415245ioo; Sat, 28 May 2022 12:53:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq3U+LU7d7lkjXveOfyw3WLz7qoVpkN/ae5BE3LHO7VSr10A9rH3DUCq4Ca6zVP/5DqPVO X-Received: by 2002:a17:902:9b94:b0:161:5a74:aa6c with SMTP id y20-20020a1709029b9400b001615a74aa6cmr48205803plp.108.1653767614307; Sat, 28 May 2022 12:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653767614; cv=none; d=google.com; s=arc-20160816; b=z/ZczQyO5FptMSjHqS7p6/pUuO7VB5OhAHiWePf0urxmEZ52iPhmtkVpSqKFGlSvcU MJLe3WOqVFO4s4gutzKdlkhh9xTTjAdyETkspubXZueZIAGTkKHCJ3L1QB2ipYv3/h+b WEC+SzVJtZ0PkawZe/9Q5f9o+qskDQ+tnwf4zWsyNIIeq7CTP79IyZV7hAVenwux1Edi OtTuMSkxYuSOCJXcLMM9Ttg3NzLBeifi0jegfBH4yXZJPoABgS9L8uc7PG3EM6IL47f4 0lPAnaUjpYsbgx81NSKXeqyj0N1OiliGwilITctdciGoqqbwDYU3V6vLjfuOLI+XqdZR nfhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/Y46BWpHrd9tkntXCOk51y3fuj4rMYPJnHD26/b0FwE=; b=DSYHjNoG6aORtrWKkkOYpr3R+8puAkNg8byp0n0NX/GJT4/STkSzIyUZ6mgYp7oHKJ D9/zW3uoJ/ko1kNoRhrgJ4OWehLSCmovfa3yqA271wDnO7E4O86ujDDBlcPrrlVUISLe cJdRI+ki00ocF22FoV2ZHGOuQTElOfEgSnFDFXjygG82vZ/u6VDvE5+LK5k1smSqIJYM Rv2gSjD0VxmlRAGvBISM7viljHVwwRPxTi/rskbj/lrPc9mkuV+g0OEGWtEnXaebL8eN dXfyHvqKzG460h/9P7MXU/NHbEOgatdMRv6skJOMvQUr39s8e4UpenCeT67Dl4iJYEbn Gnhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i9EAyOCh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x6-20020a627c06000000b0050d3f057ea9si9492561pfc.235.2022.05.28.12.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:53:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i9EAyOCh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 484AB44A0D; Sat, 28 May 2022 12:13:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348110AbiEZQG3 (ORCPT + 99 others); Thu, 26 May 2022 12:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348096AbiEZQGX (ORCPT ); Thu, 26 May 2022 12:06:23 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 51584E08F for ; Thu, 26 May 2022 09:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653581181; 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=/Y46BWpHrd9tkntXCOk51y3fuj4rMYPJnHD26/b0FwE=; b=i9EAyOChnG92hjAu1CAYm8W/7je8LWgGv7qpzlNSr2FX20YaDrEz/mDpPmPwqVooHTPNxl jiwfQ1579gUs+UQmwsI5o7ByzX/c/7I9St+ax46vKz7EqMO82MTUWiwN7fgDr68/QGBfnm Y1SkWKPB/cR8Idh0VeJt6oxWuTGrY6g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-669-M_BZ9zLKNcWY5QZK7ylQbg-1; Thu, 26 May 2022 12:06:16 -0400 X-MC-Unique: M_BZ9zLKNcWY5QZK7ylQbg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 92956100BAB8; Thu, 26 May 2022 16:06:16 +0000 (UTC) Received: from pauld.bos.com (dhcp-17-51.bos.redhat.com [10.18.17.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id 709B4400F3E8; Thu, 26 May 2022 16:06:16 +0000 (UTC) From: Phil Auld To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Peter Zijlstra , Valentin Schneider Subject: [PATCH v2 1/2] cpuhp: make target_store() a nop when target == state Date: Thu, 26 May 2022 12:06:14 -0400 Message-Id: <20220526160615.7976-2-pauld@redhat.com> In-Reply-To: <20220526160615.7976-1-pauld@redhat.com> References: <20220526160615.7976-1-pauld@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 writing the current state back in hotplug/target calls cpu_down() which will set cpu dying even when it isn't and then nothing will ever clear it. A stress test that reads values and writes them back for all cpu device files in sysfs will trigger the BUG() in select_fallback_rq once all cpus are marked as dying. kernel/cpu.c::target_store() ... if (st->state < target) ret = cpu_up(dev->id, target); else ret = cpu_down(dev->id, target); cpu_down() -> cpu_set_state() bool bringup = st->state < target; ... if (cpu_dying(cpu) != !bringup) set_cpu_dying(cpu, !bringup); Fix this by letting state==target fall through in the target_store() conditional. Signed-off-by: Phil Auld --- kernel/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index d0a9aa0b42e8..cdb6ac10ad94 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -2315,7 +2315,7 @@ static ssize_t target_store(struct device *dev, struct device_attribute *attr, if (st->state < target) ret = cpu_up(dev->id, target); - else + else if (st->state > target) ret = cpu_down(dev->id, target); out: unlock_device_hotplug(); -- 2.18.0