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=-17.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 C3D06C433DB for ; Mon, 18 Jan 2021 19:18:19 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 76A7122573 for ; Mon, 18 Jan 2021 19:18:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76A7122573 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.70029.125636 (Exim 4.92) (envelope-from ) id 1l1a2D-0004cn-Bf; Mon, 18 Jan 2021 19:17:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 70029.125636; Mon, 18 Jan 2021 19:17:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l1a2D-0004cg-8U; Mon, 18 Jan 2021 19:17:53 +0000 Received: by outflank-mailman (input) for mailman id 70029; Mon, 18 Jan 2021 19:17:51 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l1a2B-0004cb-OV for xen-devel@lists.xenproject.org; Mon, 18 Jan 2021 19:17:51 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l1a2A-0000IG-Hb; Mon, 18 Jan 2021 19:17:50 +0000 Received: from [54.239.6.185] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l1a2A-0007Up-AL; Mon, 18 Jan 2021 19:17:50 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=XrC143X4k+wjyXMUWrGyLpCZ8IjCncZEe/GGxQ7F4BI=; b=rK+Yut8wVNbZevybzq/StbTfNQ x+acyNaG8FXb8KZDGDey2es2a8syeBeLKwbWgdPlfjQwGXhBX7P7ZFKp019yE0ipNaZiqdzifH+8F dTyJ0RKLfWM31kwuDwT1qWuhlIflI8uMe7Xc6QHyVWwoKF4416TBSzn7cxvkLo6Pp+78=; Subject: Re: [PATCH V4 14/24] arm/ioreq: Introduce arch specific bits for IOREQ/DM features To: Oleksandr Cc: xen-devel@lists.xenproject.org, Julien Grall , Stefano Stabellini , Volodymyr Babchuk , Oleksandr Tyshchenko References: <1610488352-18494-1-git-send-email-olekstysh@gmail.com> <1610488352-18494-15-git-send-email-olekstysh@gmail.com> <355e613a-3c9d-7978-62cd-a35df057e5cd@xen.org> <06704224-bb57-c55e-a2ee-23032095e8ea@xen.org> From: Julien Grall Message-ID: Date: Mon, 18 Jan 2021 19:17:48 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Hi Oleksandr, On 17/01/2021 18:52, Oleksandr wrote: > > On 17.01.21 20:07, Julien Grall wrote: >> >> >> On 17/01/2021 17:11, Oleksandr wrote: >>> >>> On 15.01.21 22:26, Julien Grall wrote: >>> >>> Hi Julien >> >> Hi Oleksandr, > > > Hi Julien > > > >> >>>> >>>>> + >>>>>       PROGRESS(xen): >>>>>           ret = relinquish_memory(d, &d->xenpage_list); >>>>>           if ( ret ) >>>>> diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c >>>>> index ae7ef96..9814481 100644 >>>>> --- a/xen/arch/arm/io.c >>>>> +++ b/xen/arch/arm/io.c >>>>> @@ -16,6 +16,7 @@ >>>>>    * GNU General Public License for more details. >>>>>    */ >>>>>   +#include >>>>>   #include >>>>>   #include >>>>>   #include >>>>> @@ -23,6 +24,7 @@ >>>>>   #include >>>>>   #include >>>>>   #include >>>>> +#include >>>> >>>> Shouldn't this have been included by "xen/ioreq.h"? >>> Well, for V1 asm/hvm/ioreq.h was included by xen/ioreq.h. But, it >>> turned out that there was nothing inside common header required arch >>> one to be included and >>> I was asked to include arch header where it was indeed needed >>> (several *.c files). >> >> Fair enough. >> >> [...] >> >>>> >>>> If you return IO_HANDLED here, then it means the we will take care >>>> of previous I/O but the current one is going to be ignored. >>> Which current one? As I understand, if try_fwd_ioserv() gets called >>> with vio->req.state == STATE_IORESP_READY then this is a second round >>> after emulator completes the emulation (the first round was when >>> we returned IO_RETRY down the function and claimed that we would need >>> a completion), so we are still dealing with previous I/O. >>> vcpu_ioreq_handle_completion() -> arch_ioreq_complete_mmio() -> >>> try_handle_mmio() -> try_fwd_ioserv() -> handle_ioserv() >>> And after we return IO_HANDLED here, handle_ioserv() will be called >>> to complete the handling of this previous I/O emulation. >>> Or I really missed something? >> >> Hmmm... I somehow thought try_fw_ioserv() would only be called the >> first time. Do you have a branch with your code applied? This would >> help to follow the different paths. > Yes, I mentioned about it in cover letter. > > Please see > https://github.com/otyshchenko1/xen/commits/ioreq_4.14_ml5 > why 5 - because I started counting from the RFC) Oh, I looked at the cover letter and didn't find it. Hence why I asked. I should have looked more carefully. Thanks! I have looked closer at the question and I am not sure to understand why arch_ioreq_complete_mmio() is going to call try_handle_mmio(). This looks pretty innefficient to me because we already now the IO was handled by the IOREQ server. I realize that x86 is calling handle_mmio() again. However, I don't think we need the same on Arm because the instruction for accessing device memory are a lot simpler (you can only read or store at most a 64-bit value). So I would like to keep our emulation simple and not rely on try_ioserv_fw() to always return true when call from completion (AFAICT it is not possible to return false then). I will answer to the rest separately. Cheers, -- Julien Grall