From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4FA6C433E0 for ; Thu, 16 Jul 2020 05:13:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9172E207BC for ; Thu, 16 Jul 2020 05:13:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CzsOLMZT"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hc4i2Nr6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9172E207BC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KbkVdPpgBlGMYveqfIvafSHjnS/qhhBhuAeMSl0g8iI=; b=CzsOLMZTeJeeaC5pG1Y2fu6u9f vpmn6qijq9UfJZ98/pChI34MbUw+0ouPqMPgBdwfAR+UhYxnDWjn3NhO4Dfntxm1kEZ/6OMYibDGG Z1HAkn4wLJdRdU2qMDkWWAuYpet+OeghxSpL7C2+L56HSSrWZwftBHldODvd5x11m6HEo+/LB/XUZ nJAk9pznspBWvW3bOOfrrjzkgmPxuu+AGnyDM0/rpbJMzZubPoADrXOcrrlF7jwI0VKvThr9Zz5+J ZJDScfnqi/J5T96ogBoJwIR3fFL4tglr33BAwcBewZHYZa+QW7z97Zf6sIgmqyvePOdTwi9OQKbsR +XZp2UKA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvwBp-0005VW-DR; Thu, 16 Jul 2020 05:12:13 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvwBm-0005UM-7s for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 05:12:11 +0000 Received: by mail-pg1-x543.google.com with SMTP id g67so4251314pgc.8 for ; Wed, 15 Jul 2020 22:12:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o/BsIfvqtTzak5Mv7ZiI0+KdUGs6co1ng50/6qYskQE=; b=hc4i2Nr6oqKqPE2jXwZbSn/Rbqv8nFoXy79RI3Lk97cBQGfRExofkvamCUf5Oo9J3N yCVbSC24M4e2k7egLH4YemLumM88fh51oKP7zE1T2CXUyJgLVTt7zf5bS1cYwcC4edI3 OGbsrEH/Xs2i9s0VV4IZDrB9e8OdDk9HfV1N3c3VbJtQ2oyhg4/xn6JqKVC4r34xpeXU RQAJxud14c57X1UIFFQunjHv7cruYPst8np7S+LsS/NvbvI6kHk4MzxV8aLmCTglWn/n B7FEK/9bbc3vgOnpC4QiAUgC6nxpnuYTSjJN+xkPXFlz5XLXb4WqqjEFKbm7lrl/n4xh 5IPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o/BsIfvqtTzak5Mv7ZiI0+KdUGs6co1ng50/6qYskQE=; b=XF43FFQrYbjDGE+4+5HqgcyH1mfVIcpUW8/IaWD1h6Aso3ZREvrb8/Is+N0k+sIYS9 MrAJSkE/n+N4lAIpKhVdjdhtO2ilBIPShUDRexORcmdwir8L5ejyEYX0wUP2nQ9GhY+y W/eTQ2U+oIuUN3wCe2l66jIlMPVUN2ac9N2BONP6XYOUi73x4pFPeFoqkz0woWp8P8OV g40U89U09ftUY8FzLY9aoTAdbsjomZmM86NSb/WLsyKqyqiUaytji2I3L4Fo8xxuA/5J LolA3h5AoDZ1YB2JnRIs4/Ej2sHydb12Gc4dgzbUpms4iWz1S0CDfP/hoBiOt6wA9sA+ wlfw== X-Gm-Message-State: AOAM530VQooNFevsKjjGz/n1+HEU68nR5+yFKj4X2FjxKF1SxQD5i4KY X4C38MMLAM669lR8AnEmsyCcXQ== X-Google-Smtp-Source: ABdhPJwB25v0txIQiG1pHuN6YTqIfWIpOVf/k+duttLSriG0rbXE+fdtIvbK4/pYXJVfwXjm2oYlcA== X-Received: by 2002:a62:a217:: with SMTP id m23mr2175657pff.291.1594876328190; Wed, 15 Jul 2020 22:12:08 -0700 (PDT) Received: from localhost ([2400:8904::f03c:91ff:fe8a:bbe4]) by smtp.gmail.com with ESMTPSA id a26sm3499222pgm.20.2020.07.15.22.12.07 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Jul 2020 22:12:07 -0700 (PDT) From: Leo Yan To: Peter Zijlstra , Will Deacon , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Catalin Marinas , Thomas Gleixner , "Ahmed S. Darwish" , "Ben Dooks (Codethink)" , Paul Cercueil , Adrian Hunter , Kan Liang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/7] time/sched_clock: Use raw_read_seqcount_latch() Date: Thu, 16 Jul 2020 13:11:25 +0800 Message-Id: <20200716051130.4359-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200716051130.4359-1-leo.yan@linaro.org> References: <20200716051130.4359-1-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_011210_294198_751ED907 X-CRM114-Status: GOOD ( 14.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Yan MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: "Ahmed S. Darwish" sched_clock uses seqcount_t latching to switch between two storage places protected by the sequence counter. This allows it to have interruptible, NMI-safe, seqcount_t write side critical sections. Since 7fc26327b756 ("seqlock: Introduce raw_read_seqcount_latch()"), raw_read_seqcount_latch() became the standardized way for seqcount_t latch read paths. Due to the dependent load, it also has one read memory barrier less than the currently used raw_read_seqcount() API. Use raw_read_seqcount_latch() for the seqcount_t latch read path. Link: https://lkml.kernel.org/r/20200625085745.GD117543@hirez.programming.kicks-ass.net Link: https://lkml.kernel.org/r/20200715092345.GA231464@debian-buster-darwi.lab.linutronix.de References: 1809bfa44e10 ("timers, sched/clock: Avoid deadlock during read from NMI") Signed-off-by: Ahmed S. Darwish Signed-off-by: Leo Yan --- kernel/time/sched_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 0acaadc3156c..0deaf4b79fb4 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -70,7 +70,7 @@ static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift) struct clock_read_data *sched_clock_read_begin(unsigned int *seq) { - *seq = raw_read_seqcount(&cd.seq); + *seq = raw_read_seqcount_latch(&cd.seq); return cd.read_data + (*seq & 1); } -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel