From patchwork Mon Jun 5 19:16:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 103453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2902561vqr; Mon, 5 Jun 2023 12:18:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5zM1bfFPhQxTpjgo1Ogm6OESkxVNwfIEG5m4x9p8D+4R+POWfARiO91qvNEMFHwzGuitDi X-Received: by 2002:a17:90a:8b92:b0:256:845f:333a with SMTP id z18-20020a17090a8b9200b00256845f333amr8579965pjn.19.1685992699420; Mon, 05 Jun 2023 12:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685992699; cv=none; d=google.com; s=arc-20160816; b=KkCcsC4zKw43wq5s0wgkzjFIb/cbSc4aq+ZfC+bYGPVahkbCdzTy0+z8b93shEbCAC fwQgRaOeb2R2u71w5Iu/oj/OLlNA514Rt7j5OJUkTNULjCGzygPIv9yS7OdB/PunHDRU ddOHF1Sb/HDiw7jfs+/fB3IsilvFzUHUnIZiu5CKBtV9BJ6HdMS1NU8FvDy1zCuprhAz x/+Zyva1OjNNSR4DXO+15s4/DzE1Ja8SGSxzerbK5O9kh2TOdXC5HbFiW9VmEgSkoj6h xn2EZJGweJdHKzukWzrUt19Q37UaHs+QynCptIwY/TnBvDZa9zgCsCx6cI3rnpIG3Fn2 Nihg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=nefLx1ncunt24Z9x1hQOgvZ54e8uI2PhjSAmZ7CKnB4=; b=tmZ0/sJjrBZoMveNVQ3mQcyV5A+M4YjvJ7/fZ0WtDNX7WmnALxtEDOtA7Fc9VF/BUO TncwBJnbIKdjmTFHqsDF3oKp/jQ/nGjyx6KjDKtRxwkxXEhPhwW+/5w+vL1voXPcjfio iBNWZZq5CWAfXCmnn1Cc6vnN+QsFZ5D06THtRmSkSTRMXoCV/KEdAs5tpsGfYDs1gc21 tDJUmVCSC12xV7d3Dm9bkL5Nkq9qGaZLZ2pkMKKD3vlNS+MQCCmxZoODiy4GoSaeG5hv WCChBeEVpaROfms1Pm3Okyo5nz/835HArGxTu0usSpnEGTLPK4a+Xz8lwUkYboxUYayO Oq8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vIjOi4HX; dkim=neutral (no key) header.i=@linutronix.de header.b=84ph86Kn; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s28-20020a63925c000000b005428de93a2asi6033432pgn.142.2023.06.05.12.18.04; Mon, 05 Jun 2023 12:18:19 -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=@linutronix.de header.s=2020 header.b=vIjOi4HX; dkim=neutral (no key) header.i=@linutronix.de header.b=84ph86Kn; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234306AbjFETQu (ORCPT + 99 others); Mon, 5 Jun 2023 15:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235379AbjFETQX (ORCPT ); Mon, 5 Jun 2023 15:16:23 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2712122; Mon, 5 Jun 2023 12:16:20 -0700 (PDT) Date: Mon, 05 Jun 2023 19:16:18 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1685992578; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nefLx1ncunt24Z9x1hQOgvZ54e8uI2PhjSAmZ7CKnB4=; b=vIjOi4HXm2/HBdwlpRTecee/kB5/WB+X3aLLXYxM56/xwQiRZefbkz6WmDcsctafOW+ctN ktGuiKXHEapnQADkzO3m7+jHZ0z2umXZcZ+PNCNdMd7KYr+cn2c8DEiYEaglWD0szt6x/M avLM00LnoRUyO2A0un8YKaeji4cnwTe2gTdQP0SQAZJAVtGYKoAVoGjg+HCODpySPAoo/K HY48R4Mpb8ELLSYFBZzsCJogL+9mCGB/g1QjCDziyQd2UJL0KCG0gFFfUPDzG2QDMIHUG7 PEn4yj93iC/NMpyO98cWwEPlLMoqFJDLmAMkEuA8m/hw6D13bCFf7pOtyY0Y6g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1685992578; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nefLx1ncunt24Z9x1hQOgvZ54e8uI2PhjSAmZ7CKnB4=; b=84ph86KnuremQ5Ymzwz5assjnYvAJ94dII6939vSjOTBgKrwg/O46vFOSBw5HAd8P7R/y9 4H0IhdhJwqX06bDQ== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] loongarch: Provide noinstr sched_clock_read() Cc: "Peter Zijlstra (Intel)" , Michael Kelley , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230519102715.502547082@infradead.org> References: <20230519102715.502547082@infradead.org> MIME-Version: 1.0 Message-ID: <168599257836.404.16765871891993348111.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766318497090953709?= X-GMAIL-MSGID: =?utf-8?q?1767891481110897086?= The following commit has been merged into the sched/core branch of tip: Commit-ID: 6b10fef09f937433563822f4bb6a2f947176e5a0 Gitweb: https://git.kernel.org/tip/6b10fef09f937433563822f4bb6a2f947176e5a0 Author: Peter Zijlstra AuthorDate: Fri, 19 May 2023 12:21:03 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 05 Jun 2023 21:11:05 +02:00 loongarch: Provide noinstr sched_clock_read() With the intent to provide local_clock_noinstr(), a variant of local_clock() that's safe to be called from noinstr code (with the assumption that any such code will already be non-preemptible), prepare for things by providing a noinstr sched_clock_read() function. Specifically, preempt_enable_*() calls out to schedule(), which upsets noinstr validation efforts. Signed-off-by: Peter Zijlstra (Intel) Tested-by: Michael Kelley # Hyper-V Link: https://lore.kernel.org/r/20230519102715.502547082@infradead.org --- arch/loongarch/include/asm/loongarch.h | 2 +- arch/loongarch/kernel/time.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/loongarch/include/asm/loongarch.h b/arch/loongarch/include/asm/loongarch.h index b3323ab..357ef70 100644 --- a/arch/loongarch/include/asm/loongarch.h +++ b/arch/loongarch/include/asm/loongarch.h @@ -1167,7 +1167,7 @@ static __always_inline void iocsr_write64(u64 val, u32 reg) #ifndef __ASSEMBLY__ -static inline u64 drdtime(void) +static __always_inline u64 drdtime(void) { int rID = 0; u64 val = 0; diff --git a/arch/loongarch/kernel/time.c b/arch/loongarch/kernel/time.c index f377e50..c189e03 100644 --- a/arch/loongarch/kernel/time.c +++ b/arch/loongarch/kernel/time.c @@ -190,9 +190,9 @@ static u64 read_const_counter(struct clocksource *clk) return drdtime(); } -static u64 native_sched_clock(void) +static noinstr u64 sched_clock_read(void) { - return read_const_counter(NULL); + return drdtime(); } static struct clocksource clocksource_const = { @@ -211,7 +211,7 @@ int __init constant_clocksource_init(void) res = clocksource_register_hz(&clocksource_const, freq); - sched_clock_register(native_sched_clock, 64, freq); + sched_clock_register(sched_clock_read, 64, freq); pr_info("Constant clock source device register\n");