Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2260521pxm; Fri, 4 Mar 2022 12:33:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAJTeMAJn/TDiTMD+j+N0ideuMNKmKHBSmvlc+GnpXsv2fFlHo/R4hwPBDvbeA9xsVunDZ X-Received: by 2002:a17:903:247:b0:151:b174:fba9 with SMTP id j7-20020a170903024700b00151b174fba9mr105253plh.79.1646425983113; Fri, 04 Mar 2022 12:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646425983; cv=none; d=google.com; s=arc-20160816; b=YYkbvdCf/xrYwGGw9a09gUeCHY8YDYneGQUH9ZP6C4GxxpMqXA6bTeylKdTrA6Kzxe 5pxJCRP148aoK7OYqMo06B1unmlXSrvLzOvtGDlGndyCikgA1nCn8v/YAaH4u29bSiFK xAsht9pT9vWTuqNO+2jiXqbBxmDJ59i1QHEzZIn7kRpgg40mZcJdZmeY8YCbTd72Z8D3 3OAF+ZncrbSOO69yzo7hGvrvSey5DDLy9EBUeEoIDyB7OODFI//03eytqXyFWBBIABf7 MVdfgW77Rqq6/5XsP8zGD7YKkSv3bBzXGG675k4ecXr2Q856nE6QllSIbJRTl0jFCpNj WElw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=FS+bon+RhwvLyi3UowFuaLCDsqbMIxH7LDxboPL14Hg=; b=YVD0he0CqiuJ9gZr3UD+lJRmuUhd6Im4RCsuGCx4iO6J61sO3CpmvT8nH1SXKbgYfY cDwyv7jf8l/TyX3tU8DHL1TDPE3MCyOYmEBtSHAHqXj9giV0l4ZHI2hoD6DXKjHQmG+m cCbTRkqVkoaTGQThl51A65qLSFBuiKz+L/POjGg1I48g68Md7521weRMGjb1ETjr2c3q a9TtGKHNO/J1kDtEQkflrIvi10xJJVNwzrUy/qoAR7i4KZL0vHBGSPR5nqNZrtL5fked ajtOFfJRzzs36LjK+sTfFrln49+Tpy0IYSs/U2hHvQOyvT3vL/Q+hXRQVpN7c5DWhSHD WwCw== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m20-20020a170902bb9400b0014f92171f08si5210495pls.439.2022.03.04.12.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:33:03 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B14462C5094; Fri, 4 Mar 2022 11:37:01 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240625AbiCDQOE (ORCPT + 99 others); Fri, 4 Mar 2022 11:14:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233175AbiCDQOB (ORCPT ); Fri, 4 Mar 2022 11:14:01 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 76B406E4C8; Fri, 4 Mar 2022 08:13:13 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42659143D; Fri, 4 Mar 2022 08:13:13 -0800 (PST) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.196.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 40CDC3F73D; Fri, 4 Mar 2022 08:13:12 -0800 (PST) From: Valentin Schneider To: tip-bot2 for Valentin Schneider , linux-tip-commits@vger.kernel.org Cc: Abhijeet Dharmapurikar , "Peter Zijlstra \(Intel\)" , "Steven Rostedt \(Google\)" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [tip: sched/core] sched/tracing: Don't re-read p->state when emitting sched_switch event In-Reply-To: <164614827941.16921.4995078681021904041.tip-bot2@tip-bot2> References: <20220120162520.570782-2-valentin.schneider@arm.com> <164614827941.16921.4995078681021904041.tip-bot2@tip-bot2> Date: Fri, 04 Mar 2022 16:13:04 +0000 Message-ID: <87fsnx4rxr.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 01/03/22 15:24, tip-bot2 for Valentin Schneider wrote: > The following commit has been merged into the sched/core branch of tip: > > Commit-ID: fa2c3254d7cfff5f7a916ab928a562d1165f17bb > Gitweb: https://git.kernel.org/tip/fa2c3254d7cfff5f7a916ab928a562d1165f17bb > Author: Valentin Schneider > AuthorDate: Thu, 20 Jan 2022 16:25:19 > Committer: Peter Zijlstra > CommitterDate: Tue, 01 Mar 2022 16:18:39 +01:00 > > sched/tracing: Don't re-read p->state when emitting sched_switch event > > As of commit > > c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu") > > the following sequence becomes possible: > > p->__state = TASK_INTERRUPTIBLE; > __schedule() > deactivate_task(p); > ttwu() > READ !p->on_rq > p->__state=TASK_WAKING > trace_sched_switch() > __trace_sched_switch_state() > task_state_index() > return 0; > > TASK_WAKING isn't in TASK_REPORT, so the task appears as TASK_RUNNING in > the trace event. > > Prevent this by pushing the value read from __schedule() down the trace > event. > > Reported-by: Abhijeet Dharmapurikar > Signed-off-by: Valentin Schneider > Signed-off-by: Peter Zijlstra (Intel) > Reviewed-by: Steven Rostedt (Google) > Link: https://lore.kernel.org/r/20220120162520.570782-2-valentin.schneider@arm.com So I wasn't sure if that would be considered a "bug", but folks are asking for this to be backported; do we want to slap Fixes: c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu") to it?