lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1e9270cabe2217e4299ea52adf2a87874459490e.camel@intel.com>
Date: Thu, 26 Sep 2024 12:13:33 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Hansen, Dave" <dave.hansen@...el.com>, "seanjc@...gle.com"
	<seanjc@...gle.com>, "bp@...en8.de" <bp@...en8.de>, "peterz@...radead.org"
	<peterz@...radead.org>, "hpa@...or.com" <hpa@...or.com>, "mingo@...hat.com"
	<mingo@...hat.com>, "kirill.shutemov@...ux.intel.com"
	<kirill.shutemov@...ux.intel.com>, "tglx@...utronix.de" <tglx@...utronix.de>,
	"pbonzini@...hat.com" <pbonzini@...hat.com>, "Williams, Dan J"
	<dan.j.williams@...el.com>, "nik.borisov@...e.com" <nik.borisov@...e.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>, "Hunter, Adrian"
	<adrian.hunter@...el.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "Edgecombe, Rick P"
	<rick.p.edgecombe@...el.com>, "x86@...nel.org" <x86@...nel.org>, "Yamahata,
 Isaku" <isaku.yamahata@...el.com>
Subject: Re: [PATCH v4 3/8] x86/virt/tdx: Prepare to support reading other
 global metadata fields

> 
> > +#define build_sysmd_read(_size)							\
> > +static int __read_sys_metadata_field##_size(u64 field_id, u##_size *val)	\
> > +{										\
> > +	u64 tmp;								\
> > +	int ret;								\
> > +										\
> > +	ret = tdh_sys_rd(field_id, &tmp);					\
> > +	if (ret)								\
> > +		return ret;							\
> > +										\
> > +	*val = tmp;								\
> > +										\
> > +	return 0;								\
> >   }
> >   
> > -#define read_sys_metadata_field16(_field_id, _val)		\
> > +build_sysmd_read(16)
> 
> nit: Generally the unwritten convention for this kind of macro 
> definition is to capitalize them and be of the from:
> 
> DEFINE_xxxxx - similar to how event classes are defined.
> 
> perhaps naming this macro:
> 
> DEFINE_TDX_METADATA_READER() ought to be more descriptive, also the
> "md" contraction of metadata also seems a bit quirky (at least to me).
> 
> It's not a deal breaker but if there is going to be another posting this 
> might be something to consider.
> 

Thanks for the comments.

I don't have opinion on this.  Dan said we can do something like
build_mmio_read() macro and this is where build_sysmd_read() came from.  Dan
used build_tdg_sys_rd() in his patch too:

https://lore.kernel.org/all/172618717675.516322.6087817418162288917.stgit@dwillia2-xfh.jf.intel.com/

Btw I actually agree that your DEFINE_xx() is more formal thus is better when
the macro is used by multiple C files.  But here only tdx.c uses it, and IMHO
it's also fine to have a informal but shorter name here.

Anyway let's see whether other people have anything to say.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ