Hello,
I'm Junghan, a graduate student in South Korea.
I'm currently doing study on NVDIMM software stack in Linux Kernel.
There is a block driver called PMEM (driver/nvdimm/pmem.c), it look likes Ramdisk.
I am verifying DRAM to NVM copy operation and its performance.
First, I want to check the amount of data difference using XOR operation during BIO operation.
Strangely, there are a lot of block with the same SRC (mem) and DST(pmem_addr). (below: code examples)
I think that simple 8 byte XOR operation code has a problem or this is because of DRAM emulation..
I still couldn't figure out why this is happening.
Please give me some advice.
- Linux Kernel 4.13
- NVDIMM : DRAM Emulation (link)
Thanks ..
/driver/nvdimm/pmem.c
static blk_status_t pmem_do_bvec(struct pmem_device *pmem, struct page *page,
unsigned int len, unsigned int off, bool is_write,
sector_t sector)
{
void *mem = kmap_atomic(page);
phys_addr_t pmem_off = sector * 512 + pmem->data_offset;
void *pmem_addr = pmem->virt_addr + pmem_off;
long long int *src = mem; /*8 byte*/
long long int *dst = pmem_addr;
....
if(write) {
for (i=0; i<(PAGE_SIZE / 8);i++){
if ((src[i] ^ dst[i]) == 0){ /* 8 Byte XOR, 8 * 512 = 4096, PAGE_SIZE */
diff_count--;
}
}
if (diff_count == 0) {
// SRC and DST are Same block
pr_warn("[%d] SAME Block: Write Count, %u\n", idx, binfo->writecount);
}
}
....
}