Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2770173rdb; Wed, 4 Oct 2023 10:51:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLhoWer0lr0ofTH5PS9Mh6bpfUfNCo0l7CbELu9QFihERJGn3kXC/pfY549Zt/9XzkE1zr X-Received: by 2002:a17:902:c254:b0:1c5:c36b:e954 with SMTP id 20-20020a170902c25400b001c5c36be954mr2909012plg.2.1696441866602; Wed, 04 Oct 2023 10:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696441866; cv=none; d=google.com; s=arc-20160816; b=CF20Jdv+xnvBESDFf8rdsEBH05Va0bGWSIEWB9rcuF35WI0SbB+pxmUxF08Ckh8Ppo MhdqSDO7Uk3kfhjBmOUISDHY05eVmNLSBPenr2OGDVZRAGw5G3RwpVgD31WdSZry2St1 ykwElJ0WADWtdJb93Vby5+RVJ9AXYRs7cDCffK6BIoFLNJVol/D7UFATFT3zUfqWsBFK aXKH5eupBX9kPgPutRtWmAEu3DXuTjAlUCgC3DV2DNtRuWm0e7PuLV86hP7ye4ItxPr6 gW/k5wAQnDWCv/CHfzlIJ0lo8RNiZCa9/tqC5B/cVKV6HulYzuA7p0xcZ8ojGlrPuwRB Y+UA== 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=Pl9nGhR3NiZxZrhTzdvAyOEc2aNr0yiSUg46gDv9gDo=; fh=mrkBrD6eR0dFU0393NN1C7oYzEEeSNuQtW6YCp06xSQ=; b=hhXtms4QGBykbe09BK+2yHzxaRrPnWJOCiSgsZpsekNYeLXxiYYi6lWXuNLmbRh/O3 Kqahgc/NH8gk7OkMMoRga6KP1nbFF0ukGZowGLX5jL+G7Aq6eGynArnTJbrY0Z/0wJoV 0Hs3j5cXn+DULp6VI6AL5UZkV41u6u1X5YFbcOLRTMTXXDb3tOBsPMliuBIfs4HT2Y7D +zPNIDCICPf878/ZpMZ5Qz4AFjE0VyGxNsqZ2e9iXDWlUkfWUaxLo5yFBvcCKhmIdjRj ADnn3LkYR8eLIaBuU9tkWFrLdMq+awbCSjz3jK9qiRmt/qtr2fsUfOpGrCuTnDV1dqTb EaWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2WhJHhBM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id f6-20020a170902684600b001bde0b58abesi3870822pln.161.2023.10.04.10.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 10:51:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2WhJHhBM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3B78C808204E; Wed, 4 Oct 2023 10:50:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243494AbjJDRuk (ORCPT + 99 others); Wed, 4 Oct 2023 13:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233541AbjJDRuj (ORCPT ); Wed, 4 Oct 2023 13:50:39 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4BAE9E; Wed, 4 Oct 2023 10:50:34 -0700 (PDT) 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-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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 04 Oct 2023 10:50:41 -0700 (PDT) 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