Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp243102ybh; Wed, 15 Jul 2020 00:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVNjs/ysuDQd9IRuRVzyYOHKodd0wk2/eqjh0cfP1SgK4tl3fp+p3FVdOP9beLyGBA/XRC X-Received: by 2002:a17:907:376:: with SMTP id rs22mr8423198ejb.47.1594797794196; Wed, 15 Jul 2020 00:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594797794; cv=none; d=google.com; s=arc-20160816; b=T3Qx+oSVClSqAWBwWlWem93e7jgZ/tJwZTS65ryDYyS7bai+o1RNQO9L2zCE/5SKRa P52X7vxosGwPwj36PgV9UW5Vb2cwJO0xNL5EAud3cfNCkONss7IUDXwbjxLNiDXVUncj Nw/uAuBz1c6oXPdp2AzRXKJeAeycMhu0zy8bRvHjAiHUUOEPfZGVACDyJ7bM14H5rEvZ VB7ORiyG4Hi4sXzFsY/z7Bv/wNVLqmDwXO8a7T4GqLpYwFz1N5UB1y/KC0MmmYEzShKE 5cIW6w//auxU1LCa45G+n71T03Uj+KC7lDXyxTUWKdix8o5pI5Oi3F2OcTEPTEnMhs3S E3vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from :dkim-signature:dkim-signature:date; bh=LQKcsIDOp9awa5wYn/MiS0JSdtaDZAuKW8Y1r7Tzr58=; b=tcyeAlHNkXJo2TUVSUPgPqTXRFK2VufTvX4+2SgKMQNKxfzy/PJTEltJ8pLNHfdDM1 UP+jtvyqU95DDz34t1OgtuZOtEaa3OR/6QaBZ1/10q4pvpCT3XKm8O6Owq1uUVppNEkB QXB3zKXX7FnuOlmK2VubTXQtVenxMcG3f4KTaFhlJcqxg18jZ36VE87AplUEKh9w/OMd 7aV3CKTae6FaAuElT80DVICDZCY96Trq6D11Ak1S7lkJBljRsRvan0dJJGSySCpkN9hg 2LUfGF6OerhGFvNPCF9qUvLE4j9pOzdiKg28x0VYBuXLWnIYPy5K+x3WfSEuaLkAWAXM VGeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EMD4enJk; 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 n24si670138ejx.544.2020.07.15.00.22.49; Wed, 15 Jul 2020 00:23:14 -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=EMD4enJk; 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 S1729259AbgGOHVR (ORCPT + 99 others); Wed, 15 Jul 2020 03:21:17 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:49226 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729066AbgGOHVQ (ORCPT ); Wed, 15 Jul 2020 03:21:16 -0400 Date: Wed, 15 Jul 2020 09:21:12 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1594797674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LQKcsIDOp9awa5wYn/MiS0JSdtaDZAuKW8Y1r7Tzr58=; b=EMD4enJkqUiQpN/+EBNUOaxkp0MoHUOrBxYA0mA4w9LWfPjvCoYpqcHWBE/kg36etyHmfg 4pnUSyAfdwCs/LZN+Eu0lNJPKJbh4w7/hZKc/A+aHX9SCsGZr/oLWOl5l2twiTqcMW+rGX 7Do2G2sAsLjfX7wJ8fob5RL5X+jzdXKi4hkEIhUeTuAZCQrnPaI7GGv0PuYFcigUsn1G/j gQ2oLQuRbMhKH5rKa5KW7a6qnUFjzj2GFgcypCvCR5wg8jeI05KmZJ/HtjFhO29TGXpyC+ SfqbM/6BS99tlLwNIuy/w4GTXJTKRZbvGfe5IP0z+jzj4BUDtCo+gJHTW0jebQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1594797674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LQKcsIDOp9awa5wYn/MiS0JSdtaDZAuKW8Y1r7Tzr58=; b=EOP6n3WooIDvd/2I0f/ZqKRcpxwz12l7P0dSD1vrkYd4039Yq0sz2gktohTSTQiE3slkaW 8CVrVCHbJH4HTZBw== From: "Ahmed S. Darwish" To: Leo Yan Cc: Peter Zijlstra , Will Deacon , Mark Rutland , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Catalin Marinas , Thomas Gleixner , Paul Cercueil , "Ben Dooks (Codethink)" , Adrian Hunter , Kan Liang , jogness@linutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/6] sched_clock: Expose struct clock_read_data Message-ID: <20200715072112.GA231369@debian-buster-darwi.lab.linutronix.de> References: <20200715020512.20991-1-leo.yan@linaro.org> <20200715020512.20991-2-leo.yan@linaro.org> <20200715055650.GB225020@debian-buster-darwi.lab.linutronix.de> <20200715065407.GB19269@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200715065407.GB19269@leoy-ThinkPad-X240s> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 02:54:07PM +0800, Leo Yan wrote: > On Wed, Jul 15, 2020 at 07:56:50AM +0200, Ahmed S. Darwish wrote: > > On Wed, Jul 15, 2020 at 10:05:07AM +0800, Leo Yan wrote: > > > From: Peter Zijlstra > > > > > ... > > > > > > Provide struct clock_read_data and two (seqcount) helpers so that > > > architectures (arm64 in specific) can expose the numbers to userspace. > > > > > ... > > > > > > +struct clock_read_data *sched_clock_read_begin(unsigned int *seq) > > > +{ > > > + *seq = raw_read_seqcount(&cd.seq); > > > + return cd.read_data + (*seq & 1); > > > +} > > > + > > ... > > > > Hmm, this seqcount_t is actually a latch seqcount. I know the original > > code also used raw_read_seqcount(), but while at it, let's use the > > proper read API for seqcount_t latchers: raw_read_seqcount_latch(). > > Good point. To be honest, I think myself cannot give a good judgement > for memory barrier related thing :) > > I read a bit the document for the latch technique [1], comparing to > raw_read_seqcount_latch(), the function raw_read_seqcount() contains > smp_rmb(), IIUC, the *read* memory barrier is used to support for > kcsan. > The smp_rmb() has no relation whatsoever to KCSAN. It pairs with the write memory barriers in the seqcount_t write path. AFAIK, PeterZ is the author of this patch, so let's wait for his input here. Thanks, -- Ahmed S. Darwish Linutronix GmbH