From patchwork Wed Apr 13 02:17:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 8817931 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CB4119F39A for ; Wed, 13 Apr 2016 02:19:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 06E9C201EF for ; Wed, 13 Apr 2016 02:19:54 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 282AD201FA for ; Wed, 13 Apr 2016 02:19:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqAMo-00046D-Hr; Wed, 13 Apr 2016 02:17:18 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqAMm-000464-Pu for xen-devel@lists.xenproject.org; Wed, 13 Apr 2016 02:17:16 +0000 Received: from [85.158.139.211] by server-14.bemta-5.messagelabs.com id 26/4B-30904-C2CAD075; Wed, 13 Apr 2016 02:17:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBIsWRWlGSWpSXmKPExsVyMfSAk672Gt5 wg3MLxSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oz2S/eYCjZxVby5eIatgXExRxcjF4eQwHRG iXuff7OBOCwCy1glZj79xALiSAgcYpVoe9nJ3MXICeTESLxadZYRwq6UmHNuJyuILSSgJLFl8 mNGiFFbmCRmv9gAlhAW0JOY/O02WAOLgKpE37ddYIPYBPQlnq69BmaLCBhJdN65DLaNWWA7o8 SJP7OYuhg5gJrTJeZssAcxeQWsJFYuD4CY/4NRoufFOiaQXl4BQYmTM5+wgNjMAloSN/69BGt lFpCWWP6PAyTMKWAtMf1tGwtIWFRAReLVwfoJjCKzkDTPQtI8C6F5ASPzKkaN4tSistQiXUMT vaSizPSMktzEzBxdQwNTvdzU4uLE9NScxKRiveT83E2MwPBnAIIdjGdPex5ilORgUhLlzcvkD RfiS8pPqcxILM6ILyrNSS0+xCjDwaEkwbtxFVBOsCg1PbUiLTMHGIkwaQkOHiUR3ocgad7igs Tc4sx0iNQpRmOOLb+vrWXi2Db13lomIZa8/LxUKXHeKpBSAZDSjNI8uEGwBHGJUVZKmJcR6DQ hnoLUotzMElT5V4ziHIxKwrzPQKbwZOaVwO17BXQKE9Apz/5xgpxSkoiQkmpgrAlj+xnhyri/ Sec4l8Hm3+/bfhU/vtP1qcQj8sS2OWHNux7/u/U1fCv/31PrM03z/+66O+lq3+Y5lrs+OYbnV uUqyq/J7V34WOZd2Ax2s4VfhPtWH/p6NXmjVHiB0Nfl++cyrf4jd+3rA+ulB02XP/6yd6/1Xs 39Xq13F/9cv+Erb9CvhZ/8kq4osRRnJBpqMRcVJwIAO+JfsgsDAAA= X-Env-Sender: ketuzsezr@gmail.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1460513834!1673996!1 X-Originating-IP: [209.85.192.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26601 invoked from network); 13 Apr 2016 02:17:15 -0000 Received: from mail-qg0-f66.google.com (HELO mail-qg0-f66.google.com) (209.85.192.66) by server-14.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 13 Apr 2016 02:17:15 -0000 Received: by mail-qg0-f66.google.com with SMTP id b32so3432412qgf.2 for ; Tue, 12 Apr 2016 19:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=55aAAJ99WD3IGW/KHBsadC9wHM/Bqy1ujYbLXNJXOEo=; b=JUm6fffud/YGPZyaHpMkBgyK62aVPyiOEXtv2QNsk4xauc6AMgEisOeF/ROWr8Eq13 8uAi67qlkkQgAsGvUScNG43IepRaaL3PV66+lTW4kYXD9LkR/q4FZwDNcrrvdTi4YKsC bS2Acz8XPRvZ4HMo0ln9m4opMXhB2n2MYYCvWYikkfAFEGbiXDgWos+5KPb9Ggfgnc/y nIvobNPWMH1JM/6/2qKKokROFD0K4bnRQB0vQ0m/ve3vU1+aFqr+zrFKD+pcuLw7CF1N B093xBYCNXcUN9Mg5bTAXN+G/jq4GAAUncZ4Ia+k8oK++70Y6weh5FWAt1tvuKIy2i13 yltA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=55aAAJ99WD3IGW/KHBsadC9wHM/Bqy1ujYbLXNJXOEo=; b=TujsA5qnlroQggRte6JoM9jFZYCwfmtO+i6VsaBqGot0JX0EIKcYlJoP0ARVWGpb7x KAb0R56dB+0y5jgFYz/63QKbKWkjynKFtezRS670YZYrGHOt9Mw8PxVFLTnNsQz89GjT gwGo0L0aKuAFeibzBW1BpX9M8OdCf0HNll4DNpUlr/2N1T2Rl7wU0PADrvlqQouiUjUf g/ChWh5z5MZfwbHPdzCZlmvnFkoqljIVy4mS4jQpDwB3EhcEdvmUaCRPrjkLUfn7VEbC QNyo5CldCTJgemLMhHvV2JWxxDG8mh/e0fwNFJe/Nwbpzr/XI93eBsSB2VDqQAAQgYBT 2g4g== X-Gm-Message-State: AOPr4FUttWKMmEnjOWXiQqBfC0+54MmRIMYkAM2axBAvR1nDCnUGalhIwYs09UvirB8cXg== X-Received: by 10.140.40.231 with SMTP id x94mr8010331qgx.83.1460513834260; Tue, 12 Apr 2016 19:17:14 -0700 (PDT) Received: from localhost.localdomain (209-6-196-81.c3-0.smr-ubr2.sbo-smr.ma.cable.rcn.com. [209.6.196.81]) by smtp.gmail.com with ESMTPSA id h34sm14914685qge.30.2016.04.12.19.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Apr 2016 19:17:13 -0700 (PDT) Date: Tue, 12 Apr 2016 22:17:11 -0400 From: Konrad Rzeszutek Wilk To: Konrad Rzeszutek Wilk Message-ID: <20160413021710.GA31947@localhost.localdomain> References: <1460494742-11262-1-git-send-email-konrad.wilk@oracle.com> <1460494742-11262-2-git-send-email-konrad.wilk@oracle.com> <20160413020312.GA31664@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160413020312.GA31664@localhost.localdomain> User-Agent: Mutt/1.5.24 (2015-08-30) Cc: wei.liu2@citrix.com, andrew.cooper3@citrix.com, ross.lagerwall@citrix.com, jbeulich@suse.com, sasha.levin@oracle.com, xen-devel@lists.xenproject.org, Keir Fraser Subject: Re: [Xen-devel] [PATCH v7 25/24] symbols/xsplice: Implement fast symbol names -> virtual addresses lookup X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Apr 12, 2016 at 10:03:12PM -0400, Konrad Rzeszutek Wilk wrote: > On Tue, Apr 12, 2016 at 04:59:02PM -0400, Konrad Rzeszutek Wilk wrote: > > The current mechanism is geared towards fast virtual address -> > > symbol names lookup. This is fine for the normal use cases > > (BUG_ON, WARN_ON, etc), but for xSplice - where we need to find > > hypervisor symbols - it is slow. > .. snip.. > > NEW CODE: > > Searching for symbols is simplified as we can do a binary search > > on symbol_names_sorted (and using symbols_markers_sorted). Since the > > symbols are sorted it takes on average 13 calls to symbols_expand_symbol. > > And there is a bug somewhere. The virtual address that was tied to > 'printk' actually ended up being tied to 'printed.21561'! > > As such, when reviewing this code be aware there is something I must have missed! Fixes it. diff --git a/xen/common/symbols.c b/xen/common/symbols.c index cfea93e..3d7e5b2 100644 --- a/xen/common/symbols.c +++ b/xen/common/symbols.c @@ -261,7 +261,7 @@ unsigned long symbols_lookup_by_name(const char *symname) else if ( rc > 0 ) low = mid + 1; else - return symbols_address(symbols_addresses_index_sorted[low]); + return symbols_address(symbols_addresses_index_sorted[mid]); } return 0; }