Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10565295rwd; Thu, 22 Jun 2023 01:30:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4cFaUPblJt5RnrXGvgbNNOAlYOkbXSTqagVWew1BF5VAs9KfM5q3WIld3g6kCow/Ny2mOV X-Received: by 2002:a05:6808:274c:b0:39a:ba2f:6ea6 with SMTP id eh12-20020a056808274c00b0039aba2f6ea6mr14068590oib.11.1687422614527; Thu, 22 Jun 2023 01:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687422614; cv=none; d=google.com; s=arc-20160816; b=j3NFkq7ChU9VoQXz45jYVcac1kBTM174avBik37o4/2pupZfmuxbO4y8diENb2mE2P pSUV7jbF1rZXXY67dYjMFcrF0UteNR1isqhujrv5WDUN/oISu/yqRQVlP72Xf3UXx57c 1x7cb4tpAjTOdonsseW5lACjHrlTluOK56ZPX9jpS+UsowA6VqOABlYGo5ol1bNkzx94 iFoqogOYGUFqEXe41WaVva4vXfzhdDPbib9ceK6yvFFLYsFrRAWtfDh5B87xM6bjS/Fv 3wQNep2jmdt0023B78Tpip7NI4PqdqHVd9dh5VXFnqAgjlJH1MDCCvPqjIvQ7A39Nolf p5Gg== 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=mbXA79XLHxERspEGgZH6j4YxWqZ7fFJ3tIvi+rSHyOk=; b=yt1MUBcZiGf20yU/xO0dJAytuQcPx0jl7Qlw4VDe7H9h/zg9tIDrD/C+HqKg7QJKfo X7I5vgYE9AuoKc6FZowA1Ghs47X60lUnAV+CT0Z6bBDvOUQD72UNMBDTHcUsOkXgj4RK 5iXfROl0lEfQ+Q90UIzMJzTg3kol1tBFmZAXiHNDWtDd1PsyDI7v71g5vS0+01HszVWH 0pnZe/CkYcwP4of/qquNUd7s7RG16s6JNNKAaCWGAJPjUmftpanlY0DJsirl8I2Fl3SZ 3LCry6ghARo7rQn3MdKOKUVGSSx6bec4auyCEF5ItlybSDBltYuewqCLMfkhz2iKNk8p 5OJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=jljuonf4; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 131-20020a630189000000b005533647f7c5si6066600pgb.420.2023.06.22.01.30.02; Thu, 22 Jun 2023 01:30:14 -0700 (PDT) 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=@infradead.org header.s=desiato.20200630 header.b=jljuonf4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbjFVI06 (ORCPT + 99 others); Thu, 22 Jun 2023 04:26:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbjFVI0o (ORCPT ); Thu, 22 Jun 2023 04:26:44 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFAD7211E for ; Thu, 22 Jun 2023 01:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mbXA79XLHxERspEGgZH6j4YxWqZ7fFJ3tIvi+rSHyOk=; b=jljuonf4K1sLymfrWeTD2/MMUL 6Jvei8fLyJRLPO2xhFRkPTEX/P9cws5G9NRNZSBrXELNh4ejlE7fXvYInygAh8kHXg1ncBXdf8+Im 8o8avMslqDvCS1YoFewmeCMd9YkBnLf5BGNzROXRLYsUr2V+T4VBcNmEIvHkRQOXSoQOd3kOgR9iV SaDAqSk0I1fb0D4nIcLLuHZfNv1AaNYBqVwd076jGXF1F+NEb6iMrrXtNzBeEcK1cOSJOpndElzOx son3dUox7JxXjSQmsyKBkBia3Twhiff5TZYa2+H6WM2MGT3azXZJItdB/tnxfGFbuhQ90NOWIxz2B V8NSddeQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qCFdq-0014SH-0S; Thu, 22 Jun 2023 08:26:10 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 454FA300222; Thu, 22 Jun 2023 10:26:07 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2646E2421619E; Thu, 22 Jun 2023 10:26:07 +0200 (CEST) Date: Thu, 22 Jun 2023 10:26:07 +0200 From: Peter Zijlstra To: Juergen Gross Cc: Per Bilse , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Stefano Stabellini , Oleksandr Tyshchenko , "open list:X86 ENTRY CODE" , "moderated list:XEN HYPERVISOR INTERFACE" Subject: Re: [PATCH] Updates to Xen hypercall preemption Message-ID: <20230622082607.GD4253@hirez.programming.kicks-ass.net> References: <20230621151442.2152425-1-per.bilse@citrix.com> <20230621164038.GM2053369@hirez.programming.kicks-ass.net> <6523f3e2-8dfc-c2dd-6d14-9e0c3ac93cc8@citrix.com> <20230621200409.GC4253@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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, Jun 22, 2023 at 07:22:53AM +0200, Juergen Gross wrote: > The hypercalls we are talking of are synchronous ones. They are running > in the context of the vcpu doing the call (like a syscall from userland is > running in the process context). (so time actually passes from the guest's pov?) > The hypervisor will return to guest context from time to time by modifying > the registers such that the guest will do the hypercall again with different > input values for the hypervisor, resulting in a proper continuation of the > hypercall processing. Eeeuw.. that's pretty terrible. And changing this isn't in the cards, like at all? That is, why isn't this whole thing written like: for (;;) { ret = hypercall(foo); if (ret == -EAGAIN) { cond_resched(); continue; } break; } > It is an awful interface and I agree that switching to full preemption in > dom0 seems to be the route which we should try to take. Well, I would very strongly suggest the route to take is to scrap the whole thing and invest in doing something saner so we don't have to jump through hoops like this. This is quite possibly the worst possible interface for this Xen could have come up with -- awards material for sure. > The downside would be that some workloads might see worse performance > due to backend I/O handling might get preempted. Is that an actual concern? Mark this a legaxy inteface and anybody who wants to get away from it updates. > Just thinking - can full preemption be enabled per process? Nope, that's a system wide thing. Preemption is something that's driven by the requirements of the tasks that preempt, not something by the tasks that get preempted. Andy's idea of having that thing intercepted as an exception (EXTABLE like) and relocating the IP to a place that does cond_resched() before going back is an option.. gross, but possibly better, dunno. Quite the mess indeed :/