From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACAE113AD05 for ; Mon, 26 Jan 2026 02:25:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769394347; cv=none; b=Hf3zBQJZDM7O1/vBBt16Z2ZuxjM8pRyOqZ1dkY88O5B+g56+E1SzpVid7WSykoPVP5rRPk/GPc/1XaVVyop/upHWZrtKpzpchuvg6qHQEt1XEPxON30N5X4BLZ7BiEGeoV4g2pTp1u6hzb6JShyrX560kxw4QP0dMtXZt5A8R60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769394347; c=relaxed/simple; bh=AtNKq5CXm+ahmCvrC3kx/Culg39QxI53f4qv2oyZz0U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TK9bZg2enS+X0fIPHBvE1UbvIsVGrs3vnpiUcp/BTq7Ypml54me4HqLMuz4gqybw/jnqUileiA63RQHuv5oo/fZNKQSe4KqZu3jfT+H7YWHs71T1pZcCODytjBPHbVbjNbwtdYEmI4P+ckbLju+oljgyEXUow7dV3Qr7KvSZEu0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QSa09Hee; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QSa09Hee" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1769394345; x=1800930345; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=AtNKq5CXm+ahmCvrC3kx/Culg39QxI53f4qv2oyZz0U=; b=QSa09HeeElFYe7GDMLGWTO9vgGHmMMKAD5eazxjsAjKNFcIY3I8ncDNF kVwGPbqIHNunl9z/aQukUv9OXBDMFW4hA1vk+Xxztc4kaEloaItPaAypP 5e4wBau+UsHoCtd0PtzAK98KM0S4DlLDn2c99ekLBH56wUpWlgaStgLCf NyOZZW1VUVqMN2liCXEPudtkMAofWKYevrBrD9U0sh4UXxb5VcodCfS3x c2U6QSBFOyj8zEHmps5Ih+cUtT1fcX2//D5yajZtiFRMhpBI9Pc5Tp+jq POn5Q9M8xztOqd9dz6k/PeQldPUiM9JnIGJcqIRn08IiZFBvjvShg+zg1 A==; X-CSE-ConnectionGUID: YgRg/QbERbiqvLsOtjzj1Q== X-CSE-MsgGUID: IiZEqbOEQ7qb7ZEn/PfeJA== X-IronPort-AV: E=McAfee;i="6800,10657,11682"; a="70668331" X-IronPort-AV: E=Sophos;i="6.21,254,1763452800"; d="scan'208";a="70668331" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2026 18:25:45 -0800 X-CSE-ConnectionGUID: sbYODZs2TvS9X+F9M4KShw== X-CSE-MsgGUID: /VTD/cSRS5SdVd/wvyMDDw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,254,1763452800"; d="scan'208";a="207820352" Received: from unknown (HELO [10.238.1.186]) ([10.238.1.186]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2026 18:25:41 -0800 Message-ID: <381fd674-d533-4470-88cd-b989256b44c0@intel.com> Date: Mon, 26 Jan 2026 10:25:29 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] sched/clock: Avoid false sharing for sched_clock_irqtime To: K Prateek Nayak , Vincent Guittot Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , linux-kernel@vger.kernel.org, Shrikanth Hegde , Benjamin Lei , Tim Chen , Tianyou Li References: <20260116023945.1849329-1-wangyang.guo@intel.com> <95f2091c-273e-4e36-b543-735748efd5fc@amd.com> <648b2b54-7432-4578-b785-030d98f6e31c@amd.com> <653ac450-2f00-4eb0-bb97-e40576435462@amd.com> <0b625352-f0e0-49c6-83a2-a69250c6caeb@amd.com> <802dccf4-4357-40b1-89a9-94962b6f7dbf@amd.com> Content-Language: en-US From: "Guo, Wangyang" In-Reply-To: <802dccf4-4357-40b1-89a9-94962b6f7dbf@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/24/2026 12:48 AM, K Prateek Nayak wrote: > Hello Vincent, > > On 1/23/2026 9:28 PM, Vincent Guittot wrote: >>> If TSC / any potentially unstable clock is marked unstable before >>> sched_clock_init_late(), we never flip __sched_clock_stable. >>> >>> On x86 side, since we already start using TSC for native_sched_clock() >>> super early, we have defensive measures (and a __use_tsc static key on >>> the x86 side too) to switch the sched clock back to jiffies if we >>> realise TSC was unstable before we hit sched_clock_init_late(). >>> >>> This is necessary since post the sched_clock_init(), >>> "sched_clock_running" is true and the local clocks will always uses >>> sched_clock_noinstr() and it must be switch to jiffies on the x86 side >>> since arch defines it. >> >> sched_clock_init_late() is always called so can't we check if >> irqtime_enabled and clock is unstable then we disable irqtime >> accounting > > That can be done, yes. > > Wangyang, can you also consolidate the irqtime disable bits (TSC and > generic) to trigger at sched_clock_init_late() if the clock was found > unstable and in __sched_clock_work()? > > Both context can directly do a static_branch_disable() without > needing an extra delayed work. Thanks for the advise, v4 sent out, please help to review: https://lore.kernel.org/all/20260126021401.1490163-1-wangyang.guo@intel.com/ BR Wangyang