On Thu, 2024-03-21 at 19:09 +0000, Matthew Brost wrote: > > > Can we simplify this too? > > if (vm && (vm->batch_invalidate_tlb || (vm->tlb_flush_seqno > != q->tlb_flush_seqno))) { > q->tlb_flush_seqno = vm->tlb_flush_seqno; > job->ring_ops_flush_tlb = true; > } > > I think this works as xe_sched_job_is_migration has > emit_migration_job_gen12 which doesn't look at job- > >ring_ops_flush_tlb, > so no need to xe_sched_job_is_migration. > > Also no need to check xe_vm_in_lr_mode as we wouldn'y increment the > seqno above if that true. > > Lastly, harmless to increment q->tlb_flush_seqno in the case of > batch_invalidate_tlb being true. I think I can simplify it a bit. Problem is that neither the migration vm nor lr mode grabs the vm->resv at arm time so we would access the seqnos unlocked and potentially get caught by clever static analyzers. I actually had an assert for that at one point. I should probably re- add it. /Thomas