On Wed, 23 Oct 2024 11:54:22 +0530 vanshika.shu...@nxp.com wrote: > +/* IOCTL */ > +#define KPG_NC_MAGIC_NUM 0xf0f0 > +#define KPG_NC_IOCTL_UPDATE _IOWR(KPG_NC_MAGIC_NUM, 1, size_t) > + > + > +#define KNRM "\x1B[0m" > +#define KRED "\x1B[31m" > +#define KGRN "\x1B[32m" > +#define KYEL "\x1B[33m" > +#define KBLU "\x1B[34m" > +#define KMAG "\x1B[35m" > +#define KCYN "\x1B[36m" > +#define KWHT "\x1B[37m" > + > +#if defined(RTE_ARCH_ARM) && defined(RTE_ARCH_64) > +static inline void flush_tlb(void *p) > +{ > + asm volatile("dc civac, %0" ::"r"(p)); > + asm volatile("dsb ish"); > + asm volatile("isb"); > +} > +#endif > + > +static inline void mark_kpage_ncache(uint64_t huge_page) > +{ > + int fd, ret; > + > + fd = open(KPG_NC_DEVICE_PATH, O_RDONLY); > + if (fd < 0) { > + ENETC_PMD_ERR(KYEL "Error: " KNRM "Could not open: %s", > + KPG_NC_DEVICE_PATH); > +
Do not add your own color stuff into logging! It will mess up when log goes to syslog or journal. There is a better more complete set of patchs to add generic color support to log (still under review). Also directly manipulating kernel page cache via non-upstream ioctl's is a bad idea from security and portability point of view. Do you really want to make Christoph Hellwig, and Al Viro come after you? If you have to do this it should be wrapped in some API in EAL, not in the driver.