Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1172547ybg; Wed, 29 Jul 2020 07:36:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzW+5deUyo0amrMF7pQjW6JhecncxB1nBtu+OsiFKjRijFQH/F0MMiZ8lvR+N/El9nc5GS X-Received: by 2002:a17:907:205c:: with SMTP id pg28mr28899356ejb.22.1596033405666; Wed, 29 Jul 2020 07:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596033405; cv=none; d=google.com; s=arc-20160816; b=QaUGRgqEVMGGTnKjWZpIWNEcr1Is1dN3UVe8XKEf2gFcBnEbey/EEnTuxMCp79DTX+ Riz6qHhabH0R1n8yfnEoxawGLN6uA+mqnhQ2NI+XvZBs/2C29eP4MKNfbPJ2tcfn76/S dOwv6bM61JgFTwbgC1f2PnLNkBKJiDQjccwOB5sn3DIb5/cj5nerWY89068sDA3Bnney LyMGqNJ4fiFDuuHmtI8aiLOh/PXJDhXcdcrj+fb8bi1eEpbP5PDcE4GxBq/iNoIIU+mX Zsxy9DSER6/qmqKV8/luyZkMRSQEvKGS20SBs57sDsDjIyN8ixICgnwMbaS3IBmbU0zo dlew== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=4MHMRc9J3xW26AE/zZ9xnPxPhKLboMX+mZi+E25DpdE=; b=pVDRoLyB2eGRhJyhMGVv/CHlXj1+e8CA5sSDTlkExDf99C+qyZAYFDh2v7dsk79ZM9 aIFYsOP7hqEZSttrTlOoUST8GMKwEn+YxKbHcbFsbNSpUSFhoXeI2lvzjPSBfJkYhqxs EiOCOJuL2OK0z7+yL9OoQPym6EzTRbsZJQLkGDhAtTPSPEr9CrmsPZrC0AWIRt6Ek9HA X2rCFjGiOKyFtekmEoCUOEV3FIRlZeiR81Oq3QLO17VNALv676wM19JzNzpOKGYW1886 BxZZIT7rt9RfjluP25U3NM/MBsJ7msCs2sfcLbSGfq34LTckneXxeTOujUBdS3wGgarw vPvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=OAbyTnFc; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=pAmBXemI; 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=fail (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 ci27si1307371ejc.129.2020.07.29.07.36.23; Wed, 29 Jul 2020 07:36:45 -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=fail header.i=@linutronix.de header.s=2020 header.b=OAbyTnFc; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=pAmBXemI; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728036AbgG2OfB (ORCPT + 99 others); Wed, 29 Jul 2020 10:35:01 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:42966 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgG2Odd (ORCPT ); Wed, 29 Jul 2020 10:33:33 -0400 Date: Wed, 29 Jul 2020 14:33:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596033210; 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=4MHMRc9J3xW26AE/zZ9xnPxPhKLboMX+mZi+E25DpdE=; b=OAbyTnFcabA0nU2pjYta+cGV7X1T9bTOerKUGg9nFLz0TTCTE41hGwwyS5lzaLPw/0Uwjl 1La3/LCqgMquj+fnLUT3OQygrYNT1aMF/EomnFh8wFsgVSzA3Bs3bZvGzJG1VjVlEhPPQ5 /KrymTvJ31LB3kZDonyMOUKwAdekYABwv4JcAVweGHgvSFWtItdJ0SOv7Spie0Oq4PZGAD jmaJhTdMJxl8wCKrOhhndCbBwtR5IG/shADnnT6IMtWJVRwhY2vl/EnnFREOxATZ+TknVv +PEEH9ow/0X9yf7keOpooTHIJUAnPPiXqGpL7SvME4chKIkfTiB7eRofawJL9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596033210; 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=4MHMRc9J3xW26AE/zZ9xnPxPhKLboMX+mZi+E25DpdE=; b=pAmBXemI180jeWDe+YdexoQigl1dqKgF2IjAt3wuT8zjqFK7RdoS0v3mTD/3q0m17TVNT5 dCLybZnzWvjbn/Cg== From: "tip-bot2 for Ahmed S. Darwish" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] iocost: Use sequence counter with associated spinlock Cc: "Ahmed S. Darwish" , "Peter Zijlstra (Intel)" , Daniel Wagner , x86 , LKML In-Reply-To: <20200720155530.1173732-21-a.darwish@linutronix.de> References: <20200720155530.1173732-21-a.darwish@linutronix.de> MIME-Version: 1.0 Message-ID: <159603320985.4006.12938811827876475485.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: 67b7b641ca69cafb467f7560316b09b8ff0fa5c9 Gitweb: https://git.kernel.org/tip/67b7b641ca69cafb467f7560316b09b8ff0fa5c9 Author: Ahmed S. Darwish AuthorDate: Mon, 20 Jul 2020 17:55:26 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 29 Jul 2020 16:14:28 +02:00 iocost: Use sequence counter with associated spinlock A sequence counter write side critical section must be protected by some form of locking to serialize writers. A plain seqcount_t does not contain the information of which lock must be held when entering a write side critical section. Use the new seqcount_spinlock_t data type, which allows to associate a spinlock with the sequence counter. This enables lockdep to verify that the spinlock used for writer serialization is held when the write side critical section is entered. If lockdep is disabled this lock association is compiled out and has neither storage size nor runtime overhead. Signed-off-by: Ahmed S. Darwish Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Daniel Wagner Link: https://lkml.kernel.org/r/20200720155530.1173732-21-a.darwish@linutronix.de --- block/blk-iocost.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 8ac4aad..8e940c2 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -406,7 +406,7 @@ struct ioc { enum ioc_running running; atomic64_t vtime_rate; - seqcount_t period_seqcount; + seqcount_spinlock_t period_seqcount; u32 period_at; /* wallclock starttime */ u64 period_at_vtime; /* vtime starttime */ @@ -873,7 +873,6 @@ static void ioc_now(struct ioc *ioc, struct ioc_now *now) static void ioc_start_period(struct ioc *ioc, struct ioc_now *now) { - lockdep_assert_held(&ioc->lock); WARN_ON_ONCE(ioc->running != IOC_RUNNING); write_seqcount_begin(&ioc->period_seqcount); @@ -2001,7 +2000,7 @@ static int blk_iocost_init(struct request_queue *q) ioc->running = IOC_IDLE; atomic64_set(&ioc->vtime_rate, VTIME_PER_USEC); - seqcount_init(&ioc->period_seqcount); + seqcount_spinlock_init(&ioc->period_seqcount, &ioc->lock); ioc->period_at = ktime_to_us(ktime_get()); atomic64_set(&ioc->cur_period, 0); atomic_set(&ioc->hweight_gen, 0);