From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 0E72F330300 for ; Thu, 4 Dec 2025 21:16:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764883001; cv=none; b=t1SjWeUyaV8E8NTKzAmjoGfPTClYFrl9r9o0rcpQRyztkUtPrMe3j6Z3bKDZV48Ekng6TFG69sd+VgRv8+3puNtr5n56smnM9+XS6HACuwgsjYYWncB0kXrgF/vSjfOjk5FpmoAvHfbZ9qKyixAASQECTkCbfsnqnkNDIbNf1yI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764883001; c=relaxed/simple; bh=EIk0ViVJBTxzMSenD+/+2gZc87UELzY9RsIkW1tU8Do=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IvXXgeeoyxN6ZGUqTobVGOxoRMQZh+CBs+pDfVHevcKSnGav30WW/pbWSYMavVKwX+KWdpTBux9E0waSxDYY9jdjepOz7ou5yJGjZ2D5La69/HL+r4KtS33GNX6fgCGcmwWMSKqdZr3jlRB1kZcryToxgTGwwD46Yxar1LeJkss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ga8+Ablh; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ga8+Ablh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1764883000; x=1796419000; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=EIk0ViVJBTxzMSenD+/+2gZc87UELzY9RsIkW1tU8Do=; b=ga8+AblhcXsvmRUp91BDNbWXsvdag5xPCqdF9nFNhl7K0cEqvEmTwj+a Jm1yuneiEVu4k4NduYPfaBHWU6oU8Efu1gqcEonWCyC+KjbP5y56lk1x4 baaTjXVK7H+9VKgXiX5IJEUVQo0Amr3dPhlSXJYYF1dXrTYymIq30xPew /sZLQ/7R9Sd0u4V/Udt5f57qUk3n0jsyxTnpDdD+lBDkeGtP4B2lrqFB5 wtea+U4B6SPv2IZldvqCHHOX7nZBWU5C8ydh2db2AJytgbVlFTIxjrbRh xM5MupgYRZjJVBS4qb9AIZnMrBAeWdrvf1qnSM3zMK3YWqNxUeHwnj/i9 w==; X-CSE-ConnectionGUID: FqlJLIzxRVuSF0TU6onzgg== X-CSE-MsgGUID: BqnpHTFxR9Gft8QXCUZeaQ== X-IronPort-AV: E=McAfee;i="6800,10657,11632"; a="70765173" X-IronPort-AV: E=Sophos;i="6.20,250,1758610800"; d="scan'208";a="70765173" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2025 13:16:39 -0800 X-CSE-ConnectionGUID: w3Nm/tvoTRO5U2tVwygzBA== X-CSE-MsgGUID: tKpGgS3SSO+s3LzCZUjtUg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,250,1758610800"; d="scan'208";a="199559720" Received: from tassilo.jf.intel.com (HELO tassilo) ([10.54.38.190]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2025 13:16:39 -0800 Date: Thu, 4 Dec 2025 13:16:35 -0800 From: Andi Kleen To: Andrew Cooper Cc: ggherdovich@suse.cz, linux-kernel@vger.kernel.org, peterz@infradead.org, rafael.j.wysocki@intel.com, x86@kernel.org Subject: Re: [PATCH] x86/aperfmperf: Don't disable scheduler APERF/MPERF on bad samples Message-ID: References: <20251204180914.1855553-1-ak@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Dec 04, 2025 at 08:02:09PM +0000, Andrew Cooper wrote: > > However this can happen without any malfunction when there is > > a long enough interruption between the two MSR reads, for > > example due to an unlucky NMI or SMI or other system event > > causing delays. > > The list of problems is even longer under virt.  The vCPU can lose it's > timeslice (-> arbitrary delay), or be scheduled onto a different CPU > between the A and M reads (-> calculate the wrong ratio, and not in a > way you could exclude it as a bad sample). You could avoid that in the hypervisor by saving/restoring the counts (the MSRs are writable), but it's likely rare and harmless enough that it's not worth the performance overhead. -Andi