From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bharata B Rao Date: Fri, 06 Sep 2019 11:48:39 +0000 Subject: Re: [PATCH v7 1/7] kvmppc: Driver to manage pages of secure guest Message-Id: <20190906113639.GA8748@in.ibm.com> List-Id: References: <20190822102620.21897-1-bharata@linux.ibm.com> <20190822102620.21897-2-bharata@linux.ibm.com> <20190829083810.GA13039@lst.de> <20190830034259.GD31913@in.ibm.com> <20190902075356.GA28967@lst.de> In-Reply-To: <20190902075356.GA28967@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Christoph Hellwig Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, linux-mm@kvack.org, paulus@au1.ibm.com, aneesh.kumar@linux.vnet.ibm.com, jglisse@redhat.com, linuxram@us.ibm.com, sukadev@linux.vnet.ibm.com, cclaudio@linux.ibm.com On Mon, Sep 02, 2019 at 09:53:56AM +0200, Christoph Hellwig wrote: > On Fri, Aug 30, 2019 at 09:12:59AM +0530, Bharata B Rao wrote: > > On Thu, Aug 29, 2019 at 10:38:10AM +0200, Christoph Hellwig wrote: > > > On Thu, Aug 22, 2019 at 03:56:14PM +0530, Bharata B Rao wrote: > > > > +/* > > > > + * Bits 60:56 in the rmap entry will be used to identify the > > > > + * different uses/functions of rmap. > > > > + */ > > > > +#define KVMPPC_RMAP_DEVM_PFN (0x2ULL << 56) > > > > > > How did you come up with this specific value? > > > > Different usage types of RMAP array are being defined. > > https://patchwork.ozlabs.org/patch/1149791/ > > > > The above value is reserved for device pfn usage. > > Shouldn't all these defintions go in together in a patch? Ideally yes, but the above patch is already in Paul's tree, I will sync up with him about this. > Also is bit 56+ a set of values, so is there 1 << 56 and 3 << 56 as well? Seems > like even that other patch doesn't fully define these "pfn" values. I realized that the bit numbers have changed, it is no longer bits 60:56, but instead top 8bits. #define KVMPPC_RMAP_UVMEM_PFN 0x0200000000000000 static inline bool kvmppc_rmap_is_uvmem_pfn(unsigned long *rmap) { return ((*rmap & 0xff00000000000000) = KVMPPC_RMAP_UVMEM_PFN); } > > > > No need for !! when returning a bool. Also the helper seems a little > > > pointless, just opencoding it would make the code more readable in my > > > opinion. > > > > I expect similar routines for other usages of RMAP to come up. > > Please drop them all. Having to wade through a header to check for > a specific bit that also is set manually elsewhere in related code > just obsfucates it for the reader. I am currently using the routine kvmppc_rmap_is_uvmem_pfn() (shown above) instead open coding it at multiple places, but I can drop it if you prefer. Regards, Bharata.