linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Alexander Graf <graf@amazon.com>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Len Brown <lenb@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	"Woodhouse, David" <dwmw@amazon.co.uk>
Subject: Re: [PATCH] ACPI: bus: Match first 9 bytes of device IDs
Date: Fri, 25 Feb 2022 18:30:14 +0100	[thread overview]
Message-ID: <CAMj1kXEtUUod8Hp6VhS6k7iDKYkFj_t_J=qS2XF1p2X_SFdTvg@mail.gmail.com> (raw)
In-Reply-To: <YhkQKfE8ErtFBmSB@zx2c4.com>

On Fri, 25 Feb 2022 at 18:21, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> On Fri, Feb 25, 2022 at 6:13 PM Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > The device subsystem side of things already deals with this properly:
> > the modalias of the QEMU vmgenid device comes up as
> > 'acpi:QEMUVGID:VM_GEN_COUNTER', which means it already captures the
> > entire string, and exposes it in the correct way (modulo the all caps)
>
> Ahh, so the userspace side of this won't work right. Shucks. That's what
> I was concerned about.
>
> > I don't like this hack. If we are going to accept the fact that CIDs
> > could be arbitrary length strings, we should handle them properly.
> >
> > So what we need is a way for a module to describe its compatibility
> > with such a _CID, which shouldn't be that complicated.
>
> Can't we do something more boring and just...
>
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 4bb71979a8fd..5da5d990ff58 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -210,9 +210,9 @@ struct css_device_id {
>         __u8 type; /* subchannel type */
>         kernel_ulong_t driver_data;
>  };
>
> -#define ACPI_ID_LEN    9
> +#define ACPI_ID_LEN    16
>
>  struct acpi_device_id {
>         __u8 id[ACPI_ID_LEN];
>         kernel_ulong_t driver_data;
>
>
> As you can see from the context, those additional 7 bytes were being
> wasted on padding anyway inside the acpi_device_id struct, so it's
> basically free, it would seem. This seems like the least convoluted way
> of solving this issue? If we ever encounter _more_ ACPI devices with
> weird names, we could revisit a fancy dynamic solution, but for now, why
> don't we keep it simple?
>

Yeah, good point. I think this is fine, although there are a few other
uses of ACPI_ID_LEN in the tree. So perhaps this should be something
like

#define ACPI_ID_LEN    9
#define ACPI_CID_LEN    16

/* explanation goes here */

struct acpi_device_id {
    __u8 id[ACPI_CID_LEN];

instead? At a quick glance, none of those ACPI_ID_LEN users seem
related to the CID or the match metadata.

  reply	other threads:[~2022-02-25 17:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 15:55 [PATCH] ACPI: bus: Match first 9 bytes of device IDs Alexander Graf
2022-02-25 16:57 ` Jason A. Donenfeld
2022-02-25 17:09   ` Alexander Graf
2022-02-25 17:16     ` Jason A. Donenfeld
2022-02-25 17:13 ` Ard Biesheuvel
2022-02-25 17:21   ` Jason A. Donenfeld
2022-02-25 17:30     ` Ard Biesheuvel [this message]
2022-02-25 17:33       ` Jason A. Donenfeld
2022-02-25 18:03         ` Jason A. Donenfeld
2022-02-25 18:39           ` Jason A. Donenfeld
2022-02-25 19:06             ` Alexander Graf
2022-02-25 21:03               ` Jason A. Donenfeld

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='CAMj1kXEtUUod8Hp6VhS6k7iDKYkFj_t_J=qS2XF1p2X_SFdTvg@mail.gmail.com' \
    --to=ardb@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=dwmw@amazon.co.uk \
    --cc=graf@amazon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).