From nobody Fri Apr 26 18:16:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1568172808; cv=none; d=zoho.com; s=zohoarc; b=Wm8VOt8k8yV+AM+W/quNgTCn5/sQ29VHTUc5QqnG+1wixeLViZMIA4WxHjlQnI0G0v8OWN3u7doj34TijWC392TUoG1NrCtt2MhdMnKskoexlAKq8/bi0ZlJApTWeOrYkeCShVlNQLHkJUQ1mk4PH34yieQ6/ZjcbAsnjyXSQMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568172808; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=k4xEn+t7vCoODCEBVm7XssFlOmLgeAstnTHc64rP2nA=; b=EvuTdCUUekYM631jlBHqM6zZWhsRUQZRO0Jl6JFe5sOiug7SKmJ7pIO6smJ/8qfDcC3G96dwsV6sToxxuVZzHPHSTXy8d5IT91I4CmtZSEummpVCWX5tldBCzkou7vMCwP1GGbMO6+krZT4bTrtwViLldZ205KtK7jVBMYO+z7Q= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568172808572711.9778187436013; Tue, 10 Sep 2019 20:33:28 -0700 (PDT) Received: from localhost ([::1]:46268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7tNl-0000Kt-Ck for importer@patchew.org; Tue, 10 Sep 2019 23:33:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42221) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7tM9-0007IU-0N for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7tM8-00040r-12 for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:44 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:4344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i7tM7-0003yP-F2 for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:43 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.1]) by rmmx-syy-dmz-app02-12002 (RichMail) with SMTP id 2ee25d786a81340-ebd09; Wed, 11 Sep 2019 11:31:14 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.148]) by rmsmtp-syy-appsvr01-12001 (RichMail) with SMTP id 2ee15d786a7b269-ac9a7; Wed, 11 Sep 2019 11:31:14 +0800 (CST) X-RM-TRANSID: 2ee25d786a81340-ebd09 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee15d786a7b269-ac9a7 From: Mao Zhongyi To: qemu-devel@nongnu.org Date: Wed, 11 Sep 2019 11:31:02 +0800 Message-Id: <9b8662b94d89030b1f33193246c645baac2eedd7.1568170994.git.maozhongyi@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 221.176.66.79 Subject: [Qemu-devel] [PATCH v2 1/3] tests/migration: mem leak fix X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tony.nguyen@bt.com, alex.bennee@linaro.org, armbru@redhat.com, Mao Zhongyi , laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" =E2=80=98data=E2=80=99 has the possibility of memory leaks=EF=BC=8C so use = the glic macros g_autofree recommended by CODING_STYLE.rst to automatically release the memory that returned from g_malloc(). Cc: armbru@redhat.com Cc: laurent@vivier.eu Cc: tony.nguyen@bt.com Cc: alex.bennee@linaro.org Signed-off-by: Mao Zhongyi Reviewed-by: Alex Benn=C3=A9e --- tests/migration/stress.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/migration/stress.c b/tests/migration/stress.c index d9aa4afe92..6cbb2d49d3 100644 --- a/tests/migration/stress.c +++ b/tests/migration/stress.c @@ -170,10 +170,10 @@ static unsigned long long now(void) static int stressone(unsigned long long ramsizeMB) { size_t pagesPerMB =3D 1024 * 1024 / PAGE_SIZE; - char *ram =3D malloc(ramsizeMB * 1024 * 1024); + g_autofree char *ram =3D malloc(ramsizeMB * 1024 * 1024); char *ramptr; size_t i, j, k; - char *data =3D malloc(PAGE_SIZE); + g_autofree char *data =3D malloc(PAGE_SIZE); char *dataptr; size_t nMB =3D 0; unsigned long long before, after; @@ -186,7 +186,6 @@ static int stressone(unsigned long long ramsizeMB) if (!data) { fprintf(stderr, "%s (%d): ERROR: cannot allocate %d bytes of RAM: = %s\n", argv0, gettid(), PAGE_SIZE, strerror(errno)); - free(ram); return -1; } =20 @@ -198,8 +197,6 @@ static int stressone(unsigned long long ramsizeMB) memset(ram, 0xfe, ramsizeMB * 1024 * 1024); =20 if (random_bytes(data, PAGE_SIZE) < 0) { - free(ram); - free(data); return -1; } =20 @@ -227,9 +224,6 @@ static int stressone(unsigned long long ramsizeMB) } } } - - free(data); - free(ram); } =20 =20 --=20 2.17.1 From nobody Fri Apr 26 18:16:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1568172785; cv=none; d=zoho.com; s=zohoarc; b=CBCnGAD298FdbvGblj6MsFWF5HqN0CychlwmyKDmlCjqlnprPBEjLo8Z5Pr/Dv5oSSGhojLhMvHSkeLwEIMgcjsJIWT/wkcgem7baKS8w1NZNP4AbspMR5J8tg1rj77HdpiHIRq7Wl6qFEKdAuD9yU32wCh/eDF3hr4LWtPx+tE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568172785; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=YdjYJ1WW/N0AmnDvQnPt0AvZqjSDEpaVjQTg0IoHoXE=; b=d3e3OV8XUJFTHuwPU7tUoWuD5RtY8oC5ZB66G4lMN9AMijIvdsc/I1J1zlWVXtZIRRQqBc7KuLwSqT9Jaxrj8ARd8sguFtJ9NAKOhJh+rrQ7RCaP3aRTGBWkWvaX+EIL68IcB4Ho5E0pQdUkObKDbix7W/+j4+hix5Nfg5hKWX8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568172783230521.5921507114207; Tue, 10 Sep 2019 20:33:03 -0700 (PDT) Received: from localhost ([::1]:46264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7tNL-0008Js-AQ for importer@patchew.org; Tue, 10 Sep 2019 23:32:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42185) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7tLx-00077K-1X for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7tLv-0003gW-QR for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:32 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:2079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i7tLv-0003ZP-7H for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:31 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.1]) by rmmx-syy-dmz-app03-12003 (RichMail) with SMTP id 2ee35d786a82010-eb73f; Wed, 11 Sep 2019 11:31:15 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.148]) by rmsmtp-syy-appsvr01-12001 (RichMail) with SMTP id 2ee15d786a7b269-ac9b4; Wed, 11 Sep 2019 11:31:15 +0800 (CST) X-RM-TRANSID: 2ee35d786a82010-eb73f X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee15d786a7b269-ac9b4 From: Mao Zhongyi To: qemu-devel@nongnu.org Date: Wed, 11 Sep 2019 11:31:03 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 221.176.66.79 Subject: [Qemu-devel] [PATCH v2 2/3] tests/migration: fix a typo in comment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tony.nguyen@bt.com, alex.bennee@linaro.org, armbru@redhat.com, Mao Zhongyi , laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Cc: armbru@redhat.com Cc: laurent@vivier.eu Cc: tony.nguyen@bt.com Signed-off-by: Mao Zhongyi Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/migration/stress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/migration/stress.c b/tests/migration/stress.c index 6cbb2d49d3..19a6eff5fd 100644 --- a/tests/migration/stress.c +++ b/tests/migration/stress.c @@ -191,7 +191,7 @@ static int stressone(unsigned long long ramsizeMB) =20 /* We don't care about initial state, but we do want * to fault it all into RAM, otherwise the first iter - * of the loop below will be quite slow. We cna't use + * of the loop below will be quite slow. We can't use * 0x0 as the byte as gcc optimizes that away into a * calloc instead :-) */ memset(ram, 0xfe, ramsizeMB * 1024 * 1024); --=20 2.17.1 From nobody Fri Apr 26 18:16:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1568172893; cv=none; d=zoho.com; s=zohoarc; b=QeZy5eqm4hmnUtYe0HHK2L3Ih8icl36lC98UWeMEPmgrLWZgzZ2C0kX6Nn1nt5wbd+spanvFIOsi8ulNxvPmZXx4zLLURgiVtauUoUvmHbmz0+JjTbEgKc3LuhiPbUwJiQwY8E/QLH3I6JRGzej8tO1yUc7DAx9j/OHz5EtIKjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568172893; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/R266gvKLX9Y+9JwfPD4ZmsyHC6MXnmD3EP0sW2BRWs=; b=hM/s9R/9xpdFsySjAkvsdxdchRxn8bpSGh3oF0jhmjzh+80xErKBQODgZxB9+GLdluK/rnmDrokxjP7bvDG7Mrs7wpn3Z4b/unzoc6dv7ZFiuQcQlLcZz+sEOohRe8ErwNMQSH7FTZYnfY0gd5fFR+/Gx9Vz5PzkebqgMg4TVBk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15681728937751014.0025917593144; Tue, 10 Sep 2019 20:34:53 -0700 (PDT) Received: from localhost ([::1]:46280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7tPA-00027T-MW for importer@patchew.org; Tue, 10 Sep 2019 23:34:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42184) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7tLx-00077J-1E for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7tLv-0003gR-QI for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:32 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:2080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i7tLv-0003ZO-79 for qemu-devel@nongnu.org; Tue, 10 Sep 2019 23:31:31 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.1]) by rmmx-syy-dmz-app03-12003 (RichMail) with SMTP id 2ee35d786a84012-eb741; Wed, 11 Sep 2019 11:31:16 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.148]) by rmsmtp-syy-appsvr01-12001 (RichMail) with SMTP id 2ee15d786a7b269-ac9ba; Wed, 11 Sep 2019 11:31:16 +0800 (CST) X-RM-TRANSID: 2ee35d786a84012-eb741 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee15d786a7b269-ac9ba From: Mao Zhongyi To: qemu-devel@nongnu.org Date: Wed, 11 Sep 2019 11:31:04 +0800 Message-Id: <555aac83ecd42d21e6311962e793dd4ce2a77902.1568170994.git.maozhongyi@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 221.176.66.79 Subject: [Qemu-devel] =?utf-8?q?=5BPATCH_v2_3/3=5D_tests/migration?= =?utf-8?q?=EF=BC=9Afix_unreachable_path_in_stress_test?= X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tony.nguyen@bt.com, alex.bennee@linaro.org, armbru@redhat.com, Mao Zhongyi , laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" if stress function always return 0, the path 'if (stress(ramsizeGB, ncpus) < 0)' is nerver unreachable, so fix it to allow the test failed. Cc: armbru@redhat.com Cc: laurent@vivier.eu Cc: tony.nguyen@bt.com Signed-off-by: Mao Zhongyi --- tests/migration/stress.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/migration/stress.c b/tests/migration/stress.c index 19a6eff5fd..35903d90c4 100644 --- a/tests/migration/stress.c +++ b/tests/migration/stress.c @@ -224,6 +224,7 @@ static int stressone(unsigned long long ramsizeMB) } } } + return 0; } =20 =20 @@ -248,9 +249,7 @@ static int stress(unsigned long long ramsizeGB, int ncp= us) stressthread, &ramsizeMB); } =20 - stressone(ramsizeMB); - - return 0; + return stressone(ramsizeMB); } =20 =20 --=20 2.17.1