public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)"  <longpeng2@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "andraprs@amazon.com" <andraprs@amazon.com>,
	"lexnv@amazon.com" <lexnv@amazon.com>,
	"alcioa@amazon.com" <alcioa@amazon.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"kamal@canonical.com" <kamal@canonical.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"sgarzare@redhat.com" <sgarzare@redhat.com>,
	"stefanha@redhat.com" <stefanha@redhat.com>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"ne-devel-upstream@amazon.com" <ne-devel-upstream@amazon.com>
Subject: RE: [PATCH v2 1/4] nitro_enclaves: merge contiguous physical memory regions
Date: Wed, 22 Sep 2021 01:09:11 +0000	[thread overview]
Message-ID: <f2145906d6394b3cb49dc514f4640cb3@huawei.com> (raw)
In-Reply-To: <YUn4N4kWe8mBUVUR@kroah.com>



> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Tuesday, September 21, 2021 11:20 PM
> To: Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
> <longpeng2@huawei.com>
> Cc: andraprs@amazon.com; lexnv@amazon.com; alcioa@amazon.com;
> linux-kernel@vger.kernel.org; Gonglei (Arei) <arei.gonglei@huawei.com>;
> kamal@canonical.com; pbonzini@redhat.com; sgarzare@redhat.com;
> stefanha@redhat.com; vkuznets@redhat.com; ne-devel-upstream@amazon.com
> Subject: Re: [PATCH v2 1/4] nitro_enclaves: merge contiguous physical memory
> regions
> 
> On Tue, Sep 21, 2021 at 11:10:36PM +0800, Longpeng(Mike) wrote:
> > There can be cases when there are more memory regions that need to be
> > set for an enclave than the maximum supported number of memory regions
> > per enclave. One example can be when the memory regions are backed by 2
> > MiB hugepages (the minimum supported hugepage size).
> >
> > Let's merge the adjacent regions if they are physical contiguous. This
> > way the final number of memory regions is less than before merging and
> > could potentially avoid reaching maximum.
> >
> > Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
> 
> I need a real (i.e. legal) name for a signed-off-by line please.
> 

Okay.

> > ---
> >  drivers/virt/nitro_enclaves/ne_misc_dev.c | 87
> ++++++++++++++++++++-----------
> >  1 file changed, 58 insertions(+), 29 deletions(-)
> >
> > diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c
> b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> > index e21e1e8..a4776fc 100644
> > --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
> > +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> > @@ -126,6 +126,26 @@ struct ne_cpu_pool {
> >  static struct ne_cpu_pool ne_cpu_pool;
> >
> >  /**
> > + * struct phys_mem_region - Physical memory region
> > + * @paddr:	The start physical address of the region.
> > + * @size:	The sizeof of the region.
> > + */
> > +struct phys_mem_region {
> > +	u64 paddr;
> > +	u64 size;
> > +};
> > +
> > +/**
> > + * struct phys_contig_mem_region - Physical contiguous memory regions
> > + * @num:	The number of regions that currently has.
> > + * @region:	The array of physical memory regions.
> > + */
> > +struct phys_contig_mem_region {
> > +	unsigned long num;
> > +	struct phys_mem_region region[0];
> > +};
> 
> Why create your own structures and not use the in-kernel ones for stuff
> like this?  What is wrong with the existing memory region or resource
> handling logic?
> 

This patch only optimizes the physical memory regions handling logic of 
the Nitro Enclaves driver, not the common resource management in kernel. 
The physical memory regions are need to send to the hardware later.

Thanks for your suggestion, maybe we can use 'struct range' instead of 
'struct phys_mem_region'.

> thanks,
> 
> greg k-h

  reply	other threads:[~2021-09-22  1:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 15:10 [PATCH v2 0/4] merge contiguous physical memory regions Longpeng(Mike)
2021-09-21 15:10 ` [PATCH v2 1/4] nitro_enclaves: " Longpeng(Mike)
2021-09-21 15:20   ` Greg KH
2021-09-22  1:09     ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.) [this message]
2021-09-21 15:20   ` Greg KH
2021-09-22  0:27     ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2021-10-03 13:00   ` Paraschiv, Andra-Irina
2021-10-05 13:54     ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2021-10-06 11:11       ` Paraschiv, Andra-Irina
2021-09-21 15:10 ` [PATCH v2 2/4] nitro_enclaves: sanity check the physical region during setting Longpeng(Mike)
2021-10-03 13:29   ` Paraschiv, Andra-Irina
2021-09-21 15:10 ` [PATCH v2 3/4] nitro_enclaves: add test framework for the misc functionality Longpeng(Mike)
2021-09-21 15:20   ` Greg KH
2021-09-22  0:33     ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2021-09-22  5:55       ` Greg KH
2021-10-03 13:49   ` Paraschiv, Andra-Irina
2021-10-07  2:05     ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
2021-10-07 15:37       ` Paraschiv, Andra-Irina
2021-09-21 15:10 ` [PATCH v2 4/4] nitro_enclaves: add kunit tests for physical contiguous region merging Longpeng(Mike)
2021-10-03 14:14   ` Paraschiv, Andra-Irina
2021-09-27  7:00 ` [PATCH v2 0/4] merge contiguous physical memory regions Paraschiv, Andra-Irina

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=f2145906d6394b3cb49dc514f4640cb3@huawei.com \
    --to=longpeng2@huawei.com \
    --cc=alcioa@amazon.com \
    --cc=andraprs@amazon.com \
    --cc=arei.gonglei@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kamal@canonical.com \
    --cc=lexnv@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ne-devel-upstream@amazon.com \
    --cc=pbonzini@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vkuznets@redhat.com \
    /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