Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp598571ybg; Tue, 9 Jun 2020 08:13:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDRx1WZ/pmx7RiMWTTZLKF8r0rWfJPpcZxXjQZs2BoB8mV2scJQfHTgEYWlxz8dMSbHKzf X-Received: by 2002:a17:907:10d1:: with SMTP id rv17mr25637815ejb.51.1591715631202; Tue, 09 Jun 2020 08:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591715631; cv=none; d=google.com; s=arc-20160816; b=rzdtbkBXZXj0+DG0dBUlx9DUR4yxsPcdY0+IkyRbWAw3NnJsyt1Mur/dIhtPxV7ElY TauwBLH4IOxX3oAAeyW+nlp6cVhDp9/dvR4/3SIaLYvKlMAmiZyhgZSYz6xs0c9GYoNO lz1u5xZ4oX/3y9zH5yyI1qUo+q1bmsrd0uwD/ciETmHI77j7LgZqgqArf0FYOs7rCNMg Sm/koiK7js6u6GXTQeyaXOmRbBz+brpZz7F25nods3BYNcFleOj23G9aNSC/L1ds86TI wi5chgpZkSnMRK0SrbUHyaSU0vHKDtX+ri2AbSoei48HsmYwifKSxXEjYmsXCpAYcw2g jFcw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=tibe9scCn+DfnyGZu6/CCyTtVTs4FS9gy8HHRbOHJ+8=; b=QzudT8eEBGbH7JB69AHYgrf9Ov0PT4u7IKabxgmlyL6iBX5kwau1onWa9Z6hEvp279 iQv/c0eMgyofmmJIvWeEEw7zR+ymCvDwbSz2fWMuwASNlj7gfim2HmwjaOUBjCNYK9/j wvUpVrGgrXgXelCqcoJn9tVwZMnLpu6KjpnBX6dsv3s9l5yRkMDFtlgfbcHvIoUeLunX W3MhdpybxiWxkoh4FVSzzjQowUTAJHNSWAW75xgc/j5uxbFfkjj96G1XIR0GL3BL31ud QgMYlhJ73L4H/avjtIOrPs36rqpKNXotaPTn792LQs1LA+GHXyncyRqxb8WxWvjaZL5g G/pw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si2435395edr.276.2020.06.09.08.13.27; Tue, 09 Jun 2020 08:13:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730712AbgFIPKg (ORCPT + 99 others); Tue, 9 Jun 2020 11:10:36 -0400 Received: from foss.arm.com ([217.140.110.172]:43834 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726903AbgFIPKg (ORCPT ); Tue, 9 Jun 2020 11:10:36 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0DE891FB; Tue, 9 Jun 2020 08:10:35 -0700 (PDT) Received: from [10.37.12.139] (unknown [10.37.12.139]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 777CC3F66F; Tue, 9 Jun 2020 08:10:33 -0700 (PDT) Subject: Re: [PATCH v6] s390: Fix vDSO clock_getres() To: Heiko Carstens Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, Vasily Gorbik , Christian Borntraeger , Martin Schwidefsky References: <20200324121027.21665-1-vincenzo.frascino@arm.com> <20200609144608.GB4575@osiris> From: Vincenzo Frascino Message-ID: Date: Tue, 9 Jun 2020 16:12:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200609144608.GB4575@osiris> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Heiko, On 6/9/20 3:46 PM, Heiko Carstens wrote: > Hello Vincenzo, > > sorry it took such a long time to answer! > >> clock_getres in the vDSO library has to preserve the same behaviour >> of posix_get_hrtimer_res(). >> >> In particular, posix_get_hrtimer_res() does: >> sec = 0; >> ns = hrtimer_resolution; >> and hrtimer_resolution depends on the enablement of the high >> resolution timers that can happen either at compile or at run time. >> >> Fix the s390 vdso implementation of clock_getres keeping a copy of >> hrtimer_resolution in vdso data and using that directly. >> >> Cc: Heiko Carstens >> Cc: Vasily Gorbik >> Cc: Christian Borntraeger >> Signed-off-by: Vincenzo Frascino >> Acked-by: Martin Schwidefsky >> --- >> arch/s390/include/asm/vdso.h | 1 + >> arch/s390/kernel/asm-offsets.c | 2 +- >> arch/s390/kernel/time.c | 1 + >> arch/s390/kernel/vdso64/clock_getres.S | 10 +++++----- >> 4 files changed, 8 insertions(+), 6 deletions(-) > ... > >> diff --git a/arch/s390/kernel/vdso64/clock_getres.S b/arch/s390/kernel/vdso64/clock_getres.S >> index 081435398e0a..022b58c980db 100644 >> --- a/arch/s390/kernel/vdso64/clock_getres.S >> +++ b/arch/s390/kernel/vdso64/clock_getres.S >> @@ -17,12 +17,14 @@ >> .type __kernel_clock_getres,@function >> __kernel_clock_getres: >> CFI_STARTPROC >> - larl %r1,4f >> + larl %r1,3f >> + lg %r0,0(%r1) >> cghi %r2,__CLOCK_REALTIME_COARSE >> je 0f >> cghi %r2,__CLOCK_MONOTONIC_COARSE >> je 0f >> - larl %r1,3f >> + larl %r1,_vdso_data >> + l %r0,__VDSO_CLOCK_REALTIME_RES(%r1) > > This should be llgf for proper zero extension. The code works anyway, > since the upper lg would clear the high order bits, however this looks > like it works more or less by accident ;) > > I changed it and applied your patch. Thanks a lot! Thank you for this and for the explanation. I must admit that this was the first attempt to write s390 assembly. I had to go through most of the "Principles of Operation" before I could get something meaningful going ;) > -- Regards, Vincenzo P.S. Now I can finally say that once in my life I wrote s390 assembler ;)