Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp510464pxa; Thu, 27 Aug 2020 08:15:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGgLD96I8b8zqZuYo6PSYQ/4S71yUI0O+F88Z4W/zXXCM4V4i/tT/D7/ZoFuIvc/hg5mh3 X-Received: by 2002:a17:906:680a:: with SMTP id k10mr21043882ejr.82.1598541337808; Thu, 27 Aug 2020 08:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598541337; cv=none; d=google.com; s=arc-20160816; b=X1UFwAM9E9gEwvmVnOASgAQpJe61GM58ZR/vALWHcLRInRiZUtwP3riTunWSfk58Nx jIXBoEGZ54BDD5WbaMTaye2O7UdPKn05cgHB+pGbo8fnoXUc6PpE/0mIafpjYJzA1Rbx QVSWbX7kRqm/T9LzqZsxmQIjermN0ELd/hn6LUCBKvmHjSmP8P5ljEKlV53P9i/pORDR EfHL7LZCSaGbuu3NrEMe2PmPc3wJxXm9Y/FlEF3udKO1g/db+LbVQlSx2AUJ1RwuqoU+ le6RLZZ118Uig2KIzg2WjHtksjHhqcN4nIPTCcpQLsxUCUwKEjztneOMGEDmbDzesK0S QGCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=P3QgBTKNJG7+QYcS6GyKNhaEyuGeMTlXl34dj2J4AA8=; b=Y1y5I1q0XzACTPTj8jG/9kPvxXhhzgFrNCEnOlivuiEg9aO45KleA9IuZgYJFKcrIE UbSMbs97UJevTt5HJ2Ru4YCk4ID1orkA6lEb1ifrkv0OvMXc1nfrpwdLF3NiZ0fkwZ6h 7xdan4pET1x4eGS5ysOGShWS0me97LWppShVbH2fgEe/QeMhYxycPMuP9+lC6mC3Lh5S 73AXzwAIpbm+lJ+/uyk4UR3qvPCpvVO4uIIhbj3TCfdfbfJyFT/XiIO3SZ7T4IZVyIME Ep/XspP8iznjzafoPc0yFpAOBVaNUp7QE1q6jVq2UR0vCnnTniEM8zibyHa0g2+VEwKO 5nHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=h2EAl4WW; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si1566022ejb.647.2020.08.27.08.15.15; Thu, 27 Aug 2020 08:15:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=h2EAl4WW; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727813AbgH0PMk (ORCPT + 99 others); Thu, 27 Aug 2020 11:12:40 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38180 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728488AbgH0Lkm (ORCPT ); Thu, 27 Aug 2020 07:40:42 -0400 From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598528428; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P3QgBTKNJG7+QYcS6GyKNhaEyuGeMTlXl34dj2J4AA8=; b=h2EAl4WWWlzMoSZche7GuRz9vDV4hulRL/yNKrX4IYpD8X8bKaQKHsUHunIkzvAjU9lonk o6WLZy7rIs9RhgGOsghb3rUpQk4jSHzgZWURGmz3Csco6f/P7nvwdMSJE/ogehPuv+5rC7 warMfIhWqlwkPQuoKJN2g+i+LDNUXxHF4vDIEEwUkCZ6vY36YFqkU3OQ44W+Ft7oApzcdd UCh57zoldFiIuGgUhp/DtTy/eGhMVyC9SWsR9hcgUTR2LurvkXlypKZ8PlFVt1NhpzBo0M nsAHACuUp5v4fQthtOG+qvGHHkcMsplP2myZR8Jtld0F79OeFhSkNB0HVv9AuA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598528428; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P3QgBTKNJG7+QYcS6GyKNhaEyuGeMTlXl34dj2J4AA8=; b=6UalHnpY+QLmQ3ZrEX0SSn+b542K0ImKxbbTgSoRRMlmZaa24Ywvi0Ck2PE3mvPJKMIN61 Tqc9c0VMwRjavPAQ== To: Peter Zijlstra , Ingo Molnar , Will Deacon Cc: Thomas Gleixner , "Sebastian A. Siewior" , LKML , "Ahmed S. Darwish" Subject: [PATCH v1 1/8] time/sched_clock: Use raw_read_seqcount_latch() during suspend Date: Thu, 27 Aug 2020 13:40:37 +0200 Message-Id: <20200827114044.11173-2-a.darwish@linutronix.de> In-Reply-To: <20200827114044.11173-1-a.darwish@linutronix.de> References: <20200519214547.352050-1-a.darwish@linutronix.de> <20200827114044.11173-1-a.darwish@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 has one read memory barrier less than the currently used raw_read_seqcount() API. Use raw_read_seqcount_latch() for the suspend path. Commit aadd6e5caaac ("time/sched_clock: Use raw_read_seqcount_latch()") missed changing that instance of raw_read_seqcount(). 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 --- 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 1c03eec6ca9b..8c6b5febd7a0 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -258,7 +258,7 @@ void __init generic_sched_clock_init(void) */ static u64 notrace suspended_sched_clock_read(void) { - unsigned int seq = raw_read_seqcount(&cd.seq); + unsigned int seq = raw_read_seqcount_latch(&cd.seq); return cd.read_data[seq & 1].epoch_cyc; } -- 2.28.0