Re: [PATCH 1/2] kernel: add platform_has() infrastructure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26.04.22 19:31, Borislav Petkov wrote:
On Tue, Apr 26, 2022 at 03:40:20PM +0200, Juergen Gross wrote:
diff --git a/kernel/platform-feature.c b/kernel/platform-feature.c
new file mode 100644
index 000000000000..2d52f8442cd5
--- /dev/null
+++ b/kernel/platform-feature.c
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/cache.h>
+#include <linux/platform-feature.h>
+
+unsigned long __read_mostly platform_features[PLATFORM_FEAT_ARRAY_SZ];

Probably __ro_after_init.

Yes, good idea.


+EXPORT_SYMBOL_GPL(platform_features);

You probably should make that thing static and use only accessors to
modify it in case you wanna change the underlying data structure in the
future.

The question is whether we think that those platform features will be used
in hot paths or not. If so the inline accessors (at least the platform_has()
one) would be preferred IMO.

OTOH really performance critical cases could use static_branch or such.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux