diff mbox series

[RFC,20/62] mm/page_ext: Export lookup_page_ext() symbol

Message ID 20190508144422.13171-21-kirill.shutemov@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Intel MKTME enabling | expand

Commit Message

kirill.shutemov@linux.intel.com May 8, 2019, 2:43 p.m. UTC
page_keyid() is inline funcation that uses lookup_page_ext(). KVM is
going to use page_keyid() and since KVM can be built as a module
lookup_page_ext() has to be exported.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
 mm/page_ext.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Peter Zijlstra June 14, 2019, 11:12 a.m. UTC | #1
On Wed, May 08, 2019 at 05:43:40PM +0300, Kirill A. Shutemov wrote:
> page_keyid() is inline funcation that uses lookup_page_ext(). KVM is
> going to use page_keyid() and since KVM can be built as a module
> lookup_page_ext() has to be exported.

I _really_ hate having to export world+dog for KVM. This one might not
be a real issue, but I itch every time I see an export for KVM these
days.
Kirill A . Shutemov June 14, 2019, 10:44 p.m. UTC | #2
On Fri, Jun 14, 2019 at 01:12:59PM +0200, Peter Zijlstra wrote:
> On Wed, May 08, 2019 at 05:43:40PM +0300, Kirill A. Shutemov wrote:
> > page_keyid() is inline funcation that uses lookup_page_ext(). KVM is
> > going to use page_keyid() and since KVM can be built as a module
> > lookup_page_ext() has to be exported.
> 
> I _really_ hate having to export world+dog for KVM. This one might not
> be a real issue, but I itch every time I see an export for KVM these
> days.

Is there any better way? Do we need to invent EXPORT_SYMBOL_KVM()? :P
Peter Zijlstra June 17, 2019, 9:30 a.m. UTC | #3
On Sat, Jun 15, 2019 at 01:44:43AM +0300, Kirill A. Shutemov wrote:
> On Fri, Jun 14, 2019 at 01:12:59PM +0200, Peter Zijlstra wrote:
> > On Wed, May 08, 2019 at 05:43:40PM +0300, Kirill A. Shutemov wrote:
> > > page_keyid() is inline funcation that uses lookup_page_ext(). KVM is
> > > going to use page_keyid() and since KVM can be built as a module
> > > lookup_page_ext() has to be exported.
> > 
> > I _really_ hate having to export world+dog for KVM. This one might not
> > be a real issue, but I itch every time I see an export for KVM these
> > days.
> 
> Is there any better way? Do we need to invent EXPORT_SYMBOL_KVM()? :P

Or disallow KVM (or parts thereof) from being a module anymore.
Kai Huang June 17, 2019, 11:01 a.m. UTC | #4
On Mon, 2019-06-17 at 11:30 +0200, Peter Zijlstra wrote:
> On Sat, Jun 15, 2019 at 01:44:43AM +0300, Kirill A. Shutemov wrote:
> > On Fri, Jun 14, 2019 at 01:12:59PM +0200, Peter Zijlstra wrote:
> > > On Wed, May 08, 2019 at 05:43:40PM +0300, Kirill A. Shutemov wrote:
> > > > page_keyid() is inline funcation that uses lookup_page_ext(). KVM is
> > > > going to use page_keyid() and since KVM can be built as a module
> > > > lookup_page_ext() has to be exported.
> > > 
> > > I _really_ hate having to export world+dog for KVM. This one might not
> > > be a real issue, but I itch every time I see an export for KVM these
> > > days.
> > 
> > Is there any better way? Do we need to invent EXPORT_SYMBOL_KVM()? :P
> 
> Or disallow KVM (or parts thereof) from being a module anymore.

For this particular symbol expose, I don't think its fair to blame KVM since the fundamental reason
is because page_keyid() (which calls lookup_page_ext()) being implemented as static inline function
in header file, so essentially having any other module who calls page_keyid() will trigger this
problem -- in fact IOMMU driver calls page_keyid() too so even w/o KVM lookup_page_ext() needs to be
exposed.

Thanks,
-Kai
Huang, Kai June 17, 2019, 11:13 a.m. UTC | #5
On Mon, 2019-06-17 at 23:01 +1200, Kai Huang wrote:
> On Mon, 2019-06-17 at 11:30 +0200, Peter Zijlstra wrote:
> > On Sat, Jun 15, 2019 at 01:44:43AM +0300, Kirill A. Shutemov wrote:
> > > On Fri, Jun 14, 2019 at 01:12:59PM +0200, Peter Zijlstra wrote:
> > > > On Wed, May 08, 2019 at 05:43:40PM +0300, Kirill A. Shutemov wrote:
> > > > > page_keyid() is inline funcation that uses lookup_page_ext(). KVM is
> > > > > going to use page_keyid() and since KVM can be built as a module
> > > > > lookup_page_ext() has to be exported.
> > > > 
> > > > I _really_ hate having to export world+dog for KVM. This one might not
> > > > be a real issue, but I itch every time I see an export for KVM these
> > > > days.
> > > 
> > > Is there any better way? Do we need to invent EXPORT_SYMBOL_KVM()? :P
> > 
> > Or disallow KVM (or parts thereof) from being a module anymore.
> 
> For this particular symbol expose, I don't think its fair to blame KVM since the fundamental
> reason
> is because page_keyid() (which calls lookup_page_ext()) being implemented as static inline
> function
> in header file, so essentially having any other module who calls page_keyid() will trigger this
> problem -- in fact IOMMU driver calls page_keyid() too so even w/o KVM lookup_page_ext() needs to
> be
> exposed.

Oops it seems Intel IOMMU driver is not a module but buildin so yes KVM is the only module who calls
page_keyid() now. Sorry my bad. But if there's any other module calls page_keyid(), this patch is
required.

Thanks,
-Kai
> 
> Thanks,
> -Kai
>
diff mbox series

Patch

diff --git a/mm/page_ext.c b/mm/page_ext.c
index 1af8b82087f2..91e4e87f6e41 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -142,6 +142,7 @@  struct page_ext *lookup_page_ext(const struct page *page)
 					MAX_ORDER_NR_PAGES);
 	return get_entry(base, index);
 }
+EXPORT_SYMBOL_GPL(lookup_page_ext);
 
 static int __init alloc_node_page_ext(int nid)
 {
@@ -212,6 +213,7 @@  struct page_ext *lookup_page_ext(const struct page *page)
 		return NULL;
 	return get_entry(section->page_ext, pfn);
 }
+EXPORT_SYMBOL_GPL(lookup_page_ext);
 
 static void *__meminit alloc_page_ext(size_t size, int nid)
 {