Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2406030rdb; Tue, 3 Oct 2023 23:10:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZ7UwQX+KHBW4ZPrH610NBLkhz/NYqmOH0GJma0wt/tQx9U/UNrGkm8+pPQXxmOU1rb34H X-Received: by 2002:a05:6a20:948a:b0:15d:ec88:3570 with SMTP id hs10-20020a056a20948a00b0015dec883570mr1369742pzb.22.1696399809896; Tue, 03 Oct 2023 23:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696399809; cv=none; d=google.com; s=arc-20160816; b=jVm67Quwi3zLhqSpS1S/t71K+xVH+IGGmlUmDFCWKq8/mFN+xvYfqIGLUgbaU2/FJk 0du1qUGmIPu10roawEmCLPDowNv++nafI0hzW+sfhqTaXwieU5V/yCRoLDeJQljst5Bu X5OoVeiAAC9gW3YTPENKxqPpWGR6Rki9vZX8yM6tB3tGIdJC4wqjOFmVUoW6QH7i0hJC doU/8fyC972uple5Ag+MqeWUQ7gfsqUvhw2mGATetzLF2K1qEOB6rr8aKkr3n1HaHs4a B+ygDjImaBu8MyRhX5s8G1RuqZ8TMsFw45NuHEm7SvcGnL1kwFhDlqZUK8WJhkMnaG12 VPXw== 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=FrqKCujVpM9EV5SY/9XcUy9QEnvt5rh1Vxr0nTjVYeE=; fh=CFe6zpE67W5acWuj8rGGbJDtr0s/XuS9f00Z1ivHRYc=; b=fnA78ZE1OA/r4tGiux/WCp5ZTPa/CD18lz2W6rT+Bt15I5hK8MprJCbmfhL0Nd9KF5 bDufYqKKCzZehPD1wu2oNjTDC5uujtz2mGv4q0kKVGCOMBMCZubHMIzs7/uhfQ1R8TDr INgg4WNcfOBuRBmS8px2fFRKuBwApaIJ1eIYnVNM0ApjxYY9mIoX3e9kMMGUHqrWyAV8 EoKCDU196/QzZO8HiTKHZqXC29HINeJQytucQGaDMOJPt8O4AH7Wq2LwhyJVanvW2W2m M09UgruJwxTPgO7AWumnKBTsYm0R0yCVuOdFCo54iJ2vQX6Nsze4AaAhTwn3k2ULK4IF rBog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u1NmNpVk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id x23-20020a63b217000000b00578e21ee4a0si2720987pge.174.2023.10.03.23.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 23:10:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u1NmNpVk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 5B2FE807C7C6; Tue, 3 Oct 2023 23:10:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232771AbjJDGKB (ORCPT + 99 others); Wed, 4 Oct 2023 02:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232537AbjJDGKA (ORCPT ); Wed, 4 Oct 2023 02:10:00 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 901CDAD; Tue, 3 Oct 2023 23:09:57 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA553C433C7; Wed, 4 Oct 2023 06:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696399797; bh=Xec0FwIwMIIelHtMmVgwwJFxppLB+fwZSkk9L39ie64=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u1NmNpVkwlrXDhaN6oVwQK5RZl764lQNoqwExFJhHbrk5ETShsX0kithgrUaZ7A6Z CFuoW9B+anjwzNmTAIF+XaKoeIVE1UKuR1qw85B3yoPf2PXt2Y3Jb8DFKr4afMOdTG wBTlDNsy/X3dG8DtqIhl2xmsrpsppNGz5EO8/x3k= Date: Wed, 4 Oct 2023 08:09:55 +0200 From: Greg KH To: Nuno Das Neves Cc: 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, mikelley@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, vkuznets@redhat.com, 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: <2023100443-wrinkly-romp-79d9@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 23:10:07 -0700 (PDT) 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; > > > > > > > > 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.kernel.org/driver-api/ioctl.html 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. > In practice the hypervisor, linux, and VMM compilers all produce the > same layout for bitfields on the architectures we support. You are getting lucky, please do this properly, without a bitfield marking in the structure. thanks, greg k-h