Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp340487rwe; Thu, 25 Aug 2022 00:57:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR6wP08ZuToS6DvAeGWGfM4UavWtdwJrBA7czSvqsEhpyDYyQ7AZYcBDRMvXbtbTF2PtVoxk X-Received: by 2002:a05:6a00:1907:b0:534:f847:b495 with SMTP id y7-20020a056a00190700b00534f847b495mr2930997pfi.47.1661414265453; Thu, 25 Aug 2022 00:57:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661414265; cv=none; d=google.com; s=arc-20160816; b=DKz0jfdR+birEGoUwUfLNAnXgPMpD9HwSjNAV72gSBOb5UoQAp07fH96xr+d63O2D2 XfToM8fWVO1oMMjygJFY/jx04L0t4FROBzch8XuE+asm3mT1t92xRd8nAySKJ6b4vYF8 irSXieTyHoOnmZmN6oH1T9ohhAW5Vxc1w4MZtxv4f9x1EJ2S/gK1s3UQ0bp1K9ZpSL/M isLPANP+G/NjUMfUqDHGudR8oxGCnlI1M55Ok1U19uN1y2ABgtVwG8mKTFUbuKSzb/JW Iw+qQ4SvxNo921+C1LLnpZWe5I238YE6x+NbzaTQWhNXLdt5/euBkAZi4PFuetmIpKNh 9YBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=d3sEoQ7ZNeWAZpLdz4Sd8YsT3x29uWDv8pFSzhzXLcA=; b=Hm6rjXL3Mu8kNFwvO1bANJBn4eXGGulRFhV4D1GK2fQ0gnZVljiKDJ8McMfhIFMKIv tMo1x9gHxLZwL3ED6eys26RinEnjzqkD2nAakV/XJzmdYbjbqEmVO3w9iUOPy8EBmm/8 uamVa4M8IVoamtJWPdRjrtiktWBUIIprs5KKpt8c/FotOgEZ8yRJBNMYGb+iqGP2g+cS V9C7Og8h6ZlxZAkcbmJ9ifd0UDhj7iEoj+zMyWNd3nnW72QO65gwkvxqRDFn2uyycTo9 xJWsT8phmUltFIbc/aJgU9JGKVtUpo32k1K6oHkSn8zK8mkvtvEoxI/gQkXNYugzLRYT BJJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KK82O9BR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 25-20020a631759000000b00429e0a469c9si20073049pgx.378.2022.08.25.00.57.34; Thu, 25 Aug 2022 00:57:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KK82O9BR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237442AbiHYHWC (ORCPT + 99 others); Thu, 25 Aug 2022 03:22:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233608AbiHYHWB (ORCPT ); Thu, 25 Aug 2022 03:22:01 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B48C998D14; Thu, 25 Aug 2022 00:22:00 -0700 (PDT) Received: from [192.168.10.7] (unknown [39.53.61.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id C54196601E99; Thu, 25 Aug 2022 08:21:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1661412119; bh=1FJOnrm6c8hesYXgPMcGpfrEmMkWbLuf31u0r6LEn7M=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=KK82O9BRLherxYbIleAZI3kE+Iy99/KI05X6sPWP43obywSQ1feSwoJfe1LVjJr15 j+YZs6idJH9bPD+qiNgHootvFWxLC2uUfWebh80rXxpHp85IBxuzHYSW8Dw/dnzIPg Q6JiYdEV0Io9ktDNiDZIRjlh3aSzpw5sK3cOf0VIVvsklnjBjjQXwSHzz0OOBniA5B HSnMmyzQL3lJ0wyULyBRNJzJBQBI6gY0JqCX7v0fH+PQg8tqegJlwB77TpCoSMQ3lz cKbrpVX7NeOayudVA47fH7PguEbK9um6eaAC98pJp932XDw68ABMYTNEuMxhUSe+rR eKf5NThHo5rcg== Message-ID: <971109b3-3f80-c00a-1df6-12a8a3218700@collabora.com> Date: Thu, 25 Aug 2022 12:21:52 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Cc: usama.anjum@collabora.com, Steven Noonan , kernel@collabora.com Subject: Re: [PATCH 1/3] x86/tsc: implement tsc=directsync for systems without IA32_TSC_ADJUST Content-Language: en-US To: Thomas Gleixner , Jonathan Corbet , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "open list:DOCUMENTATION" , open list References: <20220808113954.345579-1-usama.anjum@collabora.com> <87v8qhybk8.ffs@tglx> From: Muhammad Usama Anjum In-Reply-To: <87v8qhybk8.ffs@tglx> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 8/24/22 7:13 PM, Thomas Gleixner wrote: > On Mon, Aug 08 2022 at 16:39, Muhammad Usama Anjum wrote: >> From: Steven Noonan >> >> AMD processors don't implement any mechanism like Intel's >> IA32_TSC_ADJUST MSR to sync the TSC. Instead of just relying on the >> BIOS, TSC can be synced by calculating the difference and directly >> writing it to the TSC MSR. > > Why? This has been tried before and is known to be flaky and > unrealiable. I'm sorry. I was trying to find the historic attempts about this. But I didn't find it. Can someone point me to the history? Do we have some information on how AMD synchronizes the TSC in BIOS? If the ADJUST MSR like Intel's isn't present in AMD, they must be syncing it by directly writing to the TSC MSR like this patch is doing. > >> Add directsync flag to turn on the TSC sync when IA32_TSC_MSR isn't >> available. Attempt 1000 times or for 30 seconds before giving up. > > Looping 30 seconds with interrupts disabled? Seriously? Yeah, that's too much. Some BSD variant uses 1000 attempts. We can change the 1000 attempts to 5 or 10 attempts as in my experience, 5 attempts at max were always successful every time. > > Thanks, > > tglx -- Muhammad Usama Anjum