From owner-svn-soc-all@FreeBSD.ORG Fri May 30 17:14:59 2014 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F3C9F3 for ; Fri, 30 May 2014 17:14:59 +0000 (UTC) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C0B82C16 for ; Fri, 30 May 2014 17:14:59 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4UHExkp055577 for ; Fri, 30 May 2014 17:14:59 GMT (envelope-from mihai@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.8/8.14.8/Submit) id s4UHEwmv055564 for svn-soc-all@FreeBSD.org; Fri, 30 May 2014 17:14:58 GMT (envelope-from mihai@FreeBSD.org) Date: Fri, 30 May 2014 17:14:58 GMT Message-Id: <201405301714.s4UHEwmv055564@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mihai@FreeBSD.org using -f From: mihai@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r268865 - soc2014/mihai/bhyve-icache-head/sys/amd64/vmm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 May 2014 17:14:59 -0000 Author: mihai Date: Fri May 30 17:14:58 2014 New Revision: 268865 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=268865 Log: sys: amd64: vmm: vmm_instruction_cache.c: fix memory leak Modified: soc2014/mihai/bhyve-icache-head/sys/amd64/vmm/vmm_instruction_cache.c Modified: soc2014/mihai/bhyve-icache-head/sys/amd64/vmm/vmm_instruction_cache.c ============================================================================== --- soc2014/mihai/bhyve-icache-head/sys/amd64/vmm/vmm_instruction_cache.c Fri May 30 16:53:53 2014 (r268864) +++ soc2014/mihai/bhyve-icache-head/sys/amd64/vmm/vmm_instruction_cache.c Fri May 30 17:14:58 2014 (r268865) @@ -151,12 +151,12 @@ struct vie_cached *vie_cached; int hash; - vie_cached = malloc(sizeof(struct vie_cached), M_VIECACHED, M_WAITOK | M_ZERO); - /* Check to see if caching is enabled */ if (!vmm_cached_instruction_enable) return (0); + vie_cached = malloc(sizeof(struct vie_cached), M_VIECACHED, M_WAITOK | M_ZERO); + vie_cached->vm = vm; vie_cached->rip = rip; vie_cached->cr3 = cr3; @@ -205,12 +205,14 @@ { struct vie_cached *vie_cached; int hash; - uint64_t rip_page = trunc_page(rip); + uint64_t rip_page; /* Check to see if caching is enabled */ if (!vmm_cached_instruction_enable) return (0); + rip_page = trunc_page(rip); + hash = jenkins_hash(&vm, sizeof(struct vm *), 0) & VIE_CACHE_HASH_MASK; rm_wlock(&vie_cached_hash[hash].vie_cached_lock);