public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>, Dave Jiang <dave.jiang@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	<linux-cxl@vger.kernel.org>, <dave@stgolabs.net>,
	<jonathan.cameron@huawei.com>, <alison.schofield@intel.com>,
	<vishal.l.verma@intel.com>, <ira.weiny@intel.com>,
	<gourry@gourry.net>, <linux-kernel@vger.kernel.org>,
	<linux-next@vger.kernel.org>, <sfr@canb.auug.org.au>
Subject: Re: [BUG -next] ./usr/include/cxl/features.h:11:10: fatal error: uuid/uuid.h: No such file or directory
Date: Mon, 31 Mar 2025 09:54:55 -0700	[thread overview]
Message-ID: <67eac8df3e217_201f02948d@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20250331132439.GD10839@nvidia.com>

Jason Gunthorpe wrote:
> On Fri, Mar 28, 2025 at 05:26:42PM -0700, Dave Jiang wrote:
> > > For now the following builds for me, but it is a quite a mess to undo
> > > the assumption that that the hardware object definitions can not use
> > > uuid_t:
> > 
> > +Jason.
> 
> Seems invasive?

Yeah, it left a bad taste for me as well.

> Maybe just like below?

I like that this avoids converting to the kernel's uuid API, however,
not quite happy that it forces userspace to contend with the
type-conflict with uuid/uuid.h.

So how about one more riff on your idea?

-- 8< --
From 6fbca9bb3e29f3a205861b9489a8fba46506e107 Mon Sep 17 00:00:00 2001
From: Dan Williams <dan.j.williams@intel.com>
Date: Mon, 31 Mar 2025 09:43:48 -0700
Subject: [PATCH] fwctl/cxl: Fix uuid_t usage in uapi
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The uuid_t type is kernel internal, and Paul reports the following build
error when it is used in a uapi header:

    usr/include/cxl/features.h:59:9: error: unknown type name ‘uuid_t’

Create a uuid type (__uapi_uuid_t) compatible with the longstanding
definition uuid/uuid.h for userspace builds, and use uuid_t directly for
kernel builds.

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reported-by: "Paul E. McKenney" <paulmck@kernel.org>
Closes: http://lore.kernel.org/f6489337-67c7-48c8-b48a-58603ec15328@paulmck-laptop
Fixes: 9b8e73cdb141 ("cxl: Move cxl feature command structs to user header")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 include/uapi/cxl/features.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/uapi/cxl/features.h b/include/uapi/cxl/features.h
index d6db8984889f..dd8874860cec 100644
--- a/include/uapi/cxl/features.h
+++ b/include/uapi/cxl/features.h
@@ -8,10 +8,14 @@
 #define _UAPI_CXL_FEATURES_H_
 
 #include <linux/types.h>
-#ifndef __KERNEL__
-#include <uuid/uuid.h>
-#else
+
+typedef unsigned char __uapi_uuid_t[16];
+
+#ifdef __KERNEL__
 #include <linux/uuid.h>
+static_assert(sizeof(__uapi_uuid_t) == sizeof(uuid_t) &&
+	      __alignof__(__uapi_uuid_t) == __alignof__(uuid_t));
+#define __uapi_uuid_t uuid_t
 #endif
 
 /*
@@ -60,7 +64,7 @@ struct cxl_mbox_get_sup_feats_in {
  * Get Supported Features Supported Feature Entry
  */
 struct cxl_feat_entry {
-	uuid_t uuid;
+	__uapi_uuid_t uuid;
 	__le16 id;
 	__le16 get_feat_size;
 	__le16 set_feat_size;
@@ -110,7 +114,7 @@ struct cxl_mbox_get_sup_feats_out {
  * CXL spec r3.2 section 8.2.9.6.2 Table 8-99
  */
 struct cxl_mbox_get_feat_in {
-	uuid_t uuid;
+	__uapi_uuid_t uuid;
 	__le16 offset;
 	__le16 count;
 	__u8 selection;
@@ -143,7 +147,7 @@ enum cxl_get_feat_selection {
  */
 struct cxl_mbox_set_feat_in {
 	__struct_group(cxl_mbox_set_feat_hdr, hdr, /* no attrs */,
-		uuid_t uuid;
+		__uapi_uuid_t uuid;
 		__le32 flags;
 		__le16 offset;
 		__u8 version;
-- 
2.48.1

  parent reply	other threads:[~2025-03-31 16:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 17:39 [BUG -next] ./usr/include/cxl/features.h:11:10: fatal error: uuid/uuid.h: No such file or directory Paul E. McKenney
2025-03-28 20:03 ` Dave Jiang
2025-03-28 20:45   ` Paul E. McKenney
2025-03-28 21:22     ` Dave Jiang
2025-03-28 21:57       ` Paul E. McKenney
2025-03-28 23:26         ` Dan Williams
2025-03-28 23:58           ` Paul E. McKenney
2025-03-29  0:23             ` Dan Williams
2025-03-29  0:26           ` Dave Jiang
2025-03-31 13:24             ` Jason Gunthorpe
2025-03-31 16:48               ` Paul E. McKenney
2025-03-31 16:54               ` Dan Williams [this message]
2025-03-31 17:17                 ` Jason Gunthorpe
2025-03-31 19:47                   ` Dan Williams
2025-04-01  7:01                     ` Venkat Rao Bagalkote
2025-04-01 14:08                       ` Paul E. McKenney
2025-04-01 15:15                       ` Dave Jiang
2025-04-02  0:07                         ` Paul E. McKenney
2025-04-02  0:18                           ` Dave Jiang
2025-04-02  0:47                             ` Stephen Rothwell
2025-04-02  4:21                               ` Paul E. McKenney
2025-04-02  6:27                                 ` Venkat Rao Bagalkote
2025-04-02 11:44                                   ` Jason Gunthorpe
2025-04-02 13:42                                     ` Venkat Rao Bagalkote
2025-04-02 17:20                                     ` Paul E. McKenney
2025-04-07 17:49                 ` Jason Gunthorpe
2025-04-05 17:34           ` Palmer Dabbelt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67eac8df3e217_201f02948d@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=gourry@gourry.net \
    --cc=ira.weiny@intel.com \
    --cc=jgg@nvidia.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox