Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2026952pxa; Mon, 3 Aug 2020 05:45:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaaS9w3v40svKRV3v9b2rbnGER/jz3iRfVVYsbVVvEa5kIfdgPGs/VRbHEiu1QNhvzTu50 X-Received: by 2002:a05:6402:3193:: with SMTP id di19mr15808863edb.224.1596458708715; Mon, 03 Aug 2020 05:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596458708; cv=none; d=google.com; s=arc-20160816; b=ROcuvYLntNrWBIK7xiZuWJz6d22K+uuSSFUqSv0+hPuufan+KzDj5KXRT+wQvoqWGc ikAtkxSo2AgrqCTYM+wYVZ54Ojkrax/knV1uwl3NtQQRB5BGXk/KX1dA+gbpAa2K8HZs rPvz8dfdftO/ZDOmocDrXLKTUn+r8R+BsqmRHi6y6ZW34ZvJLtynhnwODfpmTBi1CwBy k2ho4Dw2FbhfCNJEc1fTYukqFMss+ia764uEDRIjUPAEAzb/ztIr4pjS4Lnx4m1LW2jR t6Hs2M8FoSBvlmOcnhy1SxuZzi+ti18lqT7rIIXokGobLoGzmZr2NWwyN6zR+/4qjr5s BwIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=RvLCSYDSP40IH/A+6SCmYBKw6wGrWKPPZ7D9/KZ9g7k=; b=kZkBxXxgqg8+rFqMG+h8x9gJmKDN/DgqIOUbnlt/ln1sBX3y7mV+GvA05J19+9jCFW 3DwEmmYSGqnKku3kjJrcZJzFSWfmsbzmuKSJYZ/HEPCV9L8P+Ms4GGutTC46VkJK9909 HW/A06Pblt9RLVHEEUHhBgZMxUA5we5u5d+zfTaPUPjws5Y96ouCFMSwce5+BtBjxMkB tF/iWjESdQkk98+Luk75Fvxct6guh25TBGzKupRlDg7etaA6k2GaoiZWoT6tfGa//vGX BtXXzVm+zUGlyxnYu1oW95rYSbeYcwRb8ME2DvWTNc4HQmFowBR9FNXmnJW9knX4sXig H48w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=NA939e1a; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/9epfUzX"; 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 lh27si10806109ejb.545.2020.08.03.05.44.46; Mon, 03 Aug 2020 05:45:08 -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=NA939e1a; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/9epfUzX"; 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 S1729319AbgHCMnt (ORCPT + 99 others); Mon, 3 Aug 2020 08:43:49 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:35734 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728278AbgHCM3G (ORCPT ); Mon, 3 Aug 2020 08:29:06 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596457743; 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=RvLCSYDSP40IH/A+6SCmYBKw6wGrWKPPZ7D9/KZ9g7k=; b=NA939e1am+b3iGwgI0Rwq8cIEiKMStGfkzKJIDQMojIh5AcZrnltP2/8yagicIWVj/Vd9j MNS32FFcfMBwiUwi+StJXG34wyK/N21K5sE3cbKlHHSAh/mwUzf2T5bwo9GtCG0mlw0isE adzlkregFJesqalSh639+DELL2CWbOWacGETCS3gnfNBGH0JcTSIQNq23ISFcItMQPQ+eu i6OcpmgDNcCI4RaP8jPgRZ4vY4DQXVltUzbTUKgpFsi7Xg/hQSJc4SjZ36z3oxYxRIc+nx TrEeta2H6mjArjRuk8tuJa6hA19ttg7hRryKG09HR19cXzBCiiTWQHQiA/IciQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596457743; 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=RvLCSYDSP40IH/A+6SCmYBKw6wGrWKPPZ7D9/KZ9g7k=; b=/9epfUzXI/xZRGA93kyvyRrNxxfCRXRiZw5C3tqr/J5VmCLWRpOE8XzfVcDt9dKSFWrY+z VaR68GiEWbIqj2AQ== To: Sven Schnelle , Vincenzo Frascino Cc: linux-kernel@vger.kernel.org, Sven Schnelle , Peter Zijlstra Subject: Re: [PATCH 2/2] s390: convert to GENERIC_VDSO In-Reply-To: <20200803055645.79042-3-svens@linux.ibm.com> References: <20200803055645.79042-1-svens@linux.ibm.com> <20200803055645.79042-3-svens@linux.ibm.com> Date: Mon, 03 Aug 2020 14:29:01 +0200 Message-ID: <87ft93ncaa.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sven Schnelle writes: > - CPUCLOCK_VIRT is now handled with a syscall fallback, which might > be slower/less accurate than the old implementation. I can understand the slower, but why does it become less accurate? > Performance number from my system do 100 mio gettimeofday() calls: > > Plain syscall: 8.6s > Generic VDSO: 1.3s > old ASM VDSO: 1s > > So it's a bit slower but still much faster than syscalls. Where is the overhead coming from? > +static inline u64 __arch_get_hw_counter(s32 clock_mode) > +{ > + const struct vdso_data *vdso = __arch_get_vdso_data(); > + u64 adj, now; > + int cnt; > + > + do { > + do { > + cnt = READ_ONCE(vdso->arch.tb_update_cnt); > + } while (cnt & 1); smp_rmb() ? > + now = get_tod_clock(); > + adj = vdso->arch.tod_steering_end - now; > + if (unlikely((s64) adj > 0)) > + now += (vdso->arch.tod_steering_delta < 0) ? (adj >> 15) : -(adj >> 15); smp_rmb() ? > + } while (cnt != READ_ONCE(vdso->arch.tb_update_cnt)); > + return now; > if (ptff_query(PTFF_QTO) && ptff(&qto, sizeof(qto), PTFF_QTO) == 0) > lpar_offset = qto.tod_epoch_difference; > @@ -599,6 +550,13 @@ static int stp_sync_clock(void *data) > if (stp_info.todoff[0] || stp_info.todoff[1] || > stp_info.todoff[2] || stp_info.todoff[3] || > stp_info.tmd != 2) { > + vdso_data->arch.tb_update_cnt++; > + /* > + * This barrier isn't really needed as we're called > + * from stop_machine_cpuslocked(). However it doesn't > + * hurt in case the code gets changed. > + */ > + smp_wmb(); WMB without a corresponding RMB and an explanation what's ordered against what is voodoo at best. > rc = chsc_sstpc(stp_page, STP_OP_SYNC, 0, > &clock_delta); > if (rc == 0) { > @@ -609,6 +567,8 @@ static int stp_sync_clock(void *data) > if (rc == 0 && stp_info.tmd != 2) > rc = -EAGAIN; > } > + smp_wmb(); /* see comment above */ See my comments above :) Thanks, tglx