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 4D1FDE7C4E2 for ; Wed, 4 Oct 2023 17:51:10 +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=bb4uiYZud9VHtru+pllGz5aP58DpSyf6jXzcReblFLU=; b=A4SnA0+BESy1tO UGK2n+p7rvvkbWCiPRlkwQfJzbPU7eq2OpltJO9f/R6N5UpvBE9PGkuC6Fo0KYV4CbaVzhQUNN2QY S5VJQt7D5x5rhr5LMIWFmzw7DP/kwKzR/Z8p9DZ2KjXg/Xp0pm7ZUusEEVQEyIj22CjG9s92dlhWm OUPKFVZE0To2WVt4mZaQg5WDtBMMzH57kFQ1Wn51ifYx0FJLJ0eGrX/Q71Y80rEjDC/BvJBscGFaV SMaeicftb5yOjYAnYZutKXOYqXQ+YE4AAXipecR451TmISc7rQ008VEHTJrYnJkzPBzovvGx4zkv6 +uvp3LYGGMIVtN8eE8Vw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qo619-000djS-2s; Wed, 04 Oct 2023 17:50:39 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qo617-000dic-0U for linux-arm-kernel@lists.infradead.org; Wed, 04 Oct 2023 17:50:38 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 12514CE1DE8; Wed, 4 Oct 2023 17:50:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4EC4C433C7; Wed, 4 Oct 2023 17:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696441834; bh=zUosDvRHyf5850z577fl4LTHEhb7yQpe48mCNpSn/dc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2WhJHhBMIySUnPBl69ikcW1YP9LVxDdKLskFO0ilfchUa0N62QAKE6YuIQedy7KXD SxnHr2LcS0FDOOjXfHSyTFyx3IFbO6clRjTbzA+eUie0xc0EVaPHTOXuzUnE9W/an/ Noh3F/uSnPsR43lBo/FgNg2eHFDKe5hpkVGQ9WLI= Date: Wed, 4 Oct 2023 19:50:31 +0200 From: Greg KH To: Dexuan Cui Cc: Nuno Das Neves , Wei Liu , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-arch@vger.kernel.org" , "patches@lists.linux.dev" , "Michael Kelley (LINUX)" , KY Srinivasan , Haiyang Zhang , "apais@linux.microsoft.com" , Tianyu Lan , "ssengar@linux.microsoft.com" , MUKESH RATHOR , "stanislav.kinsburskiy@gmail.com" , "jinankjain@linux.microsoft.com" , vkuznets , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "hpa@zytor.com" , "will@kernel.org" , "catalin.marinas@arm.com" Subject: Re: [PATCH v4 13/15] uapi: hyperv: Add mshv driver headers defining hypervisor ABIs Message-ID: <2023100415-diving-clapper-a2a7@gregkh> References: <1696010501-24584-1-git-send-email-nunodasneves@linux.microsoft.com> <1696010501-24584-14-git-send-email-nunodasneves@linux.microsoft.com> <2023093057-eggplant-reshoot-8513@gregkh> <2023100154-ferret-rift-acef@gregkh> <2023100443-wrinkly-romp-79d9@gregkh> 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-20231004_105037_535952_4F1D0651 X-CRM114-Status: GOOD ( 27.43 ) 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 Wed, Oct 04, 2023 at 05:36:32PM +0000, Dexuan Cui wrote: > > From: Greg KH > > Sent: Tuesday, October 3, 2023 11:10 PM > > [...] > > On Tue, Oct 03, 2023 at 04:37:01PM -0700, Nuno Das Neves wrote: > > > On 9/30/2023 11:19 PM, Greg KH wrote: > > > > On Sat, Sep 30, 2023 at 10:01:58PM +0000, Wei Liu wrote: > > > > > On Sat, Sep 30, 2023 at 08:09:19AM +0200, Greg KH wrote: > > > > > > On Fri, Sep 29, 2023 at 11:01:39AM -0700, Nuno Das Neves wrote: > > > > > > > +/* Define connection identifier type. */ > > > > > > > +union hv_connection_id { > > > > > > > + __u32 asu32; > > > > > > > + struct { > > > > > > > + __u32 id:24; > > > > > > > + __u32 reserved:8; > > > > > > > + } __packed u; > > IMO the "__packed" is unnecessary. > > > > > > > bitfields will not work properly in uapi .h files, please never do that. > > > > > > > > > > Can you clarify a bit more why it wouldn't work? Endianess? Alignment? > > > > > > > > Yes to both. > > > > > > > > Did you all read the documentation for how to write a kernel api? If > > > > not, please do so. I think it mentions bitfields, but it not, it really > > > > should as of course, this will not work properly with different endian > > > > systems or many compilers. > > > > > > Yes, in > > https://docs.k/ > > ernel.org%2Fdriver- > > api%2Fioctl.html&data=05%7C01%7Cdecui%40microsoft.com%7Ce404769e0f > > 85493f0aa108dbc4a08a27%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C > > 0%7C638319966071263290%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj > > AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C% > > 7C%7C&sdata=RiLNA5DRviWBQK6XXhxC4m77raSDBb%2F0BB6BDpFPUJY%3D > > &reserved=0 it says that it is > > > "better to avoid" bitfields. > > > > > > Unfortunately bitfields are used in the definition of the hypervisor > > > ABI. We import these definitions directly from the hypervisor code. > > > > So why do you feel you have to use this specific format for your > > user/kernel api? That is not what is going to the hypervisor. > > If it's hard to avoid bitfield here, maybe we can refer to the definition of > struct iphdr in include/uapi/linux/ip.h It is not hard to avoid using bitfields, just use the proper definitions to make this portable for all compilers. And ick, ip.h is not a good thing to follow :) thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel