From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6786AC4743C for ; Mon, 7 Jun 2021 09:23:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35A8B61159 for ; Mon, 7 Jun 2021 09:23:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35A8B61159 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UM0X6VZhQYpetCozcZklpzuUcsOQJJPWdoNRBgFsaDI=; b=nOwX9dW4H42ztK XyE+o1oGnMmODjpgVkGK1NmqV2nUPr3b+wN2i/EfuIJAcvD0ySFqCIBdgm7R12BiDR1m5Z1SVCRq+ UHO9A3UP3R1gMJnxp2tm+oikHwGeuGw/qcR8+baN+SHpkSwCM9fdB98yQwHo4/b6rAQJUHyMVtbYg nrvRWf2uM5+O0tTM4uDSPs78n7/xhHBxCmWXqknqWsl8S18bgCvU+rUc7QmLgjuPKM26Q6DWEHmak 89aF7M4iYL5+lUmeNIsqS2iBP3jh6l5H9J2RSJWPcP3pD/v4iU6RqVckPCAfpXVRoYBZByLXYrq+0 +oCH9utDlzodw81inFJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqBR7-002Y2g-68; Mon, 07 Jun 2021 09:20:45 +0000 Received: from mail-wm1-f45.google.com ([209.85.128.45]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqAxe-002PdX-D8 for linux-arm-kernel@lists.infradead.org; Mon, 07 Jun 2021 08:50:22 +0000 Received: by mail-wm1-f45.google.com with SMTP id f20so5261567wmg.0 for ; Mon, 07 Jun 2021 01:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=R2ZopsQZZdXEYjl6azm31E2MzYfojsymg///Se/cAKM=; b=RxBciWEa0mOrwTDqwBl7XhVt1Z3tGfff3KVAXfjjxbhvucwuitAYpCjW2AiOfmc4hY MW0YwzUHKGA/WeKdlYLraPeOhx4a5uKzxp6v4lLraANt7WimKeIInnK9T/6eWrQjXCT9 WjObcZ+HYZ3Go8GMia3x24cyu5tbYPVgn1JDv/sRYAPZlA5vtodNND9A/q6x8y8UnXk6 SuJuhS9v8M4MwoSC+c+Tx7H+ePDwkcKPvy620Tt8pc5u8pj0IFei8NsOk08p/27eHLhl SoI75OyhpQKO1uzn4yXdmbM/CqtG6q0nD58HzKEwZj7xuk0c/z3vpR8i7Mvpj1PS7VyY r5YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=R2ZopsQZZdXEYjl6azm31E2MzYfojsymg///Se/cAKM=; b=JGxyH86frnOHeQjtmrMTUT3abajFZSXp6jN2qughpCE91CiHF8lQWiVSsz63oqD8G9 462bQg5lTh51G4VDFL2zEg6kar+lia37AvDqArRfRihZmu6Ou31jJR0DeZYozgXjBuib oZqGYeA8Iose6jsmYZi1tgIq5QsxjkYCvhCpOW8AWJ5ynmCiXPVGAvMc9n++8TBE8f2L yJk75QVSX/IPGillqLdCizGsumR0cXEOyDyuZX0sksCLKcVVxYFIl738TAZgqutiViKF NynDyN2msQRLXxsweQfDfz/GhmI/hBE2H0s+tFMC6459Uxw6nvIsrwyEdd1PVGjKEQNw j+3Q== X-Gm-Message-State: AOAM532E7P6s6IQQa/2ou57vsGHtUJM3rv5DaciUHeMZUXfehijUq7Yn ilec32lwNve8/5Qg05RBhJo6xg== X-Google-Smtp-Source: ABdhPJyurKzta3z2CeRnxFd2iiCVeQi8uEXKlJF0ITFMul63PvHyfT+ViQ4DZznWDHGoSIMfaenzLQ== X-Received: by 2002:a05:600c:21d1:: with SMTP id x17mr15424695wmj.167.1623055754959; Mon, 07 Jun 2021 01:49:14 -0700 (PDT) Received: from myrica (adsl-84-226-111-173.adslplus.ch. [84.226.111.173]) by smtp.gmail.com with ESMTPSA id o18sm5415514wrx.59.2021.06.07.01.49.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 01:49:14 -0700 (PDT) Date: Mon, 7 Jun 2021 10:48:55 +0200 From: Jean-Philippe Brucker To: Marc Zyngier Cc: Shameerali Kolothum Thodi , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , "linux-kernel@vger.kernel.org" , "will@kernel.org" , "catalin.marinas@arm.com" , "james.morse@arm.com" , "julien.thierry.kdev@gmail.com" , "suzuki.poulose@arm.com" , Alexandru Elisei , Linuxarm Subject: Re: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach) Message-ID: References: <20210506165232.1969-1-shameerali.kolothum.thodi@huawei.com> <87sg1xzqea.wl-maz@kernel.org> <95bb84ffdb0f4db3b64b38cc3b651f90@huawei.com> <87lf7ptztg.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87lf7ptztg.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210607_015018_500103_612ECC1A X-CRM114-Status: GOOD ( 21.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jun 04, 2021 at 04:27:39PM +0100, Marc Zyngier wrote: > > > Plus, I've found this nugget: > > > > > > > > max_pinned_vmids = NUM_USER_VMIDS - num_possible_cpus() - 2; > > > > > > > > > What is this "- 2"? My hunch is that it should really be "- 1" as VMID > > > 0 is reserved, and we have no equivalent of KPTI for S2. > > > > I think this is more related to the "pinned vmid" stuff and was borrowed from > > the asid_update_limit() fn in arch/arm64/mm/context.c. But I missed the > > comment that explains the reason behind it. It says, > > > > ---x--- > > /* > > * There must always be an ASID available after rollover. Ensure that, > > * even if all CPUs have a reserved ASID and the maximum number of ASIDs > > * are pinned, there still is at least one empty slot in the ASID map. > > */ > > max_pinned_asids = num_available_asids - num_possible_cpus() - 2; > > ---x--- > > > > So this is to make sure we will have at least one VMID available > > after rollover in case we have pinned the max number of VMIDs. I > > will include that comment to make it clear. > > That doesn't really explain the -2. Or is that that we have one for > the extra empty slot, and one for the reserved? > > Jean-Philippe? Yes, -2 is for ASID#0 and the extra empty slot. A comment higher in asids_update_limit() hints at that, but it could definitely be clearer /* * Expect allocation after rollover to fail if we don't have at least * one more ASID than CPUs. ASID #0 is reserved for init_mm. */ Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel