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=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 2C452C3815B for ; Mon, 20 Apr 2020 13:35:14 +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 E82712070B for ; Mon, 20 Apr 2020 13:35:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="duhHwTD6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E82712070B 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 localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jQWZc-0000Uc-02; Mon, 20 Apr 2020 13:34:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jQWZb-0000UX-EF for xen-devel@lists.xenproject.org; Mon, 20 Apr 2020 13:34:55 +0000 X-Inumbo-ID: b8011106-830b-11ea-b4f4-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b8011106-830b-11ea-b4f4-bc764e2007e4; Mon, 20 Apr 2020 13:34:54 +0000 (UTC) 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:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KHZs/z/LrfqhfDQ4gmLLzmAK5E3xFeKoPnMo1lVPRtA=; b=duhHwTD69XjxKOBN2aJBRP0fAC RfjxcFLoKppfdiuc/OtL0sSJifMmARn7G3dsocyiKFxsPfNIvvUpdtGxZfkiOf+AAMkuMgXvQEaLM M9dNaclBdjNBMvsp6pe1Ac6nDUAOX2t7kR3x2eg7j47A9aZvRcOLEArhnKiDLXhiJk0w=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jQWZY-0005Ky-0s; Mon, 20 Apr 2020 13:34:52 +0000 Received: from [54.239.6.185] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jQWZX-0005RH-PI; Mon, 20 Apr 2020 13:34:51 +0000 Subject: Re: [PATCH] pvcalls: Document explicitly the padding for all arches To: Jan Beulich References: <20200419104948.31200-1-julien@xen.org> From: Julien Grall Message-ID: <78288649-5930-9d01-bb8f-85e15406e4ef@xen.org> Date: Mon, 20 Apr 2020 14:34:49 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Wei Liu , Andrew Cooper , Julien Grall , Ian Jackson , George Dunlap , xen-devel@lists.xenproject.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Hi Jan, On 20/04/2020 09:04, Jan Beulich wrote: > On 19.04.2020 12:49, Julien Grall wrote: >> --- a/docs/misc/pvcalls.pandoc >> +++ b/docs/misc/pvcalls.pandoc >> @@ -246,9 +246,7 @@ The format is defined as follows: >> uint32_t domain; >> uint32_t type; >> uint32_t protocol; >> - #ifdef CONFIG_X86_32 >> uint8_t pad[4]; >> - #endif >> } socket; >> struct xen_pvcalls_connect { >> uint64_t id; >> @@ -257,16 +255,12 @@ The format is defined as follows: >> uint32_t flags; >> grant_ref_t ref; >> uint32_t evtchn; >> - #ifdef CONFIG_X86_32 >> uint8_t pad[4]; >> - #endif >> } connect; >> struct xen_pvcalls_release { >> uint64_t id; >> uint8_t reuse; >> - #ifdef CONFIG_X86_32 >> uint8_t pad[7]; >> - #endif >> } release; >> struct xen_pvcalls_bind { >> uint64_t id; >> @@ -276,9 +270,7 @@ The format is defined as follows: >> struct xen_pvcalls_listen { >> uint64_t id; >> uint32_t backlog; >> - #ifdef CONFIG_X86_32 >> uint8_t pad[4]; >> - #endif >> } listen; >> struct xen_pvcalls_accept { >> uint64_t id; > > I wonder on what grounds these #ifdef-s had been there - they're > plain wrong with the types used in the public header. > >> --- a/xen/include/public/io/pvcalls.h >> +++ b/xen/include/public/io/pvcalls.h >> @@ -65,6 +65,7 @@ struct xen_pvcalls_request { >> uint32_t domain; >> uint32_t type; >> uint32_t protocol; >> + uint8_t pad[4]; >> } socket; >> struct xen_pvcalls_connect { >> uint64_t id; >> @@ -73,10 +74,12 @@ struct xen_pvcalls_request { >> uint32_t flags; >> grant_ref_t ref; >> uint32_t evtchn; >> + uint8_t pad[4]; >> } connect; >> struct xen_pvcalls_release { >> uint64_t id; >> uint8_t reuse; >> + uint8_t pad[7]; >> } release; >> struct xen_pvcalls_bind { >> uint64_t id; >> @@ -86,6 +89,7 @@ struct xen_pvcalls_request { >> struct xen_pvcalls_listen { >> uint64_t id; >> uint32_t backlog; >> + uint8_t pad[4]; >> } listen; > > I'm afraid we can't change these in such a way - your additions > change sizeof() for the respective sub-structures on 32-bit x86, > and hence this is not a backwards compatible adjustment. This is a bit confusing, each structure contain a 64-bit field so I would have thought it the structure would be 8-byte aligned (as on 32-bit Arm). But looking at the spec, a uint64_t will only aligned to 4-byte. However, I am not sure why sizeof() matters here. I understand the value would be different, but AFAICT, this is not used as part of the protocol. IIUC the request should always be 56-bytes, so at worse you will read unknown bytes. Those bytes are at the end of the structure, so it should not matter. > The > best I can think of right now that we could do is make the > difference explicit, by putting the padding fields inside > #ifndef __i386__. But of course this is awkward at least when > thinking about a 32-bit / 64-bit pair of communication ends on > an x86-64 host. I don't think this is necessary because of the way a request has been defined. Cheers, -- Julien Grall