From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by dpdk.org (Postfix) with ESMTP id 0C73711C5 for ; Mon, 6 Jul 2015 21:19:23 +0200 (CEST) Received: by pddu5 with SMTP id u5so23371190pdd.3 for ; Mon, 06 Jul 2015 12:19:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=xJRawLO9oKDQCQRtv1daC6kY8etgL2ZVdyFSmv8U/4w=; b=KK6CvnBWTh/h5piLEhEwSKdL0av8PKkhY455L+uRMQocNAoL0D0pm6e5pXVZ+KMpb/ 3f9FvIGfysdA/H+kCKYtXnZmkmYCs0/t7uj0U/tfAA/d9exgoI186HvEPXXEa05oh8VD OS9Nrh5RUnLeZ0i8s1WuRYPwy7Qb/lRQLSuJnn2NKiUOcduZSV891cyhHwLiiyUJNyIi rKERVnMrFrlXyjq9zgYsdhZcEioJ38KtSRcc6wqpLFGb/CvdUH8MutGQJDvuwFp1iorg 4M74srtn3cpCDIIMIu7zCWq4+Rxml5KcQxr2nQBaN8w0tqvsL5n1Db0IHP1xUTPRYfvu 1VgA== X-Gm-Message-State: ALoCoQmSlq6gECnxsGaG85klhKEzwber2nX4wfdmQ1xXt5rCI/mtIiuIza1GGBEEv1hQoDK22l6w X-Received: by 10.70.94.98 with SMTP id db2mr825621pdb.130.1436210362250; Mon, 06 Jul 2015 12:19:22 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id xs13sm19243625pac.3.2015.07.06.12.19.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 12:19:21 -0700 (PDT) Date: Mon, 6 Jul 2015 12:19:30 -0700 From: Stephen Hemminger To: leeopop Message-ID: <20150706121930.1ca9a56e@urahara> In-Reply-To: <1436189297-7780-2-git-send-email-dlrmsghd@gmail.com> References: <1436189297-7780-1-git-send-email-dlrmsghd@gmail.com> <1436189297-7780-2-git-send-email-dlrmsghd@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/2] eal/persistent: new library to hold memory region after program exit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jul 2015 19:19:23 -0000 Am I right, this library is using Unix shared memory to get persistent storage. That is going to be slower and more worrying, the kernel makes no guarantees that virtual to physical mapping will not change. There is also an ABI issue in this patch. You are introducing a new API here, so the symbol should go in a new 2.1 section > + if((len / RTE_PGSIZE_4K) > 1) > + { > + shmget_flag |= SHM_HUGETLB; > + } Please follow kernel coding style. This is one of many examples that needs to be fixed before accepting. ERROR: "foo* bar" should be "foo *bar" #166: FILE: lib/librte_eal/common/include/rte_pci.h:210: + void* priv; /**< Private data. */ ERROR: "foo* bar" should be "foo *bar" #195: FILE: lib/librte_eal/common/include/rte_persistent_mem.h:20: +extern void* persistent_allocated_memory[RTE_MAX_NUMA_NODES][RTE_EAL_PERSISTENT_MEM_COUNT]; ERROR: "foo* bar" should be "foo *bar" #302: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:44: +static void* reserve_shared_zone(int subindex, uint32_t len, int socket_id) ERROR: do not use C99 // comments #307: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:49: + int shmget_flag = IPC_CREAT | SHM_R | SHM_W | IPC_EXCL; // | SHM_LOCKED; WARNING: Missing a blank line after declarations #310: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:52: + int err; + if((len / RTE_PGSIZE_4K) > 1) ERROR: that open brace { should be on the previous line #310: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:52: + if((len / RTE_PGSIZE_4K) > 1) + { ERROR: space required before the open parenthesis '(' #310: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:52: + if((len / RTE_PGSIZE_4K) > 1) ERROR: "foo* bar" should be "foo *bar" #316: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:58: + void* addr = 0; WARNING: Missing a blank line after declarations #318: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:60: + int clear = 1; + if(shmid < 0) ERROR: that open brace { should be on the previous line #318: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:60: + if(shmid < 0) + { ERROR: space required before the open parenthesis '(' #318: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:60: + if(shmid < 0) ERROR: do not use C99 // comments #320: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:62: + //Reuse existing ERROR: that open brace { should be on the previous line #328: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:70: + if(socket_id != SOCKET_ID_ANY) + { ERROR: space required before the open parenthesis '(' #328: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:70: + if(socket_id != SOCKET_ID_ANY) ERROR: "foo * bar" should be "foo *bar" #330: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:72: + struct bitmask * mask = numa_bitmask_alloc(RTE_MAX_NUMA_NODES); WARNING: Missing a blank line after declarations #331: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:73: + struct bitmask * mask = numa_bitmask_alloc(RTE_MAX_NUMA_NODES); + mask = numa_bitmask_clearall(mask); ERROR: that open brace { should be on the previous line #336: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:78: + if(ret < 0) + { ERROR: space required before the open parenthesis '(' #336: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:78: + if(ret < 0) ERROR: that open brace { should be on the previous line #344: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:86: + if(clear) + { ERROR: space required before the open parenthesis '(' #344: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:86: + if(clear) WARNING: Missing a blank line after declarations #350: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:92: + size_t size; + volatile uint8_t reader = 0; //this prevents from being optimized out ERROR: do not use C99 // comments #350: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:92: + volatile uint8_t reader = 0; //this prevents from being optimized out WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #350: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:92: + volatile uint8_t reader = 0; //this prevents from being optimized out ERROR: "(foo*)" should be "(foo *)" #351: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:93: + volatile uint8_t* readp = (uint8_t*)addr; ERROR: "foo* bar" should be "foo *bar" #351: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:93: + volatile uint8_t* readp = (uint8_t*)addr; WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #351: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:93: + volatile uint8_t* readp = (uint8_t*)addr; WARNING: Missing a blank line after declarations #352: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:94: + volatile uint8_t* readp = (uint8_t*)addr; + for(size = 0; size < len; size++) ERROR: that open brace { should be on the previous line #352: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:94: + for(size = 0; size < len; size++) + { ERROR: space required before the open parenthesis '(' #352: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:94: + for(size = 0; size < len; size++) ERROR: "foo* bar" should be "foo *bar" #364: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:106: +void* persistent_allocated_memory[RTE_MAX_NUMA_NODES][SHM_COUNT]; ERROR: do not initialise statics to 0 or NULL #366: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:108: +static int numa_count = 0; ERROR: do not use C99 // comments #375: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:117: + assert(SHM_SIZE == RTE_PGSIZE_2M); //XXX considering only 2MB pages. WARNING: Missing a blank line after declarations #377: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:119: + int num_numa = numa_num_configured_nodes(); + if(num_numa == 0) ERROR: space required before the open parenthesis '(' #377: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:119: + if(num_numa == 0) WARNING: Missing a blank line after declarations #382: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:124: + int k; + for(node = 0; node < RTE_MAX_NUMA_NODES; node++) ERROR: space required before the open parenthesis '(' #382: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:124: + for(node = 0; node < RTE_MAX_NUMA_NODES; node++) ERROR: spaces required around that '=' (ctx:VxV) #383: FILE: lib/librte_eal/linuxapp/eal/eal_persistent_mem.c:125: + for(k=0; k 1 ? node : SOCKET_ID_ANY; + for(k=0; k= 0); ERROR: "foo* bar" should be "foo *bar" #639: FILE: lib/librte_persistent/rte_persistent.c:132: + void* user = found_buffer; WARNING: Missing a blank line after declarations #642: FILE: lib/librte_persistent/rte_persistent.c:135: + size_t diff = RTE_MAX((uint64_t)user, hw) - RTE_MIN((uint64_t)user, hw); + for(j = 0; j < num_page; j++) ERROR: that open brace { should be on the previous line #642: FILE: lib/librte_persistent/rte_persistent.c:135: + for(j = 0; j < num_page; j++) + { ERROR: space required before the open parenthesis '(' #642: FILE: lib/librte_persistent/rte_persistent.c:135: + for(j = 0; j < num_page; j++) ERROR: "(foo*)" should be "(foo *)" #645: FILE: lib/librte_persistent/rte_persistent.c:138: + void* cur_user = ((char*)user + shift); ERROR: "foo* bar" should be "foo *bar" #645: FILE: lib/librte_persistent/rte_persistent.c:138: + void* cur_user = ((char*)user + shift); WARNING: line over 120 characters #647: FILE: lib/librte_persistent/rte_persistent.c:140: + size_t cur_diff = RTE_MAX((uint64_t)cur_user, cur_hw) - RTE_MIN((uint64_t)cur_user, cur_hw); ERROR: that open brace { should be on the previous line #649: FILE: lib/librte_persistent/rte_persistent.c:142: + if(cur_diff != diff) + { ERROR: space required before the open parenthesis '(' #649: FILE: lib/librte_persistent/rte_persistent.c:142: + if(cur_diff != diff) WARNING: line over 120 characters #651: FILE: lib/librte_persistent/rte_persistent.c:144: + RTE_LOG(ERR, EAL, "Hugepage is not contiguous, curdiff: %lX, expected: %lX\n", cur_diff, diff); ERROR: space required before the open parenthesis '(' #658: FILE: lib/librte_persistent/rte_persistent.c:151: + if(!found_buffer) ERROR: "foo* bar" should be "foo *bar" #663: FILE: lib/librte_persistent/rte_persistent.c:156: +phys_addr_t rte_persistent_hw_addr(const void* addr) ERROR: space required before the open parenthesis '(' #665: FILE: lib/librte_persistent/rte_persistent.c:158: + if(addr == 0) ERROR: "(foo*)" should be "(foo *)" #667: FILE: lib/librte_persistent/rte_persistent.c:160: + int index = rte_hash_lookup(allocated_segments, (const void*)&addr); WARNING: Missing a blank line after declarations #668: FILE: lib/librte_persistent/rte_persistent.c:161: + int index = rte_hash_lookup(allocated_segments, (const void*)&addr); + assert(index >= 0); ERROR: "foo* bar" should be "foo *bar" #674: FILE: lib/librte_persistent/rte_persistent.c:167: +size_t rte_persistent_mem_length(const void* addr) ERROR: "(foo*)" should be "(foo *)" #676: FILE: lib/librte_persistent/rte_persistent.c:169: + int index = rte_hash_lookup(allocated_segments, (const void*)&addr); WARNING: Missing a blank line after declarations #677: FILE: lib/librte_persistent/rte_persistent.c:170: + int index = rte_hash_lookup(allocated_segments, (const void*)&addr); + assert(index >= 0); ERROR: "foo* bar" should be "foo *bar" #683: FILE: lib/librte_persistent/rte_persistent.c:176: +void rte_persistent_free(void* addr) ERROR: "(foo*)" should be "(foo *)" #685: FILE: lib/librte_persistent/rte_persistent.c:178: + int index = rte_hash_lookup(allocated_segments, (const void*)&addr); WARNING: Missing a blank line after declarations #686: FILE: lib/librte_persistent/rte_persistent.c:179: + int index = rte_hash_lookup(allocated_segments, (const void*)&addr); + assert(index >= 0); ERROR: "(foo*)" should be "(foo *)" #700: FILE: lib/librte_persistent/rte_persistent.c:193: + rte_hash_del_key(allocated_segments, (const void*)&addr); WARNING: Missing a blank line after declarations #703: FILE: lib/librte_persistent/rte_persistent.c:196: + int k; + for(k=0; k