Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp494289ybk; Wed, 20 May 2020 05:03:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK95O8f7PQVSneXhA/Iklgn5QJytzivtDXBx9ccYcc5XSy+Nj/cMyEwxnzvDz2N/cHfyUC X-Received: by 2002:a17:906:328c:: with SMTP id 12mr3493038ejw.69.1589976215703; Wed, 20 May 2020 05:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589976215; cv=none; d=google.com; s=arc-20160816; b=F8U3BLgTGEiffRYdIC/3I9ubnDpBxFrGC/ZhLou4+OXMzzkfp/JanZ7n4m9lfLC1/N vcA10rMBi29wOiIye7npD5PLqFAlepqAD97sX6BE3gU76VMP1R3O8ss40ZBtJcd96T6G rRWmAzqgtT88dYvg1mTd2ug0LGvzP1+bTEn4zmFyIpu3rULDQg7C7VCvy7Ul9ymGvmwG aNduIudUIP5X0cQfJfWvWQ1EwNQ6uw7rZNkjkyH0I+ineb7AInm/aC/QC2dZ4wqNSlwL 4mHyB3Fy3F4zamzfNgPe32qDfprFnbuNySmWnfSVjoZE9ggUAQq/OORTzjKRcz/3wPzs LuDQ== 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=JnOGElrbfefJufwP7V3/BYXcXd/vzwtxKv2P5v6Gv2U=; b=Qomc62I6Cy1wWTEPKnXyC1BkEf7YhGuwxtSWXpmPaYfV34bWQ4SBi+ig43Vs8e1DWE mzBYucsoi/JqKwjcLy9xPS1+mMfhVsz72idaIJMWt8tcZ7wKy95A+rSgUOo/wbgeB5RU p15exf6zhHgctRzTob7mXWgIjL5lxtEovg6LmMy22rPUX0I9Qd/XCz5w5TBClMB+gBT8 vjzmluJdoRykXM67IOTW/bMzuk0/W4C1C+puPHJEoRXvh+CIrxF6ZKp4FO5GHiqB+ekV pmpDbeAxJUpPUgDwFU75MtoKp42eVWiSSbxodOGK6Ari9ISIXlr+tYQ7fgoYSi9NxIHO bbZA== 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 co4si1417164edb.269.2020.05.20.05.02.56; Wed, 20 May 2020 05:03:35 -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 S1726954AbgETMBP (ORCPT + 99 others); Wed, 20 May 2020 08:01:15 -0400 Received: from foss.arm.com ([217.140.110.172]:54448 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbgETMBO (ORCPT ); Wed, 20 May 2020 08:01:14 -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 1560730E; Wed, 20 May 2020 05:01:14 -0700 (PDT) Received: from [10.37.8.50] (unknown [10.37.8.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9F8003F52E; Wed, 20 May 2020 05:01:12 -0700 (PDT) Subject: Re: [PATCH v3 0/6] arm64: add the time namespace support To: Andrei Vagin , Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Rutland , Thomas Gleixner , Dmitry Safonov References: <20200416052618.804515-1-avagin@gmail.com> From: Vincenzo Frascino Message-ID: <08e3ee73-8048-b84e-61b3-e87f3500e022@arm.com> Date: Wed, 20 May 2020 13:02:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200416052618.804515-1-avagin@gmail.com> 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 Andrei, On 4/16/20 6:26 AM, Andrei Vagin wrote: > Allocate the time namespace page among VVAR pages and add the logic > to handle faults on VVAR properly. > > If a task belongs to a time namespace then the VVAR page which contains > the system wide VDSO data is replaced with a namespace specific page > which has the same layout as the VVAR page. That page has vdso_data->seq > set to 1 to enforce the slow path and vdso_data->clock_mode set to > VCLOCK_TIMENS to enforce the time namespace handling path. > > The extra check in the case that vdso_data->seq is odd, e.g. a concurrent > update of the VDSO data is in progress, is not really affecting regular > tasks which are not part of a time namespace as the task is spin waiting > for the update to finish and vdso_data->seq to become even again. > > If a time namespace task hits that code path, it invokes the corresponding > time getter function which retrieves the real VVAR page, reads host time > and then adds the offset for the requested clock which is stored in the > special VVAR page. > > v2: Code cleanups suggested by Vincenzo. > v3: use OPTIMIZER_HIDE_VAR() instead of inline assembly in > __arch_get_timens_vdso_data. > Nit: If you re-post, I would remove the OPTIMIZER_HIDE_VAR() reference because it does not reflect the current status of the patches. I tested it again with your latest change in the test code and it works for me (thank you for sending a patch for the test as well). With this: Reviewed-by: Vincenzo Frascino > Cc: Vincenzo Frascino > Cc: Thomas Gleixner > Cc: Dmitry Safonov > > v3 on github (if someone prefers `git pull` to `git am`): > https://github.com/avagin/linux-task-diag/tree/arm64/timens-v3 > > Andrei Vagin (6): > arm64/vdso: use the fault callback to map vvar pages > arm64/vdso: Zap vvar pages when switching to a time namespace > arm64/vdso: Add time napespace page > arm64/vdso: Handle faults on timens page > arm64/vdso: Restrict splitting VVAR VMA > arm64: enable time namespace support > > arch/arm64/Kconfig | 1 + > .../include/asm/vdso/compat_gettimeofday.h | 11 ++ > arch/arm64/include/asm/vdso/gettimeofday.h | 8 ++ > arch/arm64/kernel/vdso.c | 134 ++++++++++++++++-- > arch/arm64/kernel/vdso/vdso.lds.S | 3 +- > arch/arm64/kernel/vdso32/vdso.lds.S | 3 +- > include/vdso/datapage.h | 1 + > 7 files changed, 147 insertions(+), 14 deletions(-) > -- Regards, Vincenzo