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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 26D32C4332F for ; Fri, 9 Dec 2022 01:10:06 +0000 (UTC) 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=cNL1RXdzetEDAeWlc6tSOXay3VY9vICA6CK1eFfrmZM=; b=rKkDuB8GPIFo6/ 0LiBYgxOiNIo1a4D5qsSLPnQaQcSj8ILDvvsa33UKkE0WiJsvsRMNxonr5x+x/s9yYotDxa75L1t1 FlJ08x2uN1j3xYuEzo5G8ZcNy4LkfwE/ZcEpJ9PeRz7XxbviOhB0w+JPrvOW4TYhgSvRDfQhUEdSA UDGSJrUs4Vvm3C2ypdxZel1C28HDSMD5ppSp67GGiwe/dHShvqjzjK0HBnQECAOmxuTHsgcXapFn/ eSuJDPg3ZAGVSFWR99MDjB7niV6eanDToBTeeyd2iyOqO3LJ7nztaFjZOlpH2buWoKT2QQYyTOld8 C0cKL03duExCCmvcQwPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3Rsu-00HJk0-30; Fri, 09 Dec 2022 01:09:04 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3Rsq-00HJfY-HD for linux-arm-kernel@lists.infradead.org; Fri, 09 Dec 2022 01:09:02 +0000 Received: by mail-pj1-x102a.google.com with SMTP id n65-20020a17090a2cc700b0021bc5ef7a14so3374788pjd.0 for ; Thu, 08 Dec 2022 17:08:58 -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=R0W5fcABi4X+T/jYwfg3acG+mAXpKXLqoOLMcVDvb94=; b=YriPTaeIiA+dLmTSSSXERGxZoMyfxJhoF2Q8RM1j7icfTqEwdCfNmwHRywZVksID9N yt3L9g633vwLWxIZEY1PievSOwRoolVjFuC2ekFqhXWDrbAgmSyOG8E61xcBei/0WmkD n3zTXHfaLve5+vNvZO0l7Nq5ja3MPhbw/Zy0/wgqCgHFNdKS3cxS/4qNYhNLqDue4ooc J5EXd9M3CGckvr5AeCg01H05bHqrWl9oIldXxZyKGqNhqjj4kHaNhCQp1c7egMM531/g 0N6aof8FoDZ0/n1nLpXmasPJ3LYaX/UAhpwEXGBjpWrXiOyYtqQVHTcsdM7gm/cVbdTY W13w== 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=R0W5fcABi4X+T/jYwfg3acG+mAXpKXLqoOLMcVDvb94=; b=UXov68IJB6mp7CcMwCA0tmGct2TOC93YvSkNz2mU/1En4KjiIys3YovFsCe8TkegZh +AVfsqzB0i6lqyL76GZmDxADHtBorDO2QdR6VttBhXDHiXNsistt30takVmdhPWu/XoE P4XWpvOmXqhmC5FAEOsfrVaWKcNlbPjcjb3Q/6capacZUepOdeWpv+cFQlPT9S/pRfF2 RDJH8AoMUzwGos7CO7pF7Q6tDFfl0XD/cZGFVUv8Y/X7gepGjXnTOJcmNYAgg54oQWBz djqv7lT34S9NqWIh2ZwTp32cqN1AlYFwON2ufGydEbAjEekQrnK5XLRHGF2PSLo1zirI PK6w== X-Gm-Message-State: ANoB5pn3efJfiV1XS4F9Wju8X/6AU8PE1O2lubOs6H7Oq5arAo/Ivzbc zRUCre0m+CUdgfq4RX4m5NKxWQ== X-Google-Smtp-Source: AA0mqf7592VdpFGEsXHXafhoIIzr0OlDlMvX/sxUwlVGqoBDiQgVEZPiR3YzSXTZCX1tcoMfJ2vdoQ== X-Received: by 2002:a17:902:d491:b0:189:858f:b5c0 with SMTP id c17-20020a170902d49100b00189858fb5c0mr1689887plg.0.1670548137442; Thu, 08 Dec 2022 17:08:57 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id n6-20020a170902d2c600b00189e1522982sm51067plc.168.2022.12.08.17.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 17:08:57 -0800 (PST) Date: Fri, 9 Dec 2022 01:08:53 +0000 From: Sean Christopherson To: Ricardo Koller Cc: Oliver Upton , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Shuah Khan , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] KVM: selftests: Setup ucall after loading program into guest memory Message-ID: References: <20221207214809.489070-1-oliver.upton@linux.dev> <20221207214809.489070-3-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221208_170900_628181_664D884A X-CRM114-Status: GOOD ( 26.23 ) 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 Thu, Dec 08, 2022, Ricardo Koller wrote: > On Thu, Dec 08, 2022 at 07:01:57PM +0000, Sean Christopherson wrote: > > On Thu, Dec 08, 2022, Ricardo Koller wrote: > > > On Thu, Dec 08, 2022 at 12:37:23AM +0000, Oliver Upton wrote: > > > > On Thu, Dec 08, 2022 at 12:24:20AM +0000, Sean Christopherson wrote: > > > > > > Even still, that's just a kludge to make ucalls work. We have other > > > > > > MMIO devices (GIC distributor, for example) that work by chance since > > > > > > nothing conflicts with the constant GPAs we've selected in the tests. > > > > > > > > > > > > I'd rather we go down the route of having an address allocator for the > > > > > > for both the VA and PA spaces to provide carveouts at runtime. > > > > > > > > > > Aren't those two separate issues? The PA, a.k.a. memslots space, can be solved > > > > > by allocating a dedicated memslot, i.e. doesn't need a carve. At worst, collisions > > > > > will yield very explicit asserts, which IMO is better than whatever might go wrong > > > > > with a carve out. > > > > > > > > Perhaps the use of the term 'carveout' wasn't right here. > > > > > > > > What I'm suggesting is we cannot rely on KVM memslots alone to act as an > > > > allocator for the PA space. KVM can provide devices to the guest that > > > > aren't represented as memslots. If we're trying to fix PA allocations > > > > anyway, why not make it generic enough to suit the needs of things > > > > beyond ucalls? > > > > > > One extra bit of information: in arm, IO is any access to an address (within > > > bounds) not backed by a memslot. Not the same as x86 where MMIO are writes to > > > read-only memslots. No idea what other arches do. > > > > I don't think that's correct, doesn't this code turn write abort on a RO memslot > > into an io_mem_abort()? Specifically, the "(write_fault && !writable)" check will > > match, and assuming none the the edge cases in the if-statement fire, KVM will > > send the write down io_mem_abort(). > > You are right. In fact, page_fault_test checks precisely that: writes on > RO memslots are sent to userspace as an mmio exit. I was just referring > to the MMIO done for ucall. To clarify for others, Ricardo thought that x86 selftests were already using a read-only memslot for ucalls, hence the confusion. > Having said that, we could use ucall as writes on read-only memslots > like what x86 does. +1. x86 currently uses I/O with a hardcoded port, but theoretically that's just as error prone as hardcoding a GPA, it just works because x86 doesn't have any port I/O tests. Ugh, and that made me look at sync_regs_test.c, which does its own open coded ucall. That thing is probably working by dumb luck at this point. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel