diff mbox series

[v29,10/17] memory: Set DIRTY_MEMORY_MIGRATION when IOMMU is enabled

Message ID 1603704987-20977-11-git-send-email-kwankhede@nvidia.com (mailing list archive)
State New, archived
Headers show
Series Add migration support for VFIO devices | expand

Commit Message

Kirti Wankhede Oct. 26, 2020, 9:36 a.m. UTC
mr->ram_block is NULL when mr->is_iommu is true, then fr.dirty_log_mask
wasn't set correctly due to which memory listener's log_sync doesn't
get called.
This patch returns log_mask with DIRTY_MEMORY_MIGRATION set when
IOMMU is enabled.

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Yan Zhao <yan.y.zhao@intel.com>
---
 softmmu/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Williamson Oct. 26, 2020, 4:47 p.m. UTC | #1
Paolo,

Any objection to this change?  Thanks,

Alex

On Mon, 26 Oct 2020 15:06:20 +0530
Kirti Wankhede <kwankhede@nvidia.com> wrote:

> mr->ram_block is NULL when mr->is_iommu is true, then fr.dirty_log_mask
> wasn't set correctly due to which memory listener's log_sync doesn't
> get called.
> This patch returns log_mask with DIRTY_MEMORY_MIGRATION set when
> IOMMU is enabled.
> 
> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> Reviewed-by: Yan Zhao <yan.y.zhao@intel.com>
> ---
>  softmmu/memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/softmmu/memory.c b/softmmu/memory.c
> index 403ff3abc99b..94f606e9d9d9 100644
> --- a/softmmu/memory.c
> +++ b/softmmu/memory.c
> @@ -1792,7 +1792,7 @@ bool memory_region_is_ram_device(MemoryRegion *mr)
>  uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr)
>  {
>      uint8_t mask = mr->dirty_log_mask;
> -    if (global_dirty_log && mr->ram_block) {
> +    if (global_dirty_log && (mr->ram_block || memory_region_is_iommu(mr))) {
>          mask |= (1 << DIRTY_MEMORY_MIGRATION);
>      }
>      return mask;
Paolo Bonzini Oct. 26, 2020, 4:58 p.m. UTC | #2
On 26/10/20 17:47, Alex Williamson wrote:
> Paolo,
> 
> Any objection to this change?  Thanks,

Not at all.  Sorry I missed this change.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

> Alex
> 
> On Mon, 26 Oct 2020 15:06:20 +0530
> Kirti Wankhede <kwankhede@nvidia.com> wrote:
> 
>> mr->ram_block is NULL when mr->is_iommu is true, then fr.dirty_log_mask
>> wasn't set correctly due to which memory listener's log_sync doesn't
>> get called.
>> This patch returns log_mask with DIRTY_MEMORY_MIGRATION set when
>> IOMMU is enabled.
>>
>> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
>> Reviewed-by: Yan Zhao <yan.y.zhao@intel.com>
>> ---
>>  softmmu/memory.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/softmmu/memory.c b/softmmu/memory.c
>> index 403ff3abc99b..94f606e9d9d9 100644
>> --- a/softmmu/memory.c
>> +++ b/softmmu/memory.c
>> @@ -1792,7 +1792,7 @@ bool memory_region_is_ram_device(MemoryRegion *mr)
>>  uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr)
>>  {
>>      uint8_t mask = mr->dirty_log_mask;
>> -    if (global_dirty_log && mr->ram_block) {
>> +    if (global_dirty_log && (mr->ram_block || memory_region_is_iommu(mr))) {
>>          mask |= (1 << DIRTY_MEMORY_MIGRATION);
>>      }
>>      return mask;
>
diff mbox series

Patch

diff --git a/softmmu/memory.c b/softmmu/memory.c
index 403ff3abc99b..94f606e9d9d9 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -1792,7 +1792,7 @@  bool memory_region_is_ram_device(MemoryRegion *mr)
 uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr)
 {
     uint8_t mask = mr->dirty_log_mask;
-    if (global_dirty_log && mr->ram_block) {
+    if (global_dirty_log && (mr->ram_block || memory_region_is_iommu(mr))) {
         mask |= (1 << DIRTY_MEMORY_MIGRATION);
     }
     return mask;