* [PATCH] mm: HMM always needs MMU_NOTIFIER
@ 2017-08-24 23:08 Arnd Bergmann
2017-08-25 0:42 ` [PATCH] mm/hmm: struct hmm is only use by HMM mirror functionality jglisse
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-08-24 23:08 UTC (permalink / raw)
To: Jérôme Glisse
Cc: Arnd Bergmann, Andrew Morton, Stephen Rothwell, Subhash Gutti,
Evgeny Baskakov, linux-mm, linux-kernel
When building a kernel with HMM enabled but without MMU_NOTIFIER,
we run into a build error:
mm/hmm.c:66:22: error: field 'mmu_notifier' has incomplete type
struct mmu_notifier mmu_notifier;
If I read this right, the dependency is correct, but the #ifdef
annotations in the mm/hmm.c are not. This changes them in
a way to make it all build cleanly.
Fixes: e4e0061ea15c ("mm/device-public-memory: device memory cache coherent with CPU")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I did not try very hard to understand what the code is
supposed to do, please check if this makes sense beyond fixing
the build before applying.
---
mm/hmm.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/mm/hmm.c b/mm/hmm.c
index 4a179a16ab10..b9e9f14e7454 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -41,11 +41,16 @@
*/
DEFINE_STATIC_KEY_FALSE(device_private_key);
EXPORT_SYMBOL(device_private_key);
-static const struct mmu_notifier_ops hmm_mmu_notifier_ops;
#endif /* CONFIG_DEVICE_PRIVATE || CONFIG_DEVICE_PUBLIC */
+void hmm_mm_destroy(struct mm_struct *mm)
+{
+ kfree(mm->hmm);
+}
+
+#if IS_ENABLED(CONFIG_HMM_MIRROR)
+static const struct mmu_notifier_ops hmm_mmu_notifier_ops;
-#ifdef CONFIG_HMM
/*
* struct hmm - HMM per mm struct
*
@@ -124,13 +129,6 @@ static struct hmm *hmm_register(struct mm_struct *mm)
return mm->hmm;
}
-void hmm_mm_destroy(struct mm_struct *mm)
-{
- kfree(mm->hmm);
-}
-#endif /* CONFIG_HMM */
-
-#if IS_ENABLED(CONFIG_HMM_MIRROR)
static void hmm_invalidate_range(struct hmm *hmm,
enum hmm_update_type action,
unsigned long start,
--
2.9.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] mm/hmm: struct hmm is only use by HMM mirror functionality
2017-08-24 23:08 [PATCH] mm: HMM always needs MMU_NOTIFIER Arnd Bergmann
@ 2017-08-25 0:42 ` jglisse
2017-08-25 20:01 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: jglisse @ 2017-08-25 0:42 UTC (permalink / raw)
To: linux-mm
Cc: linux-kernel, Jérôme Glisse, Arnd Bergmann,
Andrew Morton, Stephen Rothwell, Subhash Gutti, Evgeny Baskakov
From: JA(C)rA'me Glisse <jglisse@redhat.com>
The struct hmm is only use if the HMM mirror functionality is enabled
move associated code behind CONFIG_HMM_MIRROR to avoid build error if
one enable some of the HMM memory configuration without the mirror
feature.
Signed-off-by: JA(C)rA'me Glisse <jglisse@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
Cc: Subhash Gutti <sgutti@nvidia.com>,
Cc: Evgeny Baskakov <ebaskakov@nvidia.com>
---
include/linux/hmm.h | 7 +++----
mm/hmm.c | 4 +---
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/include/linux/hmm.h b/include/linux/hmm.h
index 5866f31..b4355d7 100644
--- a/include/linux/hmm.h
+++ b/include/linux/hmm.h
@@ -499,7 +499,7 @@ struct hmm_device *hmm_device_new(void *drvdata);
void hmm_device_put(struct hmm_device *hmm_device);
#endif /* CONFIG_DEVICE_PRIVATE || CONFIG_DEVICE_PUBLIC */
-
+#if IS_ENABLED(CONFIG_HMM_MIRROR)
/* Below are for HMM internal use only! Not to be used by device driver! */
void hmm_mm_destroy(struct mm_struct *mm);
@@ -507,12 +507,11 @@ static inline void hmm_mm_init(struct mm_struct *mm)
{
mm->hmm = NULL;
}
-
-#else /* IS_ENABLED(CONFIG_HMM) */
-
+#else /* IS_ENABLED(CONFIG_HMM_MIRROR) */
/* Below are for HMM internal use only! Not to be used by device driver! */
static inline void hmm_mm_destroy(struct mm_struct *mm) {}
static inline void hmm_mm_init(struct mm_struct *mm) {}
+#endif /* IS_ENABLED(CONFIG_HMM_MIRROR) */
#endif /* IS_ENABLED(CONFIG_HMM) */
#endif /* LINUX_HMM_H */
diff --git a/mm/hmm.c b/mm/hmm.c
index 3faa4d4..7e4f42b 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -43,7 +43,7 @@ DEFINE_STATIC_KEY_FALSE(device_private_key);
EXPORT_SYMBOL(device_private_key);
-#ifdef CONFIG_HMM
+#if IS_ENABLED(CONFIG_HMM_MIRROR)
static const struct mmu_notifier_ops hmm_mmu_notifier_ops;
/*
@@ -128,9 +128,7 @@ void hmm_mm_destroy(struct mm_struct *mm)
{
kfree(mm->hmm);
}
-#endif /* CONFIG_HMM */
-#if IS_ENABLED(CONFIG_HMM_MIRROR)
static void hmm_invalidate_range(struct hmm *hmm,
enum hmm_update_type action,
unsigned long start,
--
2.7.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/hmm: struct hmm is only use by HMM mirror functionality
2017-08-25 0:42 ` [PATCH] mm/hmm: struct hmm is only use by HMM mirror functionality jglisse
@ 2017-08-25 20:01 ` Andrew Morton
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2017-08-25 20:01 UTC (permalink / raw)
To: jglisse
Cc: linux-mm, linux-kernel, Arnd Bergmann, Stephen Rothwell,
Subhash Gutti, Evgeny Baskakov
On Thu, 24 Aug 2017 20:42:26 -0400 jglisse@redhat.com wrote:
> The struct hmm is only use if the HMM mirror functionality is enabled
> move associated code behind CONFIG_HMM_MIRROR to avoid build error if
> one enable some of the HMM memory configuration without the mirror
> feature.
It's unclear whether this patch is in addition to Arnd's "mm: HMM always
needs MMU_NOTIFIER" or is a replacement for it. (If the latter, it
should have Arnd's Reported-by). But I cannot get this patch to apply
cleanly in either situation.
So I'll skip both patches. Please send something which applies on top
of
hmm-heterogeneous-memory-management-documentation-v3.patch
mm-hmm-heterogeneous-memory-management-hmm-for-short-v5.patch
mm-hmm-mirror-mirror-process-address-space-on-device-with-hmm-helpers-v3.patch
mm-hmm-mirror-helper-to-snapshot-cpu-page-table-v4.patch
mm-hmm-mirror-device-page-fault-handler.patch
mm-memory_hotplug-introduce-add_pages.patch
mm-zone_device-new-type-of-zone_device-for-unaddressable-memory-v5.patch
mm-zone_device-new-type-of-zone_device-for-unaddressable-memory-fix.patch
mm-zone_device-special-case-put_page-for-device-private-pages-v4.patch
mm-memcontrol-allow-to-uncharge-page-without-using-page-lru-field.patch
mm-memcontrol-support-memory_device_private-v4.patch
mm-hmm-devmem-device-memory-hotplug-using-zone_device-v7.patch
mm-hmm-devmem-dummy-hmm-device-for-zone_device-memory-v3.patch
mm-migrate-new-migrate-mode-migrate_sync_no_copy.patch
mm-migrate-new-memory-migration-helper-for-use-with-device-memory-v5.patch
mm-migrate-migrate_vma-unmap-page-from-vma-while-collecting-pages.patch
mm-migrate-support-un-addressable-zone_device-page-in-migration-v3.patch
mm-migrate-allow-migrate_vma-to-alloc-new-page-on-empty-entry-v4.patch
mm-device-public-memory-device-memory-cache-coherent-with-cpu-v5.patch
mm-hmm-add-new-helper-to-hotplug-cdm-memory-region-v3.patch
#
mm-hmm-avoid-bloating-arch-that-do-not-make-use-of-hmm.patch
thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-25 20:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24 23:08 [PATCH] mm: HMM always needs MMU_NOTIFIER Arnd Bergmann
2017-08-25 0:42 ` [PATCH] mm/hmm: struct hmm is only use by HMM mirror functionality jglisse
2017-08-25 20:01 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).