As described in armv8 reference manual, DBM means " Dirty Bit Modifier".
My understanding is:
If DBM =1, it means that the page or block is dirty.
If DBM =0, it means the page or block is not dirty.
Is that rignt?
When mapping in a "clean" write-able page the OS would set the attributes to AP="read-only" and DBM==1. On the first write, the hardware automatically updates AP from "read-only" to "read-write".
DBM is therefore telling the processor how to understand the AP bits.
Note: If you tried to write a page with AP="read-only" and DBM==0, then you'd get an abort.
For software, you can tell whether the page is dirty or clean by looking at the AP bits. Still "read-only" = clean, while "read-write" means its been written to.
If DBM == 1，software can use the method you mentioned above to distinguish dirty or not.
what if DBM ==0?
And if AP ="read-write" and DBM ==0, Will CPU still get an abort when trying to write this page?
"When the hardware management of dirty state is enabled, if the Block or Page descriptor in a translation table indicates that a data access does not have write permission, then in situations where, without this feature, a data access would generate a Permission fault only because of this lack of write permission, the hardware checks the value of the DBM field in the Block or Page descriptor. If this field is 1, then instead of generating a Permission fault, the hardware performs an atomic read-modify-write of the translation table descriptor, to change the value of the bit that prohibits the write access."
Anyway: If the "AP" is read-write, there is no abort on write.