Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1405914rwb; Wed, 16 Nov 2022 17:27:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf7+rbdvyiOPz98ELK+7UxO7GGx1RpaAvpxCRnCkt5ClTpnILkEYQHH8ka289WeNPUPRH+/g X-Received: by 2002:a17:90a:9dc5:b0:20a:d78d:ed20 with SMTP id x5-20020a17090a9dc500b0020ad78ded20mr487461pjv.65.1668648476328; Wed, 16 Nov 2022 17:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668648476; cv=none; d=google.com; s=arc-20160816; b=qx3i0Opz+ha7JgYqjhuX9df56J3Ap1sSk2QNs0pXCMZX7GMwHZFgquDstuO6ndAKSX 42mlgH6hWahxqDk2+rPmiobKZmijAp6HbM3BrmIZMaHog8hcqXo68B2X/bhLw8np+ENB U3eyuJpOxu4Fw0ChBlxtLptyJbaWgTcotbnuudroYCIsFRpaCeTmfhPH00g/C3YT77II fOUQB1hP5usMMjJAsSGeQSHkJ2l8bi4EMGHqGaGmLoQ1VPpsQJr/gCcsB1xM7DeHGJPd svZx8jrwUC4GW7eLXAZMuUYbwS5bvRu+5e9peiZRaBYTT8EbyuaknbIDhsvn+ToCyW+0 3Rcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z9RXOutukKu5blPlWvexAz9n9/ERlHayplCb37e/A/4=; b=PcyNjYC+ap2BJ5As7zfHCtix+gcvONdRcrg5nWd8wywpe27ZJ10w4zYBKBvRdshe7u JxFO/IAGQxgm/CIL2OpUu8k3d/QKZ/DQRp7w7+rtL6d+XaOmt9tKTYROvwRqmXvBGv9L iPd6oeLmfL/XWWrNwIFXOlAReOa/itBowbmJzYR/Az93yoxR9soU4+3KUxWWzW9MP3Cx 8CwqOYpbkrTluNQ8tDwF8NBu9JWeOFFBMBTLBT5Bwx4uFyIGZuCx8YjKAHaoV8SPosqb +cWNdFMOLavN7ycrE8RLtE3bDgOHFJGuVLvW5iJ/0WvEC2GzM7mW57y0av13LkQDi3V6 BLEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BCJ2yFn1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a170902c24500b00172f8a4b3e1si14596614plg.81.2022.11.16.17.27.44; Wed, 16 Nov 2022 17:27:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=BCJ2yFn1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234476AbiKQBVF (ORCPT + 90 others); Wed, 16 Nov 2022 20:21:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbiKQBVE (ORCPT ); Wed, 16 Nov 2022 20:21:04 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA2C21BD for ; Wed, 16 Nov 2022 17:21:02 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id 62so557359pgb.13 for ; Wed, 16 Nov 2022 17:21:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Z9RXOutukKu5blPlWvexAz9n9/ERlHayplCb37e/A/4=; b=BCJ2yFn1tsn53sy1KM+C8Zdkm82sOpVH7Y2IEhdM8rEe13KY0+JzJibXQNw49jtg0F YJpEGHLSia5ik4xDLNtUdQIGQn0Mnvq5shG/tD+yC5C36OKusWOkmEEIIWPLzDz+LDeJ +EbWB3TGbfUThJkJrUqfMhcfj7xrboNt4Z3Q1/VY4vEMS6ja/gEVrEgQtOn4PLLnvf0+ Dknem1k3dNWoBkp4GT9fG6BrZjEyaqrE8zcMCpiFHFeZs/CeijWHWxsjzlujxeDGbT4a ZNQETjJ5XpC/A7xD7UgpSEMubrDNSt+PhkWikvJsLXLMyToq6DkALWrxQCrz4tbZ83dw bSvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z9RXOutukKu5blPlWvexAz9n9/ERlHayplCb37e/A/4=; b=1gh8Rn0k9DdAzjigBE2OoENpniJx2rU63oCjQvfknfzBN67Hk2pT8yHW+D19SA8pOz repS3o/FAR6OkY0HLI5EZzmdh5sIzg3IAW4G6mz8XaL/xeNRXGPnkUccnU9v3ExnUptC uFiFr0v3nny1tSjXTi16GfxuGnBQ7j6AcFNTR2lzZF3Y3r36BW4eAzL916nFWfY8CzUG Gjwm0gGe1A4IC9TrNUR8bCXSG182jHZIhXqzmC6cq7/PfYFp/2bGaDuV4v0iCFgdlXhh 7QUVmWEafbHI7xD3pufMvv+Tj1xdtE5h8UPcEFHsKjd3deEWOfxY4baIeYPhXsH1g1nu Y3aw== X-Gm-Message-State: ANoB5pmlDOXmY3EJ4/z3SfOjfCw2wQtMTrxXnGnorm7PwjLC32EL2Q2w V7e5oEmIotcy2w2hv6jR4qVrDQ== X-Received: by 2002:aa7:9518:0:b0:56c:8c13:24fd with SMTP id b24-20020aa79518000000b0056c8c1324fdmr778700pfp.2.1668648061959; Wed, 16 Nov 2022 17:21:01 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id e12-20020a63544c000000b0047048c201e3sm4864960pgm.33.2022.11.16.17.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 17:21:01 -0800 (PST) Date: Thu, 17 Nov 2022 01:20:58 +0000 From: Sean Christopherson To: Oliver Upton Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Reiji Watanabe Subject: Re: [PATCH 2/2] KVM: arm64: selftests: Disable single-step without relying on ucall() Message-ID: References: <20221117002350.2178351-1-seanjc@google.com> <20221117002350.2178351-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 17, 2022, Oliver Upton wrote: > On Thu, Nov 17, 2022 at 12:23:50AM +0000, Sean Christopherson wrote: > > Automatically disable single-step when the guest reaches the end of the > > verified section instead of using an explicit ucall() to ask userspace to > > disable single-step. An upcoming change to implement a pool-based scheme > > for ucall() will add an atomic operation (bit test and set) in the guest > > ucall code, and if the compiler generate "old school" atomics, e.g. > > Off topic, but I didn't ask when we were discussing this issue. What is > the atomic used for in the pool-based ucall implementation? To avoid having to plumb an "id" into the guest, vCPUs grab a ucall entry from the pool on a first-come first-serve basis, and then release the entry when the ucall is complete. The current implementation is a bitmap, e.g. every possible entry has a bit in the map, and vCPUs do an atomic bit-test-and-set to claim an entry. Ugh. And there's a bug. Of course I notice it after sending the pull request. Depsite being defined in atomic.h, and despite clear_bit() being atomic in the kernel, tools' clear_bit() isn't actually atomic. Grr. Doesn't cause problems because there are so few multi-vCPU selftests, but that needs to be fixed. Best thing would be to fix clear_bit() itself.