diff for duplicates of <577FC5AA.5010709@huawei.com> diff --git a/a/1.txt b/N1/1.txt index 54e6eae..0dbe332 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -84,107 +84,4 @@ Both cases worked well with this patch. > > Thanks. -> --------------- next part -------------- -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/mman.h> -#include <sys/stat.h> - -#define FILENAME "/mnt/huge/test_file" -#define TST_MMAP_SIZE 0x200000 - -typedef unsigned int (*TEST_FUNC_T)(void); - -/* - * mkdir -p /mnt/huge - * echo 20 > /proc/sys/vm/nr_hugepages - * mount none /mnt/huge -t hugetlbfs -o pagesize=2048K - */ -int main(void) -{ - int i; - int fd; - int ret; - void *share_mem; - size_t size; - struct stat sb; - TEST_FUNC_T func_ptr; - unsigned int value, total; - unsigned int *ptr; - - fd = open(FILENAME, O_RDWR | O_CREAT); - if (fd == -1) { - printf("Open file %s failed P1: %s\n", FILENAME, strerror(errno)); - return 1; - } - - lseek(fd, TST_MMAP_SIZE - 1, SEEK_SET); - write(fd, "", 1); - - share_mem = mmap(NULL, TST_MMAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (share_mem == MAP_FAILED) { - printf("Call mmap failed P1: %s\n", strerror(errno)); - exit(1); - } - - close(fd); - - srand(time(NULL)); - ptr = (unsigned int *)share_mem; - *ptr++ = 0xd2800000; //mov x0, #0 - for (i = 0, total = 0; i < 100; i++) { - value = 0xfff & rand(); - total += value; - *ptr++ = 0xb1000000 | (value << 10); //adds x0, x0, #value - } - *ptr = 0xd65f03c0; //ret - - //__clear_cache((char *)share_mem, (char *)share_mem + 0x200); - - ret = msync(share_mem, TST_MMAP_SIZE, MS_SYNC); - if (ret) { - printf("Call msync failed: %s\n", strerror(errno)); - exit(1); - } - - ret = munmap(share_mem, TST_MMAP_SIZE); - if (ret) { - printf("Call munmap failed P1: %s\n", strerror(errno)); - exit(1); - } - - fd = open(FILENAME, S_IXUSR); - if (fd == -1) { - printf("Open file %s failed P2: %s\n", FILENAME, strerror(errno)); - return 1; - } - - if (fstat(fd, &sb) == -1) { - printf("Call fstat failed: %s\n", strerror(errno)); - exit(1); - } - size = sb.st_size; - - func_ptr = (TEST_FUNC_T)mmap(NULL, size, PROT_EXEC, MAP_SHARED, fd, 0); - if (func_ptr == MAP_FAILED) { - printf("Call mmap failed P2: %s\n", strerror(errno)); - exit(1); - } - - close(fd); - - value = func_ptr(); - printf("Test is %s: The result is 0x%x, expect = 0x%x\n", (value == total) ? "Passed" : "Failed", value, total); - - ret = munmap(share_mem, TST_MMAP_SIZE); - if (ret) { - printf("Call munmap failed P2: %s\n", strerror(errno)); - exit(1); - } - - return 0; -} +> diff --git a/N1/2.hdr b/N1/2.hdr new file mode 100644 index 0000000..f573ce4 --- /dev/null +++ b/N1/2.hdr @@ -0,0 +1,3 @@ +Content-Type: text/plain; charset="UTF-8"; name="tst_mmap.c" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename="tst_mmap.c" diff --git a/N1/2.txt b/N1/2.txt new file mode 100644 index 0000000..1b838c8 --- /dev/null +++ b/N1/2.txt @@ -0,0 +1,102 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/mman.h> +#include <sys/stat.h> + +#define FILENAME "/mnt/huge/test_file" +#define TST_MMAP_SIZE 0x200000 + +typedef unsigned int (*TEST_FUNC_T)(void); + +/* + * mkdir -p /mnt/huge + * echo 20 > /proc/sys/vm/nr_hugepages + * mount none /mnt/huge -t hugetlbfs -o pagesize=2048K + */ +int main(void) +{ + int i; + int fd; + int ret; + void *share_mem; + size_t size; + struct stat sb; + TEST_FUNC_T func_ptr; + unsigned int value, total; + unsigned int *ptr; + + fd = open(FILENAME, O_RDWR | O_CREAT); + if (fd == -1) { + printf("Open file %s failed P1: %s\n", FILENAME, strerror(errno)); + return 1; + } + + lseek(fd, TST_MMAP_SIZE - 1, SEEK_SET); + write(fd, "", 1); + + share_mem = mmap(NULL, TST_MMAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (share_mem == MAP_FAILED) { + printf("Call mmap failed P1: %s\n", strerror(errno)); + exit(1); + } + + close(fd); + + srand(time(NULL)); + ptr = (unsigned int *)share_mem; + *ptr++ = 0xd2800000; //mov x0, #0 + for (i = 0, total = 0; i < 100; i++) { + value = 0xfff & rand(); + total += value; + *ptr++ = 0xb1000000 | (value << 10); //adds x0, x0, #value + } + *ptr = 0xd65f03c0; //ret + + //__clear_cache((char *)share_mem, (char *)share_mem + 0x200); + + ret = msync(share_mem, TST_MMAP_SIZE, MS_SYNC); + if (ret) { + printf("Call msync failed: %s\n", strerror(errno)); + exit(1); + } + + ret = munmap(share_mem, TST_MMAP_SIZE); + if (ret) { + printf("Call munmap failed P1: %s\n", strerror(errno)); + exit(1); + } + + fd = open(FILENAME, S_IXUSR); + if (fd == -1) { + printf("Open file %s failed P2: %s\n", FILENAME, strerror(errno)); + return 1; + } + + if (fstat(fd, &sb) == -1) { + printf("Call fstat failed: %s\n", strerror(errno)); + exit(1); + } + size = sb.st_size; + + func_ptr = (TEST_FUNC_T)mmap(NULL, size, PROT_EXEC, MAP_SHARED, fd, 0); + if (func_ptr == MAP_FAILED) { + printf("Call mmap failed P2: %s\n", strerror(errno)); + exit(1); + } + + close(fd); + + value = func_ptr(); + printf("Test is %s: The result is 0x%x, expect = 0x%x\n", (value == total) ? "Passed" : "Failed", value, total); + + ret = munmap(share_mem, TST_MMAP_SIZE); + if (ret) { + printf("Call munmap failed P2: %s\n", strerror(errno)); + exit(1); + } + + return 0; +} diff --git a/a/content_digest b/N1/content_digest index 79f8bdb..71c57f4 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -2,11 +2,20 @@ "ref\020160707153741.GC27180@e104818-lin.cambridge.arm.com\0" "ref\0577F1FD9.1040205@huawei.com\0" "ref\020160708135447.GB22099@e104818-lin.cambridge.arm.com\0" - "From\0thunder.leizhen@huawei.com (Leizhen (ThunderTown))\0" - "Subject\0[PATCH 1/1] arm64/hugetlb: clear PG_dcache_clean if the page is dirty when munmap\0" + "From\0Leizhen (ThunderTown) <thunder.leizhen@huawei.com>\0" + "Subject\0Re: [PATCH 1/1] arm64/hugetlb: clear PG_dcache_clean if the page is dirty when munmap\0" "Date\0Fri, 8 Jul 2016 23:24:26 +0800\0" - "To\0linux-arm-kernel@lists.infradead.org\0" - "\00:1\0" + "To\0Catalin Marinas <catalin.marinas@arm.com>\0" + "Cc\0Steve Capper <Steve.Capper@arm.com>" + David Woods <dwoods@ezchip.com> + Tianhong Ding <dingtianhong@huawei.com> + Will Deacon <will.deacon@arm.com> + linux-kernel <linux-kernel@vger.kernel.org> + Xinwei Hu <huxinwei@huawei.com> + Zefan Li <lizefan@huawei.com> + Hanjun Guo <guohanjun@huawei.com> + " linux-arm-kernel <linux-arm-kernel@lists.infradead.org>\0" + "\01:1\0" "b\0" "\n" "\n" @@ -94,8 +103,10 @@ "\n" "> \n" "> Thanks.\n" - "> \n" - "-------------- next part --------------\n" + > + "\01:2\0" + "fn\0tst_mmap.c\0" + "b\0" "#include <stdio.h>\n" "#include <stdlib.h>\n" "#include <string.h>\n" @@ -199,4 +210,4 @@ "\treturn 0;\n" } -c22c7ffef0ab49fb103668e4848e85b619f34964ad1ac2a000c007ef1deb772b +0a21df73768cf3580b0b08216dff22e33ffb053f4d562f8bf3b73fb5ccc38da2
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.