From teybjefeifr@weather.com Sun Nov 02 03:53:25 2008 Return-path: Envelope-to: apache@lists.xensource.com Delivery-date: Sun, 02 Nov 2008 03:53:25 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KwbWG-00020g-KS for apache@lists.xensource.com; Sun, 02 Nov 2008 03:53:24 -0800 X-ASG-Debug-ID: 1225626786-708a00030000-RounwS X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from weather.com (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with SMTP id 5F916D9872; Sun, 2 Nov 2008 03:53:07 -0800 (PST) Received: from weather.com ([85.175.19.74]) by spam.xensource.com with SMTP id Zdo7XzIKzx3xGEHy; Sun, 02 Nov 2008 03:53:07 -0800 (PST) Message-ID: <3E563DF6.AEFB48A3@weather.com> Date: Sun, 02 Nov 2008 18:32:29 +0600 From: "EuroPrimeCasino" To: , , , , , , , , , , , , , , , , , , , X-ASG-Orig-Subj: Euro Prime Casino - Read what our players say... Subject: [SPAM] Euro Prime Casino - Read what our players say... MIME-Version: 1.0 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Barracuda-Connect: UNKNOWN[85.175.19.74] X-Barracuda-Start-Time: 1225626800 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 4.40 X-Barracuda-Spam-Status: Yes, SCORE=4.40 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_SC0_SA182e, HTML_MESSAGE, MIME_HTML_ONLY, RCVD_IN_PBL, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9291 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.80 RCVD_IN_PBL RBL: Received via a relay in Spamhaus PBL [85.175.19.74 listed in zen.spamhaus.org] 0.00 HTML_MESSAGE BODY: HTML included in message 0.00 MIME_HTML_ONLY BODY: Message only has text/html MIME parts 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 3.50 BSF_SC0_SA182e Custom Rule SA182e X-Priority: 5 (Lowest) X-MSMail-Priority: Low Importance: Low X-Barracuda-Spam-Flag: YES Why playing at Euro Prime Casino

Why playing at Euro Prime Casino? Here are our players' testimonials:

 

"I recommend playing at Euro Prime Casino, out of the numerous games out there, it's the only one that let me play with comfort and security. Support if 100% available!"   (Albert V., France)

 

"I'm playing slots every now and then but never imagined I would make so much money out of it in Euro Prime Casino, after placing a 2 Euros bet, I made 13,445 Euros back.  I couldn't believe to what I saw."   (Michael F., Germany )

 

http://www.europrimeslots.net

 

Play and claim your 300 Euros now!

 

From xen-changelog-bounces@lists.xensource.com Wed Nov 05 06:59:58 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 06:59:58 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrS-0000jf-6u; Wed, 05 Nov 2008 06:59:58 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrO-0000im-Hz for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 06:59:54 -0800 X-ASG-Debug-ID: 1225897192-62a200080001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 00744DC7D0 for ; Wed, 5 Nov 2008 06:59:53 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id WCyHgug3kRxRkocn for ; Wed, 05 Nov 2008 06:59:53 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563356 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563356" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:52 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5Expfa004404 for ; Wed, 5 Nov 2008 06:59:51 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0EWq015483 for ; Wed, 5 Nov 2008 07:00:14 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0ETU015482 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:14 -0800 Message-Id: <200811051500.mA5F0ETU015482@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:13 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Cpufreq statistic update for SW_ANY coordination X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897194 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Cpufreq statistic update for SW_ANY coordination X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225102018 0 # Node ID c3362551a424d394b75b420981a3081198509915 # Parent 5c48ab6b1977b7f03033f150ef36b54c759d4df7 Cpufreq statistic update for SW_ANY coordination Signed-off-by: Liu, Jinsong --- xen/arch/x86/acpi/cpufreq/cpufreq.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 5c48ab6b1977 -r c3362551a424 xen/arch/x86/acpi/cpufreq/cpufreq.c --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Mon Oct 27 10:03:17 2008 +0000 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Mon Oct 27 10:06:58 2008 +0000 @@ -370,7 +370,7 @@ static int acpi_cpufreq_target(struct cp if (!check_freqs(cmd.mask, freqs.new, data)) return -EAGAIN; - for_each_cpu_mask(j, cmd.mask) + for_each_cpu_mask(j, online_policy_cpus) cpufreq_statistic_update(j, perf->state, next_perf_state); perf->state = next_perf_state; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:00:04 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:00:04 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrY-0000o1-OM; Wed, 05 Nov 2008 07:00:04 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrP-0000ir-01 for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 06:59:55 -0800 X-ASG-Debug-ID: 1225897192-62a200080002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 6FEB5DC7D7 for ; Wed, 5 Nov 2008 06:59:54 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id tDktOGpzEGdMjXo3 for ; Wed, 05 Nov 2008 06:59:54 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563357 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563357" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:53 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5Exrsh004407 for ; Wed, 5 Nov 2008 06:59:53 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0G33015500 for ; Wed, 5 Nov 2008 07:00:16 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0Grf015499 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:16 -0800 Message-Id: <200811051500.mA5F0Grf015499@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:15 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897194 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225102128 0 # Node ID 3ff349c7aeb77a0a66a53dd409751e3574a4742b # Parent c3362551a424d394b75b420981a3081198509915 x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests A 32on64 guest cannot copy an existing pinned L3 entry to use as a new L3 because COMPAT_L3_DISALLOW_MASK contains bits which are added to L3 entries by adjust_guest_l3e (U/S & R/W) or by the hardware (A & D). Signed-off-by: Ian Campbell --- xen/include/asm-x86/x86_64/page.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r c3362551a424 -r 3ff349c7aeb7 xen/include/asm-x86/x86_64/page.h --- a/xen/include/asm-x86/x86_64/page.h Mon Oct 27 10:06:58 2008 +0000 +++ b/xen/include/asm-x86/x86_64/page.h Mon Oct 27 10:08:48 2008 +0000 @@ -119,7 +119,7 @@ typedef l4_pgentry_t root_pgentry_t; #define L3_DISALLOW_MASK (BASE_DISALLOW_MASK) #define L4_DISALLOW_MASK (BASE_DISALLOW_MASK) -#define COMPAT_L3_DISALLOW_MASK 0xFFFFF1FEU +#define COMPAT_L3_DISALLOW_MASK 0xFFFFF198U #define PAGE_HYPERVISOR (__PAGE_HYPERVISOR | _PAGE_GLOBAL) #define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:00:11 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:00:11 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrf-0000s5-O6; Wed, 05 Nov 2008 07:00:11 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrP-0000iw-4I for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 06:59:55 -0800 X-ASG-Debug-ID: 1225897192-62a200080000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 8CA3BDC7C5 for ; Wed, 5 Nov 2008 06:59:52 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id P5BB6co6H8HHlmM3 for ; Wed, 05 Nov 2008 06:59:52 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563355 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563355" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:51 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5ExoZ5004401 for ; Wed, 5 Nov 2008 06:59:50 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0DKG015466 for ; Wed, 5 Nov 2008 07:00:13 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0D4O015465 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:13 -0800 Message-Id: <200811051500.mA5F0D4O015465@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:12 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Fix xm scsi-attach/detach/list for inactive managed domains X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897193 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] Fix xm scsi-attach/detach/list for inactive managed domains X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225101797 0 # Node ID 5c48ab6b1977b7f03033f150ef36b54c759d4df7 # Parent 874d0d673ecb55749cdc836942222ba684b365cb Fix xm scsi-attach/detach/list for inactive managed domains Signed-off-by: Masaki Kanno --- tools/python/xen/util/diagnose.py | 4 - tools/python/xen/xend/XendConfig.py | 17 +++--- tools/python/xen/xend/XendDomainInfo.py | 73 ++++++++++++++++++-------- tools/python/xen/xend/server/DevConstants.py | 45 ++++++++++++++++ tools/python/xen/xend/server/DevController.py | 29 ---------- tools/python/xen/xend/server/pciif.py | 3 - tools/python/xen/xend/server/vscsiif.py | 15 ++--- tools/python/xen/xm/create.py | 5 + tools/python/xen/xm/main.py | 5 + 9 files changed, 126 insertions(+), 70 deletions(-) diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/util/diagnose.py --- a/tools/python/xen/util/diagnose.py Thu Oct 23 15:38:52 2008 +0100 +++ b/tools/python/xen/util/diagnose.py Mon Oct 27 10:03:17 2008 +0000 @@ -23,7 +23,7 @@ from xen.xend.XendClient import server from xen.xend.XendClient import server from xen.xend.XendError import XendError from xen.xend.xenstore.xstransact import xstransact -from xen.xend.server import DevController +from xen.xend.server import DevConstants import xen.xend.XendProtocol @@ -169,7 +169,7 @@ def diagnose_hotplugging(): def stateString(state): - return state and DevController.xenbusState[int(state)] or '' + return state and DevConstants.xenbusState[int(state)] or '' def main(argv = None): diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Thu Oct 23 15:38:52 2008 +0100 +++ b/tools/python/xen/xend/XendConfig.py Mon Oct 27 10:03:17 2008 +0000 @@ -1602,21 +1602,21 @@ class XendConfig(dict): # [vscsi, # [dev, # [devid, 0], [p-devname, sdb], [p-dev, 1:0:0:1], - # [v-dev, 0:0:0:0], [state, Initialising] + # [v-dev, 0:0:0:0], [state, 1] # ], # [dev, # [devid, 0], [p-devname, sdc], [p-dev, 1:0:0:2], - # [v-dev, 0:0:0:1], [satet, Initialising] + # [v-dev, 0:0:0:1], [satet, 1] # ] # ], # [vscsi, # [dev, # [devid, 1], [p-devname, sdg], [p-dev, 2:0:0:0], - # [v-dev, 1:0:0:0], [state, Initialising] + # [v-dev, 1:0:0:0], [state, 1] # ], # [dev, # [devid, 1], [p-devname, sdh], [p-dev, 2:0:0:1], - # [v-dev, 1:0:0:1], [satet, Initialising] + # [v-dev, 1:0:0:1], [satet, 1] # ] # ] # ] @@ -1632,18 +1632,19 @@ class XendConfig(dict): # [vscsi, # [dev, # [devid, 0], [p-devname, sdd], [p-dev, 1:0:0:3], - # [v-dev, 0:0:0:2], [state, Initialising] + # [v-dev, 0:0:0:2], [state, 1] # ] # ] # ] # - # state 'Initialising' indicates that the device is being attached, - # while state 'Closing' indicates that the device is being detached. + # state xenbusState['Initialising'] indicates that the device is + # being attached, while state xenbusState['Closing'] indicates + # that the device is being detached. # # The Dict looks like this: # # { devs: [ {devid: 0, p-devname: sdd, p-dev: 1:0:0:3, - # v-dev: 0:0:0:2, state: Initialising} ] } + # v-dev: 0:0:0:2, state: 1} ] } dev_config = {} diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu Oct 23 15:38:52 2008 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Mon Oct 27 10:03:17 2008 +0000 @@ -52,6 +52,7 @@ from xen.xend.xenstore.xswatch import xs from xen.xend.xenstore.xswatch import xswatch from xen.xend.XendConstants import * from xen.xend.XendAPIConstants import * +from xen.xend.server.DevConstants import xenbusState from xen.xend.XendVMMetrics import XendVMMetrics @@ -797,7 +798,7 @@ class XendDomainInfo: existing_dev_info = self._getDeviceInfo_vscsi(req_devid, dev['v-dev']) state = dev['state'] - if state == 'Initialising': + if state == xenbusState['Initialising']: # new create # If request devid does not exist, create and exit. if existing_dev_info is None: @@ -806,25 +807,48 @@ class XendDomainInfo: elif existing_dev_info == "exists": raise XendError("The virtual device %s is already defined" % dev['v-dev']) - elif state == 'Closing': + elif state == xenbusState['Closing']: if existing_dev_info is None: raise XendError("Cannot detach vscsi device does not exist") - # use DevController.reconfigureDevice to change device config - dev_control = self.getDeviceController(dev_class) - dev_uuid = dev_control.reconfigureDevice(req_devid, dev_config) - dev_control.waitForDevice_reconfigure(req_devid) - num_devs = dev_control.cleanupDevice(req_devid) - - # update XendConfig with new device info - if dev_uuid: - new_dev_sxp = dev_control.configuration(req_devid) + if self.domid is not None: + # use DevController.reconfigureDevice to change device config + dev_control = self.getDeviceController(dev_class) + dev_uuid = dev_control.reconfigureDevice(req_devid, dev_config) + dev_control.waitForDevice_reconfigure(req_devid) + num_devs = dev_control.cleanupDevice(req_devid) + + # update XendConfig with new device info + if dev_uuid: + new_dev_sxp = dev_control.configuration(req_devid) + self.info.device_update(dev_uuid, new_dev_sxp) + + # If there is no device left, destroy vscsi and remove config. + if num_devs == 0: + self.destroyDevice('vscsi', req_devid) + del self.info['devices'][dev_uuid] + + else: + cur_dev_sxp = self._getDeviceInfo_vscsi(req_devid, None) + new_dev_sxp = ['vscsi'] + for cur_dev in sxp.children(cur_dev_sxp, 'dev'): + if state == xenbusState['Closing']: + cur_dev_vdev = sxp.child_value(cur_dev, 'v-dev') + if cur_dev_vdev == dev['v-dev']: + continue + new_dev_sxp.append(cur_dev) + + if state == xenbusState['Initialising']: + new_dev_sxp.append(sxp.child0(dev_sxp, 'dev')) + + dev_uuid = sxp.child_value(cur_dev_sxp, 'uuid') self.info.device_update(dev_uuid, new_dev_sxp) - # If there is no device left, destroy vscsi and remove config. - if num_devs == 0: - self.destroyDevice('vscsi', req_devid) - del self.info['devices'][dev_uuid] + # If there is only 'vscsi' in new_dev_sxp, remove the config. + if len(sxp.children(new_dev_sxp, 'dev')) == 0: + del self.info['devices'][dev_uuid] + + xen.xend.XendDomain.instance().managed_config_save(self) return True @@ -986,7 +1010,17 @@ class XendDomainInfo: sxprs = [] dev_num = 0 for dev_type, dev_info in self.info.all_devices_sxpr(): - if dev_type == deviceClass: + if dev_type != deviceClass: + continue + + if deviceClass == 'vscsi': + vscsi_devs = ['devs', []] + for vscsi_dev in sxp.children(dev_info, 'dev'): + vscsi_dev.append(['frontstate', None]) + vscsi_devs[1].append(vscsi_dev) + dev_num = int(sxp.child_value(vscsi_dev, 'devid')) + sxprs.append([dev_num, [vscsi_devs]]) + else: sxprs.append([dev_num, dev_info]) dev_num += 1 return sxprs @@ -2380,11 +2414,10 @@ class XendDomainInfo: time.sleep(2) for paths in plist: if paths.find('backend') != -1: - from xen.xend.server import DevController # Modify online status /before/ updating state (latter is watched by # drivers, so this ordering avoids a race). xstransact.Write(paths, 'online', "0") - xstransact.Write(paths, 'state', str(DevController.xenbusState['Closing'])) + xstransact.Write(paths, 'state', str(xenbusState['Closing'])) # force xstransact.Remove(paths) @@ -3439,7 +3472,7 @@ class XendDomainInfo: ['p-devname', pscsi.get_dev_name()], ['p-dev', pscsi.get_physical_HCTL()], ['v-dev', xenapi_dscsi.get('virtual_HCTL')], - ['state', 'Initialising'], + ['state', xenbusState['Initialising']], ['uuid', dscsi_uuid] ] ] @@ -3558,7 +3591,7 @@ class XendDomainInfo: if target_dev is None: raise XendError('Failed to destroy device') - target_dev.append(['state', 'Closing']) + target_dev.append(['state', xenbusState['Closing']]) target_vscsi_sxp = ['vscsi', target_dev] if self._stateGet() != XEN_API_VM_POWER_STATE_RUNNING: diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/xend/server/DevConstants.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/python/xen/xend/server/DevConstants.py Mon Oct 27 10:03:17 2008 +0000 @@ -0,0 +1,45 @@ +#============================================================================ +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#============================================================================ +# Copyright (C) 2004, 2005 Mike Wray +# Copyright (C) 2005 XenSource Ltd +#============================================================================ + +DEVICE_CREATE_TIMEOUT = 100 +DEVICE_DESTROY_TIMEOUT = 100 +HOTPLUG_STATUS_NODE = "hotplug-status" +HOTPLUG_ERROR_NODE = "hotplug-error" +HOTPLUG_STATUS_ERROR = "error" +HOTPLUG_STATUS_BUSY = "busy" + +Connected = 1 +Error = 2 +Missing = 3 +Timeout = 4 +Busy = 5 +Disconnected = 6 + +xenbusState = { + 'Unknown' : 0, + 'Initialising' : 1, + 'InitWait' : 2, + 'Initialised' : 3, + 'Connected' : 4, + 'Closing' : 5, + 'Closed' : 6, + 'Reconfiguring' : 7, + 'Reconfigured' : 8, + } +xenbusState.update(dict(zip(xenbusState.values(), xenbusState.keys()))) + diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/xend/server/DevController.py --- a/tools/python/xen/xend/server/DevController.py Thu Oct 23 15:38:52 2008 +0100 +++ b/tools/python/xen/xend/server/DevController.py Mon Oct 27 10:03:17 2008 +0000 @@ -23,41 +23,14 @@ from xen.xend.XendError import VmError from xen.xend.XendError import VmError from xen.xend.XendLogging import log import xen.xend.XendConfig +from xen.xend.server.DevConstants import * from xen.xend.xenstore.xstransact import xstransact, complete from xen.xend.xenstore.xswatch import xswatch import os -DEVICE_CREATE_TIMEOUT = 100 -DEVICE_DESTROY_TIMEOUT = 100 -HOTPLUG_STATUS_NODE = "hotplug-status" -HOTPLUG_ERROR_NODE = "hotplug-error" -HOTPLUG_STATUS_ERROR = "error" -HOTPLUG_STATUS_BUSY = "busy" - -Connected = 1 -Error = 2 -Missing = 3 -Timeout = 4 -Busy = 5 -Disconnected = 6 - -xenbusState = { - 'Unknown' : 0, - 'Initialising' : 1, - 'InitWait' : 2, - 'Initialised' : 3, - 'Connected' : 4, - 'Closing' : 5, - 'Closed' : 6, - 'Reconfiguring': 7, - 'Reconfigured' : 8, - } - xoptions = XendOptions.instance() - -xenbusState.update(dict(zip(xenbusState.values(), xenbusState.keys()))) class DevController: diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Thu Oct 23 15:38:52 2008 +0100 +++ b/tools/python/xen/xend/server/pciif.py Mon Oct 27 10:03:17 2008 +0000 @@ -25,7 +25,8 @@ from xen.xend.XendError import VmError from xen.xend.XendError import VmError from xen.xend.XendLogging import log -from xen.xend.server.DevController import DevController, xenbusState +from xen.xend.server.DevController import DevController +from xen.xend.server.DevConstants import xenbusState import xen.lowlevel.xc diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/xend/server/vscsiif.py --- a/tools/python/xen/xend/server/vscsiif.py Thu Oct 23 15:38:52 2008 +0100 +++ b/tools/python/xen/xend/server/vscsiif.py Mon Oct 27 10:03:17 2008 +0000 @@ -28,7 +28,8 @@ from xen.xend.XendError import VmError from xen.xend.XendError import VmError from xen.xend.XendLogging import log -from xen.xend.server.DevController import DevController, xenbusState +from xen.xend.server.DevController import DevController +from xen.xend.server.DevConstants import xenbusState from xen.xend.xenstore.xstransact import xstransact class VSCSIController(DevController): @@ -92,8 +93,8 @@ class VSCSIController(DevController): back[devpath + '/p-devname'] = pdevname vdev = vscsi_config.get('v-dev', '') back[devpath + '/v-dev'] = vdev - state = vscsi_config.get('state', '') - back[devpath + '/state'] = str(xenbusState[state]) + state = vscsi_config.get('state', xenbusState['Unknown']) + back[devpath + '/state'] = str(state) devid = vscsi_config.get('devid', '') back[devpath + '/devid'] = str(devid) @@ -168,17 +169,17 @@ class VSCSIController(DevController): (devid, back, front) = self.getDeviceDetails(config) devid = int(devid) vscsi_config = config['devs'][0] - state = vscsi_config.get('state', '') + state = vscsi_config.get('state', xenbusState['Unknown']) driver_state = self.readBackend(devid, 'state') if str(xenbusState['Connected']) != driver_state: raise VmError("Driver status is not connected") uuid = self.readBackend(devid, 'uuid') - if state == 'Initialising': + if state == xenbusState['Initialising']: back['uuid'] = uuid self.writeBackend(devid, back) - elif state == 'Closing': + elif state == xenbusState['Closing']: found = False devs = self.readBackendList(devid, "vscsi-devs") vscsipath = "vscsi-devs/" @@ -198,7 +199,7 @@ class VSCSIController(DevController): else: raise XendError("Error configuring device invalid " - "state '%s'" % state) + "state '%s'" % xenbusState[state]) self.writeBackend(devid, 'state', str(xenbusState['Reconfiguring'])) return self.readBackend(devid, 'uuid') diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Thu Oct 23 15:38:52 2008 +0100 +++ b/tools/python/xen/xm/create.py Mon Oct 27 10:03:17 2008 +0000 @@ -32,6 +32,7 @@ from xen.xend import osdep from xen.xend import osdep import xen.xend.XendClient from xen.xend.XendBootloader import bootloader +from xen.xend.server.DevConstants import xenbusState from xen.util import blkif from xen.util import vscsi_util import xen.util.xsm.xsm as security @@ -707,7 +708,7 @@ def configure_vscsis(config_devs, vals): vscsi_util.vscsi_get_hctl_and_devname_by(p_dev, scsi_devices) if p_hctl == None: - raise ValueError("Cannot find device \"%s\"" % p_dev) + raise ValueError('Cannot find device "%s"' % p_dev) for config in config_scsi: dev = vscsi_convert_sxp_to_dict(config) @@ -717,7 +718,7 @@ def configure_vscsis(config_devs, vals): v_hctl = v_dev.split(':') devid = int(v_hctl[0]) config_scsi.append(['dev', \ - ['state', 'Initialising'], \ + ['state', xenbusState['Initialising']], \ ['devid', devid], \ ['p-dev', p_hctl], \ ['p-devname', devname], \ diff -r 874d0d673ecb -r 5c48ab6b1977 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Thu Oct 23 15:38:52 2008 +0100 +++ b/tools/python/xen/xm/main.py Mon Oct 27 10:03:17 2008 +0000 @@ -47,6 +47,7 @@ from xen.xend import sxp from xen.xend import sxp from xen.xend import XendClient from xen.xend.XendConstants import * +from xen.xend.server.DevConstants import xenbusState from xen.xm.opts import OptionError, Opts, wrap, set_true from xen.xm import console @@ -2515,7 +2516,7 @@ def xm_scsi_attach(args): dom = args[0] p_scsi = args[1] v_hctl = args[2] - scsi = parse_scsi_configuration(p_scsi, v_hctl, 'Initialising') + scsi = parse_scsi_configuration(p_scsi, v_hctl, xenbusState['Initialising']) if serverType == SERVER_XEN_API: @@ -2635,7 +2636,7 @@ def xm_scsi_detach(args): arg_check(args, 'scsi-detach', 2) dom = args[0] v_hctl = args[1] - scsi = parse_scsi_configuration(None, v_hctl, 'Closing') + scsi = parse_scsi_configuration(None, v_hctl, xenbusState['Closing']) if serverType == SERVER_XEN_API: _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:00:20 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:00:20 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjro-0000wZ-1U; Wed, 05 Nov 2008 07:00:20 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrP-0000j1-Ps for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 06:59:55 -0800 X-ASG-Debug-ID: 1225897192-62a200080003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 77381DC7D0 for ; Wed, 5 Nov 2008 06:59:55 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id ZUGpHYG4eBpreJS2 for ; Wed, 05 Nov 2008 06:59:55 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563358 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563358" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:54 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5ExsWY004410 for ; Wed, 5 Nov 2008 06:59:54 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0HKG015517 for ; Wed, 5 Nov 2008 07:00:17 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0HZT015516 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:17 -0800 Message-Id: <200811051500.mA5F0HZT015516@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:16 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Add 2 more permissions to the XSM/Flask default policy. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897195 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Add 2 more permissions to the XSM/Flask default policy. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225103379 0 # Node ID b99ab7f88a8205f4ecfc6c1c002d6256e1115c17 # Parent 3ff349c7aeb77a0a66a53dd409751e3574a4742b Add 2 more permissions to the XSM/Flask default policy. Signed-off-by: Stefan Berger --- tools/flask/policy/policy/modules/xen/xen.te | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -r 3ff349c7aeb7 -r b99ab7f88a82 tools/flask/policy/policy/modules/xen/xen.te --- a/tools/flask/policy/policy/modules/xen/xen.te Mon Oct 27 10:08:48 2008 +0000 +++ b/tools/flask/policy/policy/modules/xen/xen.te Mon Oct 27 10:29:39 2008 +0000 @@ -74,7 +74,7 @@ allow dom0_t pirq_t:event {vector}; allow dom0_t pirq_t:event {vector}; allow dom0_t xen_t:mmu {memorymap}; -allow dom0_t dom0_t:mmu {pinpage map_read map_write adjust}; +allow dom0_t dom0_t:mmu {pinpage map_read map_write adjust updatemp}; allow dom0_t dom0_t:grant {query setup}; allow dom0_t dom0_t:domain {scheduler getdomaininfo getvcpuinfo getvcpuaffinity}; @@ -112,6 +112,7 @@ allow domU_t evchnU-0_t:event {send}; allow dom0_t dom0_t:event {send}; allow dom0_t domU_t:grant {copy}; +allow domU_t domU_t:grant {copy}; manage_domain(dom0_t, domU_t) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:00:28 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:00:28 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrw-00011b-Cf; Wed, 05 Nov 2008 07:00:28 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrQ-0000jD-MJ for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 06:59:56 -0800 X-ASG-Debug-ID: 1225897192-62a200080004-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 59664DC9F6 for ; Wed, 5 Nov 2008 06:59:56 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id OzcHTHzPs8NCNrYD for ; Wed, 05 Nov 2008 06:59:56 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563359 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563359" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:55 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5ExtxL004413 for ; Wed, 5 Nov 2008 06:59:55 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0IF4015534 for ; Wed, 5 Nov 2008 07:00:18 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0ITl015533 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:18 -0800 Message-Id: <200811051500.mA5F0ITl015533@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:17 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86_32: Lock in map_domain_page() may be taken with IRQs disabled, and X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897196 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86_32: Lock in map_domain_page() may be taken with IRQs disabled, and X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225104560 0 # Node ID efc0a4065ee1fd76b010ff6e1d09d865ea1ec50e # Parent b99ab7f88a8205f4ecfc6c1c002d6256e1115c17 x86_32: Lock in map_domain_page() may be taken with IRQs disabled, and hence must *always* disable IRQs. Signed-off-by: Keir Fraser --- xen/arch/x86/x86_32/domain_page.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -r b99ab7f88a82 -r efc0a4065ee1 xen/arch/x86/x86_32/domain_page.c --- a/xen/arch/x86/x86_32/domain_page.c Mon Oct 27 10:29:39 2008 +0000 +++ b/xen/arch/x86/x86_32/domain_page.c Mon Oct 27 10:49:20 2008 +0000 @@ -43,7 +43,7 @@ void *map_domain_page(unsigned long mfn) void *map_domain_page(unsigned long mfn) { unsigned long va; - unsigned int idx, i; + unsigned int idx, i, flags; struct vcpu *v; struct mapcache_domain *dcache; struct mapcache_vcpu *vcache; @@ -69,7 +69,7 @@ void *map_domain_page(unsigned long mfn) goto out; } - spin_lock(&dcache->lock); + spin_lock_irqsave(&dcache->lock, flags); /* Has some other CPU caused a wrap? We must flush if so. */ if ( unlikely(dcache->epoch != vcache->shadow_epoch) ) @@ -105,7 +105,7 @@ void *map_domain_page(unsigned long mfn) set_bit(idx, dcache->inuse); dcache->cursor = idx + 1; - spin_unlock(&dcache->lock); + spin_unlock_irqrestore(&dcache->lock, flags); l1e_write(&dcache->l1tab[idx], l1e_from_pfn(mfn, __PAGE_HYPERVISOR)); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:00:35 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:00:35 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs2-00015g-Vo; Wed, 05 Nov 2008 07:00:35 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrR-0000jX-Ki for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 06:59:57 -0800 X-ASG-Debug-ID: 1225897192-62a200080005-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 4F412DC9F8 for ; Wed, 5 Nov 2008 06:59:57 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id qVKhmvmamLCaObOw for ; Wed, 05 Nov 2008 06:59:57 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563360 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563360" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:56 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5Exukf004416 for ; Wed, 5 Nov 2008 06:59:56 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0J8o015551 for ; Wed, 5 Nov 2008 07:00:19 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0J36015550 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:19 -0800 Message-Id: <200811051500.mA5F0J36015550@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:18 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] serial: Fix IRQ enable/disable in tx interrupt handler. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897197 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] serial: Fix IRQ enable/disable in tx interrupt handler. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225106851 0 # Node ID 9e47e72fd03ec78378b46aa30633ced686838c6f # Parent efc0a4065ee1fd76b010ff6e1d09d865ea1ec50e serial: Fix IRQ enable/disable in tx interrupt handler. Signed-off-by: Keir Fraser --- xen/drivers/char/serial.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff -r efc0a4065ee1 -r 9e47e72fd03e xen/drivers/char/serial.c --- a/xen/drivers/char/serial.c Mon Oct 27 10:49:20 2008 +0000 +++ b/xen/drivers/char/serial.c Mon Oct 27 11:27:31 2008 +0000 @@ -74,7 +74,7 @@ void serial_tx_interrupt(struct serial_p while ( !spin_trylock(&port->tx_lock) ) { if ( !port->driver->tx_empty(port) ) - return; + goto out; cpu_relax(); } @@ -89,7 +89,10 @@ void serial_tx_interrupt(struct serial_p } } - spin_unlock_irqrestore(&port->tx_lock, flags); + spin_unlock(&port->tx_lock); + + out: + local_irq_restore(flags); } static void __serial_putc(struct serial_port *port, char c) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:00:41 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:00:41 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs9-0001A4-O8; Wed, 05 Nov 2008 07:00:41 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrT-0000kV-0P for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 06:59:59 -0800 X-ASG-Debug-ID: 1225897192-62a200080006-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 72095DC9FA for ; Wed, 5 Nov 2008 06:59:58 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 8abZ1gEwHr9F3nlf for ; Wed, 05 Nov 2008 06:59:58 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563361 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563361" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:57 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5Exv6e004419 for ; Wed, 5 Nov 2008 06:59:57 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0KtA015568 for ; Wed, 5 Nov 2008 07:00:20 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0KLE015567 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:20 -0800 Message-Id: <200811051500.mA5F0KLE015567@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:19 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Fix coding style in msi.c X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897198 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Fix coding style in msi.c X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225108617 0 # Node ID 537d480b7ffc1916a44ca1488bf70d80efac69cb # Parent 9e47e72fd03ec78378b46aa30633ced686838c6f x86: Fix coding style in msi.c Signed-off-by: Keir Fraser --- xen/arch/x86/msi.c | 69 ++++++++++++++++++++++++----------------------------- 1 files changed, 32 insertions(+), 37 deletions(-) diff -r 9e47e72fd03e -r 537d480b7ffc xen/arch/x86/msi.c --- a/xen/arch/x86/msi.c Mon Oct 27 11:27:31 2008 +0000 +++ b/xen/arch/x86/msi.c Mon Oct 27 11:56:57 2008 +0000 @@ -33,8 +33,7 @@ DECLARE_BITMAP(msix_fixmap_pages, MAX_MS static int msix_fixmap_alloc(void) { - int i; - int rc = -1; + int i, rc = -1; spin_lock(&msix_fixmap_lock); for ( i = 0; i < MAX_MSIX_PAGES; i++ ) @@ -52,12 +51,8 @@ static int msix_fixmap_alloc(void) static void msix_fixmap_free(int idx) { - if ( idx < FIX_MSIX_IO_RESERV_BASE ) - return; - - spin_lock(&msix_fixmap_lock); - clear_bit(idx - FIX_MSIX_IO_RESERV_BASE, &msix_fixmap_pages); - spin_unlock(&msix_fixmap_lock); + if ( idx >= FIX_MSIX_IO_RESERV_BASE ) + clear_bit(idx - FIX_MSIX_IO_RESERV_BASE, &msix_fixmap_pages); } /* @@ -78,19 +73,19 @@ static void msi_compose_msg(struct pci_d msg->address_lo = MSI_ADDR_BASE_LO | ((INT_DEST_MODE == 0) ? - MSI_ADDR_DESTMODE_PHYS: - MSI_ADDR_DESTMODE_LOGIC) | + MSI_ADDR_DESTMODE_PHYS: + MSI_ADDR_DESTMODE_LOGIC) | ((INT_DELIVERY_MODE != dest_LowestPrio) ? - MSI_ADDR_REDIRECTION_CPU: - MSI_ADDR_REDIRECTION_LOWPRI) | + MSI_ADDR_REDIRECTION_CPU: + MSI_ADDR_REDIRECTION_LOWPRI) | MSI_ADDR_DEST_ID(dest); msg->data = MSI_DATA_TRIGGER_EDGE | MSI_DATA_LEVEL_ASSERT | ((INT_DELIVERY_MODE != dest_LowestPrio) ? - MSI_DATA_DELIVERY_FIXED: - MSI_DATA_DELIVERY_LOWPRI) | + MSI_DATA_DELIVERY_FIXED: + MSI_DATA_DELIVERY_LOWPRI) | MSI_DATA_VECTOR(vector); } } @@ -128,7 +123,7 @@ static void read_msi_msg(struct msi_desc { void __iomem *base; base = entry->mask_base + - entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; + entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; msg->address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); @@ -205,9 +200,9 @@ static void write_msi_msg(struct msi_des entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; writel(msg->address_lo, - base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); writel(msg->address_hi, - base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); + base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); writel(msg->data, base + PCI_MSIX_ENTRY_DATA_OFFSET); break; } @@ -230,7 +225,7 @@ void set_msi_irq_affinity(unsigned int i dest = cpu_mask_to_apicid(mask); if ( !desc ) - return; + return; ASSERT(spin_is_locked(&irq_desc[irq].lock)); spin_lock(&desc->dev->lock); @@ -398,8 +393,8 @@ static void msi_free_vector(int vector) unsigned long start; writel(1, entry->mask_base + entry->msi_attrib.entry_nr - * PCI_MSIX_ENTRY_SIZE - + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); + * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); start = (unsigned long)entry->mask_base & ~(PAGE_SIZE - 1); msix_fixmap_free(virt_to_fix(start)); @@ -460,20 +455,20 @@ static int msi_capability_init(struct pc entry->vector = vector; if ( is_mask_bit_support(control) ) entry->mask_base = (void __iomem *)(long)msi_mask_bits_reg(pos, - is_64bit_address(control)); + is_64bit_address(control)); entry->dev = dev; if ( entry->msi_attrib.maskbit ) { unsigned int maskbits, temp; /* All MSIs are unmasked by default, Mask them all */ maskbits = pci_conf_read32(bus, slot, func, - msi_mask_bits_reg(pos, is_64bit_address(control))); + msi_mask_bits_reg(pos, is_64bit_address(control))); temp = (1 << multi_msi_capable(control)); temp = ((temp - 1) & ~temp); maskbits |= temp; pci_conf_write32(bus, slot, func, - msi_mask_bits_reg(pos, is_64bit_address(control)), - maskbits); + msi_mask_bits_reg(pos, is_64bit_address(control)), + maskbits); } list_add_tail(&entry->list, &dev->msi_list); @@ -575,14 +570,14 @@ static int __pci_enable_msi(struct msi_i pdev = pci_lock_pdev(msi->bus, msi->devfn); if ( !pdev ) - return -ENODEV; + return -ENODEV; if ( find_msi_entry(pdev, msi->vector, PCI_CAP_ID_MSI) ) { - spin_unlock(&pdev->lock); + spin_unlock(&pdev->lock); dprintk(XENLOG_WARNING, "vector %d has already mapped to MSI on " - "device %02x:%02x.%01x.\n", msi->vector, msi->bus, - PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); + "device %02x:%02x.%01x.\n", msi->vector, msi->bus, + PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); return 0; } @@ -601,7 +596,7 @@ static void __pci_disable_msi(int vector entry = irq_desc[vector].msi_desc; if ( !entry ) - return; + return; /* * Lock here is safe. msi_desc can not be removed without holding * both irq_desc[].lock (which we do) and pdev->lock. @@ -649,20 +644,20 @@ static int __pci_enable_msix(struct msi_ pdev = pci_lock_pdev(msi->bus, msi->devfn); if ( !pdev ) - return -ENODEV; + return -ENODEV; pos = pci_find_cap_offset(msi->bus, slot, func, PCI_CAP_ID_MSIX); control = pci_conf_read16(msi->bus, slot, func, msi_control_reg(pos)); nr_entries = multi_msix_capable(control); if (msi->entry_nr > nr_entries) { - spin_unlock(&pdev->lock); + spin_unlock(&pdev->lock); return -EINVAL; } if ( find_msi_entry(pdev, msi->vector, PCI_CAP_ID_MSIX) ) { - spin_unlock(&pdev->lock); + spin_unlock(&pdev->lock); dprintk(XENLOG_WARNING, "vector %d has already mapped to MSIX on " "device %02x:%02x.%01x.\n", msi->vector, msi->bus, PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); @@ -684,7 +679,7 @@ static void __pci_disable_msix(int vecto entry = irq_desc[vector].msi_desc; if ( !entry ) - return; + return; /* * Lock here is safe. msi_desc can not be removed without holding * both irq_desc[].lock (which we do) and pdev->lock. @@ -712,7 +707,7 @@ int pci_enable_msi(struct msi_info *msi) ASSERT(spin_is_locked(&irq_desc[msi->vector].lock)); return msi->table_base ? __pci_enable_msix(msi) : - __pci_enable_msi(msi); + __pci_enable_msi(msi); } void pci_disable_msi(int vector) @@ -720,7 +715,7 @@ void pci_disable_msi(int vector) irq_desc_t *desc = &irq_desc[vector]; ASSERT(spin_is_locked(&desc->lock)); if ( !desc->msi_desc ) - return; + return; if ( desc->msi_desc->msi_attrib.type == PCI_CAP_ID_MSI ) __pci_disable_msi(vector); @@ -734,7 +729,7 @@ static void msi_free_vectors(struct pci_ irq_desc_t *desc; unsigned long flags; -retry: + retry: list_for_each_entry_safe( entry, tmp, &dev->msi_list, list ) { desc = &irq_desc[entry->vector]; @@ -742,7 +737,7 @@ retry: local_irq_save(flags); if ( !spin_trylock(&desc->lock) ) { - local_irq_restore(flags); + local_irq_restore(flags); goto retry; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:00:50 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:00:50 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsI-0001ET-H7; Wed, 05 Nov 2008 07:00:50 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrT-0000kq-Fs for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 06:59:59 -0800 X-ASG-Debug-ID: 1225897192-62a200080007-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 2A76FDC9FA for ; Wed, 5 Nov 2008 06:59:58 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 37KaLXT17hbgSHXB for ; Wed, 05 Nov 2008 06:59:58 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563362 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563362" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:58 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5Exw0B004422 for ; Wed, 5 Nov 2008 06:59:58 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0LJ2015586 for ; Wed, 5 Nov 2008 07:00:21 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0LbZ015585 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:21 -0800 Message-Id: <200811051500.mA5F0LbZ015585@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:20 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86/powernow: fix machine shutdown X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897199 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86/powernow: fix machine shutdown X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225113652 0 # Node ID 101e50cffc7825065f4dd39610728a2ba3ea68b4 # Parent 537d480b7ffc1916a44ca1488bf70d80efac69cb x86/powernow: fix machine shutdown cpufreq_del_cpu() calls cpufreq_driver->exit() without checking whether an exit() handler is present, and by adding an exit() handler to powernow we can at once close the potential memory leak. Signed-off-by: Jan Beulich --- xen/arch/x86/acpi/cpufreq/powernow.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+) diff -r 537d480b7ffc -r 101e50cffc78 xen/arch/x86/acpi/cpufreq/powernow.c --- a/xen/arch/x86/acpi/cpufreq/powernow.c Mon Oct 27 11:56:57 2008 +0000 +++ b/xen/arch/x86/acpi/cpufreq/powernow.c Mon Oct 27 13:20:52 2008 +0000 @@ -229,9 +229,23 @@ err_unreg: return result; } +static int powernow_cpufreq_cpu_exit(struct cpufreq_policy *policy) +{ + struct powernow_cpufreq_data *data = drv_data[policy->cpu]; + + if (data) { + drv_data[policy->cpu] = NULL; + xfree(data->freq_table); + xfree(data); + } + + return 0; +} + static struct cpufreq_driver powernow_cpufreq_driver = { .target = powernow_cpufreq_target, .init = powernow_cpufreq_cpu_init, + .exit = powernow_cpufreq_cpu_exit }; int powernow_cpufreq_init(void) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:00:56 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:00:56 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsO-0001IH-8L; Wed, 05 Nov 2008 07:00:56 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrW-0000nB-L6 for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:02 -0800 X-ASG-Debug-ID: 1225897192-62a200080008-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 586A6DC9FE for ; Wed, 5 Nov 2008 06:59:59 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id GE7Uz5cXzP9nKur3 for ; Wed, 05 Nov 2008 06:59:59 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563363 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563363" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 09:59:59 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5ExxpX004425 for ; Wed, 5 Nov 2008 06:59:59 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0MdV015603 for ; Wed, 5 Nov 2008 07:00:22 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0MdA015602 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:22 -0800 Message-Id: <200811051500.mA5F0MdA015602@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:21 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: fix domain cleanup X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897200 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: fix domain cleanup X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225113763 0 # Node ID 11c86c51a697dab2e4a49efe3dda139ea206f423 # Parent 101e50cffc7825065f4dd39610728a2ba3ea68b4 x86: fix domain cleanup The preemptable page type handling changes modified free_page_type() behavior without adjusting the call site in relinquish_memory(): Any type reference left pending when leaving hypercall handlers is associated with a page reference, and when successful free_page_type() decrements the type refcount - hence relinquish_memory() must now also drop the page reference. Also, the recursion avoidance during domain shutdown somehow (probably by me when I merged the patch up to a newer snapshot) got screwed up: The avoidance logic in mm.c should short circuit levels below the top one currently being processed, rather than the top one itself. Signed-off-by: Jan Beulich --- xen/arch/x86/domain.c | 1 + xen/arch/x86/mm.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff -r 101e50cffc78 -r 11c86c51a697 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Mon Oct 27 13:20:52 2008 +0000 +++ b/xen/arch/x86/domain.c Mon Oct 27 13:22:43 2008 +0000 @@ -1687,6 +1687,7 @@ static int relinquish_memory( { if ( free_page_type(page, x, 0) != 0 ) BUG(); + put_page(page); break; } } diff -r 101e50cffc78 -r 11c86c51a697 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Mon Oct 27 13:20:52 2008 +0000 +++ b/xen/arch/x86/mm.c Mon Oct 27 13:22:43 2008 +0000 @@ -1343,7 +1343,7 @@ static void free_l1_table(struct page_in static int free_l2_table(struct page_info *page, int preemptible) { -#ifdef CONFIG_COMPAT +#if defined(CONFIG_COMPAT) || defined(DOMAIN_DESTRUCT_AVOID_RECURSION) struct domain *d = page_get_owner(page); #endif unsigned long pfn = page_to_mfn(page); @@ -1351,6 +1351,11 @@ static int free_l2_table(struct page_inf unsigned int i = page->nr_validated_ptes - 1; int err = 0; +#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION + if ( d->arch.relmem == RELMEM_l3 ) + return 0; +#endif + pl2e = map_domain_page(pfn); ASSERT(page->nr_validated_ptes); @@ -1381,7 +1386,7 @@ static int free_l3_table(struct page_inf int rc = 0; #ifdef DOMAIN_DESTRUCT_AVOID_RECURSION - if ( d->arch.relmem == RELMEM_l3 ) + if ( d->arch.relmem == RELMEM_l4 ) return 0; #endif @@ -1423,11 +1428,6 @@ static int free_l4_table(struct page_inf l4_pgentry_t *pl4e = page_to_virt(page); unsigned int i = page->nr_validated_ptes - !page->partial_pte; int rc = 0; - -#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION - if ( d->arch.relmem == RELMEM_l4 ) - return 0; -#endif do { if ( is_guest_l4_slot(d, i) ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:02 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:02 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsU-0001Mh-5c; Wed, 05 Nov 2008 07:01:02 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrX-0000nF-0m for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:03 -0800 X-ASG-Debug-ID: 1225897192-62a200080009-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 1E4ADDCA00 for ; Wed, 5 Nov 2008 07:00:00 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id nuYaG8Ag9ZGUL974 for ; Wed, 05 Nov 2008 07:00:00 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563366 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563366" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:00 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F00tk004428 for ; Wed, 5 Nov 2008 07:00:00 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0NV0015620 for ; Wed, 5 Nov 2008 07:00:23 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0N5e015619 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:23 -0800 Message-Id: <200811051500.mA5F0N5e015619@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:22 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Print d->is_dying when dumping domain info. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897201 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Print d->is_dying when dumping domain info. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225113838 0 # Node ID 15aed96c7b5cd5a435754a57db13cd72b386717a # Parent 11c86c51a697dab2e4a49efe3dda139ea206f423 Print d->is_dying when dumping domain info. Signed-off-by: Jan Beulich --- xen/common/keyhandler.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 11c86c51a697 -r 15aed96c7b5c xen/common/keyhandler.c --- a/xen/common/keyhandler.c Mon Oct 27 13:22:43 2008 +0000 +++ b/xen/common/keyhandler.c Mon Oct 27 13:23:58 2008 +0000 @@ -183,9 +183,9 @@ static void dump_domains(unsigned char k { printk("General information for domain %u:\n", d->domain_id); cpuset_print(tmpstr, sizeof(tmpstr), d->domain_dirty_cpumask); - printk(" refcnt=%d nr_pages=%d xenheap_pages=%d " + printk(" refcnt=%d dying=%d nr_pages=%d xenheap_pages=%d " "dirty_cpus=%s\n", - atomic_read(&d->refcnt), + atomic_read(&d->refcnt), d->is_dying, d->tot_pages, d->xenheap_pages, tmpstr); printk(" handle=%02x%02x%02x%02x-%02x%02x-%02x%02x-" "%02x%02x-%02x%02x%02x%02x%02x%02x vm_assist=%08lx\n", _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:08 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:08 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsZ-0001QX-Sv; Wed, 05 Nov 2008 07:01:07 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrX-0000nb-HV for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:03 -0800 X-ASG-Debug-ID: 1225897192-62a20008000a-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 16E91DCA04 for ; Wed, 5 Nov 2008 07:00:01 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id PFHIRgNK0ZKGGu0G for ; Wed, 05 Nov 2008 07:00:01 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563367 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563367" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:01 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F01VX004431 for ; Wed, 5 Nov 2008 07:00:01 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0OtT015637 for ; Wed, 5 Nov 2008 07:00:24 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0ObA015636 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:24 -0800 Message-Id: <200811051500.mA5F0ObA015636@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:23 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: First fixmap entry (0) is invalid. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897202 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: First fixmap entry (0) is invalid. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225114010 0 # Node ID 604ffa3cdcc48bbfcfe5e4ccd0af735ddc49d839 # Parent 15aed96c7b5cd5a435754a57db13cd72b386717a x86: First fixmap entry (0) is invalid. Signed-off-by: Jan Beulich Signed-off-by: Keir Fraser --- xen/include/asm-x86/fixmap.h | 1 + 1 files changed, 1 insertion(+) diff -r 15aed96c7b5c -r 604ffa3cdcc4 xen/include/asm-x86/fixmap.h --- a/xen/include/asm-x86/fixmap.h Mon Oct 27 13:23:58 2008 +0000 +++ b/xen/include/asm-x86/fixmap.h Mon Oct 27 13:26:50 2008 +0000 @@ -29,6 +29,7 @@ * from the end of virtual memory backwards. */ enum fixed_addresses { + FIX_RESERVED, /* Index 0 is reserved since fix_to_virt(0) > FIXADDR_TOP. */ #ifdef __i386__ FIX_PAE_HIGHMEM_0, FIX_PAE_HIGHMEM_END = FIX_PAE_HIGHMEM_0 + NR_CPUS-1, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:15 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:15 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjsh-0001V6-FX; Wed, 05 Nov 2008 07:01:15 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjrY-0000oB-K4 for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:04 -0800 X-ASG-Debug-ID: 1225897192-62a20008000b-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 0D47FDCA05 for ; Wed, 5 Nov 2008 07:00:02 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id wXrXeFDVRkyUAUWx for ; Wed, 05 Nov 2008 07:00:02 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563368 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563368" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:02 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F01kI004434 for ; Wed, 5 Nov 2008 07:00:02 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0PBn015654 for ; Wed, 5 Nov 2008 07:00:25 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0PSU015653 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:25 -0800 Message-Id: <200811051500.mA5F0PSU015653@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:24 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Constify arguments to unmap_domain_page() etc. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897203 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Constify arguments to unmap_domain_page() etc. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225114053 0 # Node ID 9bbb54fd9181644d2bdd3c7f93c2cba1dac1b719 # Parent 604ffa3cdcc48bbfcfe5e4ccd0af735ddc49d839 Constify arguments to unmap_domain_page() etc. Signed-off-by: Jan Beulich --- xen/arch/x86/x86_32/domain_page.c | 4 ++-- xen/include/xen/domain_page.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff -r 604ffa3cdcc4 -r 9bbb54fd9181 xen/arch/x86/x86_32/domain_page.c --- a/xen/arch/x86/x86_32/domain_page.c Mon Oct 27 13:26:50 2008 +0000 +++ b/xen/arch/x86/x86_32/domain_page.c Mon Oct 27 13:27:33 2008 +0000 @@ -114,7 +114,7 @@ void *map_domain_page(unsigned long mfn) return (void *)va; } -void unmap_domain_page(void *va) +void unmap_domain_page(const void *va) { unsigned int idx; struct vcpu *v; @@ -241,7 +241,7 @@ void *map_domain_page_global(unsigned lo return (void *)va; } -void unmap_domain_page_global(void *va) +void unmap_domain_page_global(const void *va) { unsigned long __va = (unsigned long)va; l2_pgentry_t *pl2e; diff -r 604ffa3cdcc4 -r 9bbb54fd9181 xen/include/xen/domain_page.h --- a/xen/include/xen/domain_page.h Mon Oct 27 13:26:50 2008 +0000 +++ b/xen/include/xen/domain_page.h Mon Oct 27 13:27:33 2008 +0000 @@ -24,7 +24,7 @@ void *map_domain_page(unsigned long mfn) * Pass a VA within a page previously mapped in the context of the * currently-executing VCPU via a call to map_domain_page(). */ -void unmap_domain_page(void *va); +void unmap_domain_page(const void *va); /* * Similar to the above calls, except the mapping is accessible in all @@ -32,7 +32,7 @@ void unmap_domain_page(void *va); * mappings can also be unmapped from any context. */ void *map_domain_page_global(unsigned long mfn); -void unmap_domain_page_global(void *va); +void unmap_domain_page_global(const void *va); #define DMCACHE_ENTRY_VALID 1U #define DMCACHE_ENTRY_HELD 2U @@ -75,7 +75,7 @@ map_domain_page_with_cache(unsigned long } static inline void -unmap_domain_page_with_cache(void *va, struct domain_mmap_cache *cache) +unmap_domain_page_with_cache(const void *va, struct domain_mmap_cache *cache) { ASSERT(cache != NULL); cache->flags &= ~DMCACHE_ENTRY_HELD; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:21 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:21 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjsn-0001Yp-AA; Wed, 05 Nov 2008 07:01:21 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrb-0000qR-Ii for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:07 -0800 X-ASG-Debug-ID: 1225897192-62a20008000c-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id C7C3ADCA04 for ; Wed, 5 Nov 2008 07:00:05 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id mmWKMZ8kBpw8Di2B for ; Wed, 05 Nov 2008 07:00:05 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563369 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563369" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:04 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F04T9004437 for ; Wed, 5 Nov 2008 07:00:04 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0QWg015673 for ; Wed, 5 Nov 2008 07:00:26 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0QKm015672 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:26 -0800 Message-Id: <200811051500.mA5F0QKm015672@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:25 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: highmem handling assistance hypercalls X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897205 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: highmem handling assistance hypercalls X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225114175 0 # Node ID 4413d53a8320809e93142ed599a81e1bfe5ae900 # Parent 9bbb54fd9181644d2bdd3c7f93c2cba1dac1b719 x86: highmem handling assistance hypercalls While looking at the origin of very frequently executed hypercalls I realized that the high page accessor functions in Linux would be good candidates to handle in the hypervisor - clearing or copying to/from a high page is a pretty frequent operation (provided there's enough memory in the domain). While prior to the first submission I only measured kernel builds (where the results are not hinting at a meaningful improvement), I now found time to do a more specific analysis: page clearing is being improved by about 20%, page copying doesn't seem to significantly benefit (though that may be an effect of the simplistic copy_page() implementation Xen currently uses) - nevertheless I would think that if one function is supported by the hypervisor, then the other should also be. Signed-off-by: Jan Beulich --- xen/arch/x86/mm.c | 83 ++++++++++++++++++++++++++++++++++++++++ xen/arch/x86/x86_64/compat/mm.c | 5 ++ xen/common/kernel.c | 3 - xen/include/public/features.h | 3 + xen/include/public/xen.h | 14 ++++++ 5 files changed, 106 insertions(+), 2 deletions(-) diff -r 9bbb54fd9181 -r 4413d53a8320 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Mon Oct 27 13:27:33 2008 +0000 +++ b/xen/arch/x86/mm.c Mon Oct 27 13:29:35 2008 +0000 @@ -2431,6 +2431,29 @@ static inline cpumask_t vcpumask_to_pcpu return pmask; } +#ifdef __i386__ +static inline void *fixmap_domain_page(unsigned long mfn) +{ + unsigned int cpu = smp_processor_id(); + void *ptr = (void *)fix_to_virt(FIX_PAE_HIGHMEM_0 + cpu); + + l1e_write(fix_pae_highmem_pl1e - cpu, + l1e_from_pfn(mfn, __PAGE_HYPERVISOR)); + flush_tlb_one_local(ptr); + return ptr; +} +static inline void fixunmap_domain_page(const void *ptr) +{ + unsigned int cpu = virt_to_fix((unsigned long)ptr) - FIX_PAE_HIGHMEM_0; + + l1e_write(fix_pae_highmem_pl1e - cpu, l1e_empty()); + this_cpu(make_cr3_timestamp) = this_cpu(tlbflush_time); +} +#else +#define fixmap_domain_page(mfn) mfn_to_virt(mfn) +#define fixunmap_domain_page(ptr) ((void)(ptr)) +#endif + int do_mmuext_op( XEN_GUEST_HANDLE(mmuext_op_t) uops, unsigned int count, @@ -2697,6 +2720,66 @@ int do_mmuext_op( if ( ents != 0 ) this_cpu(percpu_mm_info).deferred_ops |= DOP_RELOAD_LDT; } + break; + } + + case MMUEXT_CLEAR_PAGE: + { + unsigned char *ptr; + + okay = !get_page_and_type_from_pagenr(mfn, PGT_writable_page, + FOREIGNDOM, 0); + if ( unlikely(!okay) ) + { + MEM_LOG("Error while clearing mfn %lx", mfn); + break; + } + + /* A page is dirtied when it's being cleared. */ + paging_mark_dirty(d, mfn); + + ptr = fixmap_domain_page(mfn); + clear_page(ptr); + fixunmap_domain_page(ptr); + + put_page_and_type(page); + break; + } + + case MMUEXT_COPY_PAGE: + { + const unsigned char *src; + unsigned char *dst; + unsigned long src_mfn; + + src_mfn = gmfn_to_mfn(FOREIGNDOM, op.arg2.src_mfn); + okay = get_page_from_pagenr(src_mfn, FOREIGNDOM); + if ( unlikely(!okay) ) + { + MEM_LOG("Error while copying from mfn %lx", src_mfn); + break; + } + + okay = !get_page_and_type_from_pagenr(mfn, PGT_writable_page, + FOREIGNDOM, 0); + if ( unlikely(!okay) ) + { + put_page(mfn_to_page(src_mfn)); + MEM_LOG("Error while copying to mfn %lx", mfn); + break; + } + + /* A page is dirtied when it's being copied to. */ + paging_mark_dirty(d, mfn); + + src = map_domain_page(src_mfn); + dst = fixmap_domain_page(mfn); + copy_page(dst, src); + fixunmap_domain_page(dst); + unmap_domain_page(src); + + put_page_and_type(page); + put_page(mfn_to_page(src_mfn)); break; } diff -r 9bbb54fd9181 -r 4413d53a8320 xen/arch/x86/x86_64/compat/mm.c --- a/xen/arch/x86/x86_64/compat/mm.c Mon Oct 27 13:27:33 2008 +0000 +++ b/xen/arch/x86/x86_64/compat/mm.c Mon Oct 27 13:29:35 2008 +0000 @@ -231,6 +231,8 @@ int compat_mmuext_op(XEN_GUEST_HANDLE(mm case MMUEXT_PIN_L4_TABLE: case MMUEXT_UNPIN_TABLE: case MMUEXT_NEW_BASEPTR: + case MMUEXT_CLEAR_PAGE: + case MMUEXT_COPY_PAGE: arg1 = XLAT_mmuext_op_arg1_mfn; break; default: @@ -257,6 +259,9 @@ int compat_mmuext_op(XEN_GUEST_HANDLE(mm case MMUEXT_TLB_FLUSH_MULTI: case MMUEXT_INVLPG_MULTI: arg2 = XLAT_mmuext_op_arg2_vcpumask; + break; + case MMUEXT_COPY_PAGE: + arg2 = XLAT_mmuext_op_arg2_src_mfn; break; default: arg2 = -1; diff -r 9bbb54fd9181 -r 4413d53a8320 xen/common/kernel.c --- a/xen/common/kernel.c Mon Oct 27 13:27:33 2008 +0000 +++ b/xen/common/kernel.c Mon Oct 27 13:29:35 2008 +0000 @@ -221,7 +221,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL fi.submap |= 1U << XENFEAT_supervisor_mode_kernel; #ifdef CONFIG_X86 if ( !is_hvm_vcpu(current) ) - fi.submap |= 1U << XENFEAT_mmu_pt_update_preserve_ad; + fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) | + (1U << XENFEAT_highmem_assist); #endif break; default: diff -r 9bbb54fd9181 -r 4413d53a8320 xen/include/public/features.h --- a/xen/include/public/features.h Mon Oct 27 13:27:33 2008 +0000 +++ b/xen/include/public/features.h Mon Oct 27 13:29:35 2008 +0000 @@ -59,6 +59,9 @@ /* x86: Does this Xen host support the MMU_PT_UPDATE_PRESERVE_AD hypercall? */ #define XENFEAT_mmu_pt_update_preserve_ad 5 +/* x86: Does this Xen host support the MMU_{CLEAR,COPY}_PAGE hypercall? */ +#define XENFEAT_highmem_assist 6 + #define XENFEAT_NR_SUBMAPS 1 #endif /* __XEN_PUBLIC_FEATURES_H__ */ diff -r 9bbb54fd9181 -r 4413d53a8320 xen/include/public/xen.h --- a/xen/include/public/xen.h Mon Oct 27 13:27:33 2008 +0000 +++ b/xen/include/public/xen.h Mon Oct 27 13:29:35 2008 +0000 @@ -231,6 +231,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); * cmd: MMUEXT_SET_LDT * linear_addr: Linear address of LDT base (NB. must be page-aligned). * nr_ents: Number of entries in LDT. + * + * cmd: MMUEXT_CLEAR_PAGE + * mfn: Machine frame number to be cleared. + * + * cmd: MMUEXT_COPY_PAGE + * mfn: Machine frame number of the destination page. + * src_mfn: Machine frame number of the source page. */ #define MMUEXT_PIN_L1_TABLE 0 #define MMUEXT_PIN_L2_TABLE 1 @@ -247,12 +254,15 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #define MMUEXT_FLUSH_CACHE 12 #define MMUEXT_SET_LDT 13 #define MMUEXT_NEW_USER_BASEPTR 15 +#define MMUEXT_CLEAR_PAGE 16 +#define MMUEXT_COPY_PAGE 17 #ifndef __ASSEMBLY__ struct mmuext_op { unsigned int cmd; union { - /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */ + /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR + * CLEAR_PAGE, COPY_PAGE */ xen_pfn_t mfn; /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ unsigned long linear_addr; @@ -266,6 +276,8 @@ struct mmuext_op { #else void *vcpumask; #endif + /* COPY_PAGE */ + xen_pfn_t src_mfn; } arg2; }; typedef struct mmuext_op mmuext_op_t; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:27 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:27 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjst-0001cm-Dl; Wed, 05 Nov 2008 07:01:27 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrf-0000sL-DR for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:11 -0800 X-ASG-Debug-ID: 1225897192-62a20008000e-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 54B99DCA14 for ; Wed, 5 Nov 2008 07:00:10 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id PEuKi979akiYCrJB for ; Wed, 05 Nov 2008 07:00:10 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563385 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563385" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:09 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F09UU004443 for ; Wed, 5 Nov 2008 07:00:09 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0W7w015748 for ; Wed, 5 Nov 2008 07:00:32 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0Wa0015746 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:32 -0800 Message-Id: <200811051500.mA5F0Wa0015746@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:30 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Disable MSI IRQs until locking is fixed. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897210 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE_7582B X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE_7582B Custom Rule 7582B Subject: [Xen-changelog] [xen-unstable] x86: Disable MSI IRQs until locking is fixed. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225119541 0 # Node ID 324b9b1dd71dbbfc7f2af7bee0f4e704e59ba7d5 # Parent 2a022ee37392715647abf75e44823d087d0e1d45 x86: Disable MSI IRQs until locking is fixed. Signed-off-by: Keir Fraser --- xen/arch/x86/irq.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) diff -r 2a022ee37392 -r 324b9b1dd71d xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Mon Oct 27 13:31:15 2008 +0000 +++ b/xen/arch/x86/irq.c Mon Oct 27 14:59:01 2008 +0000 @@ -793,6 +793,10 @@ int map_domain_pirq( ASSERT(spin_is_locked(&d->event_lock)); + /* XXX Until pcidev and msi locking is fixed. */ + if ( type == MAP_PIRQ_TYPE_MSI ) + return -EINVAL; + if ( !IS_PRIV(current->domain) ) return -EPERM; @@ -840,7 +844,7 @@ int map_domain_pirq( d->arch.pirq_vector[pirq] = vector; d->arch.vector_pirq[vector] = pirq; -done: + done: spin_unlock_irqrestore(&desc->lock, flags); return ret; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:34 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:34 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjt0-0001gq-Cm; Wed, 05 Nov 2008 07:01:34 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrg-0000sk-0t for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:12 -0800 X-ASG-Debug-ID: 1225897192-62a20008000d-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id C4882DCA0E for ; Wed, 5 Nov 2008 07:00:08 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id vc77yjSDKdol2Gmn for ; Wed, 05 Nov 2008 07:00:08 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563378 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563378" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:07 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F07CQ004440 for ; Wed, 5 Nov 2008 07:00:07 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0Uoa015724 for ; Wed, 5 Nov 2008 07:00:30 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0UqH015720 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:30 -0800 Message-Id: <200811051500.mA5F0UqH015720@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:27 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, hvm, xenoprof: Add fully support of HVM guest to xenoprofile on Intel P6. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897208 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, hvm, xenoprof: Add fully support of HVM guest to xenoprofile on Intel P6. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225114275 0 # Node ID 2a022ee37392715647abf75e44823d087d0e1d45 # Parent 4413d53a8320809e93142ed599a81e1bfe5ae900 x86, hvm, xenoprof: Add fully support of HVM guest to xenoprofile on Intel P6. Signed-off-by: Ronghui Duan --- xen/arch/x86/hvm/vmx/vmx.c | 6 + xen/arch/x86/hvm/vmx/vpmu_core2.c | 20 ++++++ xen/arch/x86/oprofile/nmi_int.c | 51 +++++++++++++++ xen/arch/x86/oprofile/op_model_ppro.c | 103 ++++++++++++++++++++++++++++++- xen/arch/x86/oprofile/op_x86_model.h | 5 + xen/common/xenoprof.c | 2 xen/include/asm-x86/hvm/vmx/vpmu.h | 2 xen/include/asm-x86/hvm/vmx/vpmu_core2.h | 22 ------ xen/include/xen/xenoprof.h | 3 9 files changed, 187 insertions(+), 27 deletions(-) diff -r 4413d53a8320 -r 2a022ee37392 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Mon Oct 27 13:31:15 2008 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -132,6 +133,7 @@ static void vmx_vcpu_destroy(struct vcpu { vmx_destroy_vmcs(v); vpmu_destroy(v); + passive_domain_destroy(v); } #ifdef __x86_64__ @@ -1666,6 +1668,8 @@ static int vmx_msr_read_intercept(struct default: if ( vpmu_do_rdmsr(regs) ) goto done; + if ( passive_domain_do_rdmsr(regs) ) + goto done; switch ( long_mode_do_msr_read(regs) ) { case HNDL_unhandled: @@ -1860,6 +1864,8 @@ static int vmx_msr_write_intercept(struc goto gp_fault; default: if ( vpmu_do_wrmsr(regs) ) + return X86EMUL_OKAY; + if ( passive_domain_do_wrmsr(regs) ) return X86EMUL_OKAY; if ( wrmsr_viridian_regs(ecx, regs->eax, regs->edx) ) diff -r 4413d53a8320 -r 2a022ee37392 xen/arch/x86/hvm/vmx/vpmu_core2.c --- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Oct 27 13:31:15 2008 +0000 @@ -35,6 +35,26 @@ #include #include +u32 core2_counters_msr[] = { + MSR_CORE_PERF_FIXED_CTR0, + MSR_CORE_PERF_FIXED_CTR1, + MSR_CORE_PERF_FIXED_CTR2}; + +/* Core 2 Non-architectual Performance Control MSRs. */ +u32 core2_ctrls_msr[] = { + MSR_CORE_PERF_FIXED_CTR_CTRL, + MSR_IA32_PEBS_ENABLE, + MSR_IA32_DS_AREA}; + +struct pmumsr core2_counters = { + 3, + core2_counters_msr +}; + +struct pmumsr core2_ctrls = { + 3, + core2_ctrls_msr +}; static int arch_pmc_cnt; static int core2_get_pmc_count(void) diff -r 4413d53a8320 -r 2a022ee37392 xen/arch/x86/oprofile/nmi_int.c --- a/xen/arch/x86/oprofile/nmi_int.c Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/arch/x86/oprofile/nmi_int.c Mon Oct 27 13:31:15 2008 +0000 @@ -36,6 +36,55 @@ static char *cpu_type; static char *cpu_type; extern int is_active(struct domain *d); +extern int is_passive(struct domain *d); + +int passive_domain_do_rdmsr(struct cpu_user_regs *regs) +{ + u64 msr_content; + int type, index; + struct vpmu_struct *vpmu = vcpu_vpmu(current); + + if ( model->is_arch_pmu_msr == NULL ) + return 0; + if ( !model->is_arch_pmu_msr((u64)regs->ecx, &type, &index) ) + return 0; + if ( !(vpmu->flags & PASSIVE_DOMAIN_ALLOCATED) ) + if ( ! model->allocated_msr(current) ) + return 0; + + model->load_msr(current, type, index, &msr_content); + regs->eax = msr_content & 0xFFFFFFFF; + regs->edx = msr_content >> 32; + return 1; +} + + +int passive_domain_do_wrmsr(struct cpu_user_regs *regs) +{ + u64 msr_content; + int type, index; + struct vpmu_struct *vpmu = vcpu_vpmu(current); + + if ( model->is_arch_pmu_msr == NULL ) + return 0; + if ( !model->is_arch_pmu_msr((u64)regs->ecx, &type, &index) ) + return 0; + + if ( !(vpmu->flags & PASSIVE_DOMAIN_ALLOCATED) ) + if ( ! model->allocated_msr(current) ) + return 0; + + msr_content = (u32)regs->eax | ((u64)regs->edx << 32); + model->save_msr(current, type, index, msr_content); + return 1; +} + +void passive_domain_destroy(struct vcpu *v) +{ + struct vpmu_struct *vpmu = vcpu_vpmu(v); + if ( vpmu->flags & PASSIVE_DOMAIN_ALLOCATED ) + model->free_msr(v); +} static int nmi_callback(struct cpu_user_regs *regs, int cpu) { @@ -46,6 +95,8 @@ static int nmi_callback(struct cpu_user_ if ( ovf && is_active(current->domain) && !xen_mode ) send_guest_vcpu_virq(current, VIRQ_XENOPROF); + if ( ovf == 2 ) + test_and_set_bool(current->nmi_pending); return 1; } diff -r 4413d53a8320 -r 2a022ee37392 xen/arch/x86/oprofile/op_model_ppro.c --- a/xen/arch/x86/oprofile/op_model_ppro.c Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/arch/x86/oprofile/op_model_ppro.c Mon Oct 27 13:31:15 2008 +0000 @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "op_x86_model.h" #include "op_counter.h" @@ -39,9 +41,11 @@ #define CTRL_SET_KERN(val,k) (val |= ((k & 1) << 17)) #define CTRL_SET_UM(val, m) (val |= (m << 8)) #define CTRL_SET_EVENT(val, e) (val |= e) - +#define IS_ACTIVE(val) (val & (1 << 22) ) +#define IS_ENABLE(val) (val & (1 << 20) ) static unsigned long reset_value[NUM_COUNTERS]; int ppro_has_global_ctrl = 0; +extern int is_passive(struct domain *d); static void ppro_fill_in_addresses(struct op_msrs * const msrs) { @@ -103,6 +107,7 @@ static int ppro_check_ctrs(unsigned int int ovf = 0; unsigned long eip = regs->eip; int mode = xenoprofile_get_mode(current, regs); + struct arch_msr_pair *msrs_content = vcpu_vpmu(current)->context; for (i = 0 ; i < NUM_COUNTERS; ++i) { if (!reset_value[i]) @@ -111,7 +116,18 @@ static int ppro_check_ctrs(unsigned int if (CTR_OVERFLOWED(low)) { xenoprof_log_event(current, regs, eip, mode, i); CTR_WRITE(reset_value[i], msrs, i); - ovf = 1; + if ( is_passive(current->domain) && (mode != 2) && + (vcpu_vpmu(current)->flags & PASSIVE_DOMAIN_ALLOCATED) ) + { + if ( IS_ACTIVE(msrs_content[i].control) ) + { + msrs_content[i].counter = (low | (unsigned long)high << 32); + if ( IS_ENABLE(msrs_content[i].control) ) + ovf = 2; + } + } + if ( !ovf ) + ovf = 1; } } @@ -159,6 +175,82 @@ static void ppro_stop(struct op_msrs con wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0); } +static int ppro_is_arch_pmu_msr(u64 msr_index, int *type, int *index) +{ + if ( (msr_index >= MSR_IA32_PERFCTR0) && + (msr_index < (MSR_IA32_PERFCTR0 + NUM_COUNTERS)) ) + { + *type = MSR_TYPE_ARCH_COUNTER; + *index = msr_index - MSR_IA32_PERFCTR0; + return 1; + } + if ( (msr_index >= MSR_P6_EVNTSEL0) && + (msr_index < (MSR_P6_EVNTSEL0 + NUM_CONTROLS)) ) + { + *type = MSR_TYPE_ARCH_CTRL; + *index = msr_index - MSR_P6_EVNTSEL0; + return 1; + } + + return 0; +} + +static int ppro_allocate_msr(struct vcpu *v) +{ + struct vpmu_struct *vpmu = vcpu_vpmu(v); + struct arch_msr_pair *msr_content; + + msr_content = xmalloc_bytes( sizeof(struct arch_msr_pair) * NUM_COUNTERS ); + if ( !msr_content ) + goto out; + memset(msr_content, 0, sizeof(struct arch_msr_pair) * NUM_COUNTERS); + vpmu->context = (void *)msr_content; + vpmu->flags = 0; + vpmu->flags |= PASSIVE_DOMAIN_ALLOCATED; + return 1; +out: + gdprintk(XENLOG_WARNING, "Insufficient memory for oprofile, oprofile is " + "unavailable on domain %d vcpu %d.\n", + v->vcpu_id, v->domain->domain_id); + return 0; +} + +static void ppro_free_msr(struct vcpu *v) +{ + struct vpmu_struct *vpmu = vcpu_vpmu(v); + + xfree(vpmu->context); + vpmu->flags &= ~PASSIVE_DOMAIN_ALLOCATED; +} + +static void ppro_load_msr(struct vcpu *v, int type, int index, u64 *msr_content) +{ + struct arch_msr_pair *msrs = vcpu_vpmu(v)->context; + switch ( type ) + { + case MSR_TYPE_ARCH_COUNTER: + *msr_content = msrs[index].counter; + break; + case MSR_TYPE_ARCH_CTRL: + *msr_content = msrs[index].control; + break; + } +} + +static void ppro_save_msr(struct vcpu *v, int type, int index, u64 msr_content) +{ + struct arch_msr_pair *msrs = vcpu_vpmu(v)->context; + + switch ( type ) + { + case MSR_TYPE_ARCH_COUNTER: + msrs[index].counter = msr_content; + break; + case MSR_TYPE_ARCH_CTRL: + msrs[index].control = msr_content; + break; + } +} struct op_x86_model_spec const op_ppro_spec = { .num_counters = NUM_COUNTERS, @@ -167,5 +259,10 @@ struct op_x86_model_spec const op_ppro_s .setup_ctrs = &ppro_setup_ctrs, .check_ctrs = &ppro_check_ctrs, .start = &ppro_start, - .stop = &ppro_stop + .stop = &ppro_stop, + .is_arch_pmu_msr = &ppro_is_arch_pmu_msr, + .allocated_msr = &ppro_allocate_msr, + .free_msr = &ppro_free_msr, + .load_msr = &ppro_load_msr, + .save_msr = &ppro_save_msr }; diff -r 4413d53a8320 -r 2a022ee37392 xen/arch/x86/oprofile/op_x86_model.h --- a/xen/arch/x86/oprofile/op_x86_model.h Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/arch/x86/oprofile/op_x86_model.h Mon Oct 27 13:31:15 2008 +0000 @@ -41,6 +41,11 @@ struct op_x86_model_spec { struct cpu_user_regs * const regs); void (*start)(struct op_msrs const * const msrs); void (*stop)(struct op_msrs const * const msrs); + int (*is_arch_pmu_msr)(u64 msr_index, int *type, int *index); + int (*allocated_msr)(struct vcpu *v); + void (*free_msr)(struct vcpu *v); + void (*load_msr)(struct vcpu * const v, int type, int index, u64 *msr_content); + void (*save_msr)(struct vcpu * const v, int type, int index, u64 msr_content); }; extern struct op_x86_model_spec const op_ppro_spec; diff -r 4413d53a8320 -r 2a022ee37392 xen/common/xenoprof.c --- a/xen/common/xenoprof.c Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/common/xenoprof.c Mon Oct 27 13:31:15 2008 +0000 @@ -85,7 +85,7 @@ int is_active(struct domain *d) return ((x != NULL) && (x->domain_type == XENOPROF_DOMAIN_ACTIVE)); } -static int is_passive(struct domain *d) +int is_passive(struct domain *d) { struct xenoprof *x = d->xenoprof; return ((x != NULL) && (x->domain_type == XENOPROF_DOMAIN_PASSIVE)); diff -r 4413d53a8320 -r 2a022ee37392 xen/include/asm-x86/hvm/vmx/vpmu.h --- a/xen/include/asm-x86/hvm/vmx/vpmu.h Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/include/asm-x86/hvm/vmx/vpmu.h Mon Oct 27 13:31:15 2008 +0000 @@ -67,7 +67,7 @@ struct vpmu_struct { #define VPMU_CONTEXT_ALLOCATED 0x1 #define VPMU_CONTEXT_LOADED 0x2 #define VPMU_RUNNING 0x4 - +#define PASSIVE_DOMAIN_ALLOCATED 0x8 int vpmu_do_wrmsr(struct cpu_user_regs *regs); int vpmu_do_rdmsr(struct cpu_user_regs *regs); int vpmu_do_interrupt(struct cpu_user_regs *regs); diff -r 4413d53a8320 -r 2a022ee37392 xen/include/asm-x86/hvm/vmx/vpmu_core2.h --- a/xen/include/asm-x86/hvm/vmx/vpmu_core2.h Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/include/asm-x86/hvm/vmx/vpmu_core2.h Mon Oct 27 13:31:15 2008 +0000 @@ -23,28 +23,6 @@ #ifndef __ASM_X86_HVM_VPMU_CORE_H_ #define __ASM_X86_HVM_VPMU_CORE_H_ -/* Core 2 Non-architectual Performance Counter MSRs. */ -u32 core2_counters_msr[] = { - MSR_CORE_PERF_FIXED_CTR0, - MSR_CORE_PERF_FIXED_CTR1, - MSR_CORE_PERF_FIXED_CTR2}; - -/* Core 2 Non-architectual Performance Control MSRs. */ -u32 core2_ctrls_msr[] = { - MSR_CORE_PERF_FIXED_CTR_CTRL, - MSR_IA32_PEBS_ENABLE, - MSR_IA32_DS_AREA}; - -struct pmumsr core2_counters = { - 3, - core2_counters_msr -}; - -struct pmumsr core2_ctrls = { - 3, - core2_ctrls_msr -}; - struct arch_msr_pair { u64 counter; u64 control; diff -r 4413d53a8320 -r 2a022ee37392 xen/include/xen/xenoprof.h --- a/xen/include/xen/xenoprof.h Mon Oct 27 13:29:35 2008 +0000 +++ b/xen/include/xen/xenoprof.h Mon Oct 27 13:31:15 2008 +0000 @@ -75,4 +75,7 @@ int acquire_pmu_ownship(int pmu_ownershi int acquire_pmu_ownship(int pmu_ownership); void release_pmu_ownship(int pmu_ownership); +int passive_domain_do_rdmsr(struct cpu_user_regs *regs); +int passive_domain_do_wrmsr(struct cpu_user_regs *regs); +void passive_domain_destroy(struct vcpu *v); #endif /* __XEN__XENOPROF_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:41 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:41 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjt6-0001kx-U0; Wed, 05 Nov 2008 07:01:41 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrj-0000uU-Ar for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:15 -0800 X-ASG-Debug-ID: 1225897212-62a200090001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 15F2CDCA19 for ; Wed, 5 Nov 2008 07:00:13 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id kleXUyuJNBSYf02x for ; Wed, 05 Nov 2008 07:00:13 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563400 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563400" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:13 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0DIQ004452 for ; Wed, 5 Nov 2008 07:00:13 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0aDq015820 for ; Wed, 5 Nov 2008 07:00:36 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0a8E015819 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:36 -0800 Message-Id: <200811051500.mA5F0a8E015819@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:35 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] hvm: Do not mess with APIC timer deadline if in one-shot mode. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897214 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] hvm: Do not mess with APIC timer deadline if in one-shot mode. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225190182 0 # Node ID 16eede82385477740830a8c4ddc0a5a200c851c7 # Parent 748af1e5d67c5f4604d095f95b9c953ae1d5adcc hvm: Do not mess with APIC timer deadline if in one-shot mode. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vpt.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 748af1e5d67c -r 16eede823854 xen/arch/x86/hvm/vpt.c --- a/xen/arch/x86/hvm/vpt.c Tue Oct 28 10:35:15 2008 +0000 +++ b/xen/arch/x86/hvm/vpt.c Tue Oct 28 10:36:22 2008 +0000 @@ -389,7 +389,7 @@ void create_periodic_time( * LAPIC ticks for process accounting can see long sequences of process * ticks incorrectly accounted to interrupt processing. */ - if ( pt->source == PTSRC_lapic ) + if ( !pt->one_shot && (pt->source == PTSRC_lapic) ) pt->scheduled += delta >> 1; pt->cb = cb; pt->priv = data; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:47 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:47 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjtD-0001oz-Bg; Wed, 05 Nov 2008 07:01:47 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrj-0000uc-Km for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:15 -0800 X-ASG-Debug-ID: 1225897212-62a200090002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 0415DDCA1C for ; Wed, 5 Nov 2008 07:00:14 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id EL5IA4Ooiq5jlUIq for ; Wed, 05 Nov 2008 07:00:14 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563401 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563401" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:14 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0DAt004455 for ; Wed, 5 Nov 2008 07:00:13 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0bUn015837 for ; Wed, 5 Nov 2008 07:00:37 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0bhs015836 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:37 -0800 Message-Id: <200811051500.mA5F0bhs015836@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:36 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xend: Fix typo in waitForBackend() for phantom VBDs X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897215 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] xend: Fix typo in waitForBackend() for phantom VBDs X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225190250 0 # Node ID 2c20d026bb55722247c0d9ab81c125118a10346f # Parent 16eede82385477740830a8c4ddc0a5a200c851c7 xend: Fix typo in waitForBackend() for phantom VBDs Signed-off-by: Masaki Kanno --- tools/python/xen/xend/server/DevController.py | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 16eede823854 -r 2c20d026bb55 tools/python/xen/xend/server/DevController.py --- a/tools/python/xen/xend/server/DevController.py Tue Oct 28 10:36:22 2008 +0000 +++ b/tools/python/xen/xend/server/DevController.py Tue Oct 28 10:37:30 2008 +0000 @@ -542,7 +542,7 @@ class DevController: xswatch(statusPath, hotplugStatusCallback, ev, result) ev.wait(DEVICE_CREATE_TIMEOUT) err = xstransact.Read(statusPath, HOTPLUG_ERROR_NODE) - if result['status'] != 'Connected': + if result['status'] != Connected: return (result['status'], err) backpath = self.readVm(devid, "backend") _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:52 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:52 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjtI-0001sh-Qk; Wed, 05 Nov 2008 07:01:52 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjri-0000uT-Vy for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:15 -0800 X-ASG-Debug-ID: 1225897212-62a200090000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 659D8DCA14 for ; Wed, 5 Nov 2008 07:00:13 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id BmGngG0GVyJcavC6 for ; Wed, 05 Nov 2008 07:00:13 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563395 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563395" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:12 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0CXV004449 for ; Wed, 5 Nov 2008 07:00:12 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0ZtD015786 for ; Wed, 5 Nov 2008 07:00:35 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0Y2d015785 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:34 -0800 Message-Id: <200811051500.mA5F0Y2d015785@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:34 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xenoprof: Small fixes. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897213 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] xenoprof: Small fixes. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225190115 0 # Node ID 748af1e5d67c5f4604d095f95b9c953ae1d5adcc # Parent 8d41996e6897c52bbcfacda68e6911c7459eb2b8 xenoprof: Small fixes. Signed-off-by: Ronghui Duan Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/oprofile/op_model_ppro.c | 2 +- xen/include/asm-x86/xenoprof.h | 3 +++ xen/include/xen/xenoprof.h | 3 --- 4 files changed, 5 insertions(+), 5 deletions(-) diff -r 8d41996e6897 -r 748af1e5d67c xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Mon Oct 27 18:51:52 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Oct 28 10:35:15 2008 +0000 @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include #include #include +#include enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised }; diff -r 8d41996e6897 -r 748af1e5d67c xen/arch/x86/oprofile/op_model_ppro.c --- a/xen/arch/x86/oprofile/op_model_ppro.c Mon Oct 27 18:51:52 2008 +0000 +++ b/xen/arch/x86/oprofile/op_model_ppro.c Tue Oct 28 10:35:15 2008 +0000 @@ -121,7 +121,7 @@ static int ppro_check_ctrs(unsigned int { if ( IS_ACTIVE(msrs_content[i].control) ) { - msrs_content[i].counter = (low | (unsigned long)high << 32); + msrs_content[i].counter = (low | (u64)high << 32); if ( IS_ENABLE(msrs_content[i].control) ) ovf = 2; } diff -r 8d41996e6897 -r 748af1e5d67c xen/include/asm-x86/xenoprof.h --- a/xen/include/asm-x86/xenoprof.h Mon Oct 27 18:51:52 2008 +0000 +++ b/xen/include/asm-x86/xenoprof.h Tue Oct 28 10:35:15 2008 +0000 @@ -64,6 +64,9 @@ void xenoprof_backtrace( "xenoprof/x86 with autotranslated mode enabled" \ "isn't supported yet\n"); \ } while (0) +int passive_domain_do_rdmsr(struct cpu_user_regs *regs); +int passive_domain_do_wrmsr(struct cpu_user_regs *regs); +void passive_domain_destroy(struct vcpu *v); #endif /* __ASM_X86_XENOPROF_H__ */ diff -r 8d41996e6897 -r 748af1e5d67c xen/include/xen/xenoprof.h --- a/xen/include/xen/xenoprof.h Mon Oct 27 18:51:52 2008 +0000 +++ b/xen/include/xen/xenoprof.h Tue Oct 28 10:35:15 2008 +0000 @@ -75,7 +75,4 @@ int acquire_pmu_ownship(int pmu_ownershi int acquire_pmu_ownship(int pmu_ownership); void release_pmu_ownship(int pmu_ownership); -int passive_domain_do_rdmsr(struct cpu_user_regs *regs); -int passive_domain_do_wrmsr(struct cpu_user_regs *regs); -void passive_domain_destroy(struct vcpu *v); #endif /* __XEN__XENOPROF_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:01:59 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:01:59 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjtO-0001wd-TZ; Wed, 05 Nov 2008 07:01:58 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrk-0000vP-NG for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:16 -0800 X-ASG-Debug-ID: 1225897212-62a200090003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 05783DCA1C for ; Wed, 5 Nov 2008 07:00:15 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id lZ9AJf2Qmef8wEN5 for ; Wed, 05 Nov 2008 07:00:15 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563402 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563402" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:15 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0Ew2004458 for ; Wed, 5 Nov 2008 07:00:14 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0c3e015854 for ; Wed, 5 Nov 2008 07:00:38 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0cZw015853 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:38 -0800 Message-Id: <200811051500.mA5F0cZw015853@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:37 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Fix circular page reference destruction in relinquish_memory(). X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897216 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86: Fix circular page reference destruction in relinquish_memory(). X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225193120 0 # Node ID 19549b9766fdd68380ded8efd975c41269ab2801 # Parent 2c20d026bb55722247c0d9ab81c125118a10346f x86: Fix circular page reference destruction in relinquish_memory(). Tested by Jan Beulich and fixes a memory leak, but there is more to be done here. Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 1 - xen/arch/x86/mm.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff -r 2c20d026bb55 -r 19549b9766fd xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Tue Oct 28 10:37:30 2008 +0000 +++ b/xen/arch/x86/domain.c Tue Oct 28 11:25:20 2008 +0000 @@ -1687,7 +1687,6 @@ static int relinquish_memory( { if ( free_page_type(page, x, 0) != 0 ) BUG(); - put_page(page); break; } } diff -r 2c20d026bb55 -r 19549b9766fd xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Tue Oct 28 10:37:30 2008 +0000 +++ b/xen/arch/x86/mm.c Tue Oct 28 11:25:20 2008 +0000 @@ -1973,6 +1973,7 @@ int free_page_type(struct page_info *pag page->nr_validated_ptes = 1U << PAGETABLE_ORDER; page->partial_pte = 0; } + switch ( type & PGT_type_mask ) { case PGT_l1_page_table: @@ -1998,6 +1999,15 @@ int free_page_type(struct page_info *pag BUG(); } + return rc; +} + + +static int __put_final_page_type( + struct page_info *page, unsigned long type, int preemptible) +{ + int rc = free_page_type(page, type, preemptible); + /* No need for atomic update of type_info here: noone else updates it. */ if ( rc == 0 ) { @@ -2062,7 +2072,7 @@ static int __put_page_type(struct page_i x, nx)) != x) ) continue; /* We cleared the 'valid bit' so we do the clean up. */ - return free_page_type(page, x, preemptible); + return __put_final_page_type(page, x, preemptible); } /* _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:04 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:04 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjtU-00020t-Hc; Wed, 05 Nov 2008 07:02:04 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrl-0000vd-I9 for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:17 -0800 X-ASG-Debug-ID: 1225897212-62a200090004-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 0B6E9DCA22 for ; Wed, 5 Nov 2008 07:00:16 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id BxmMnZByW1cyXB2w for ; Wed, 05 Nov 2008 07:00:16 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563403 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563403" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:16 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0FrQ004461 for ; Wed, 5 Nov 2008 07:00:15 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0dtK015871 for ; Wed, 5 Nov 2008 07:00:39 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0c8s015870 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:38 -0800 Message-Id: <200811051500.mA5F0c8s015870@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:38 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] cpufreq: domain structure update from array to linked list X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897217 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] cpufreq: domain structure update from array to linked list X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225275253 0 # Node ID 2c7665f04038e4282e4f7de11716ba441d0f12c7 # Parent 19549b9766fdd68380ded8efd975c41269ab2801 cpufreq: domain structure update from array to linked list Current cpufreq domain is an array cpufreq_dom_map[NR_CPUS]. However, domain number may be sparse or bigger than NR_CPUS. Signed-off-by: Jinsong Liu --- xen/drivers/cpufreq/cpufreq.c | 99 ++++++++++++++++++++++++++++++------------ 1 files changed, 72 insertions(+), 27 deletions(-) diff -r 19549b9766fd -r 2c7665f04038 xen/drivers/cpufreq/cpufreq.c --- a/xen/drivers/cpufreq/cpufreq.c Tue Oct 28 11:25:20 2008 +0000 +++ b/xen/drivers/cpufreq/cpufreq.c Wed Oct 29 10:14:13 2008 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -44,8 +45,12 @@ #include #include -/* TODO: change to link list later as domain number may be sparse */ -static cpumask_t cpufreq_dom_map[NR_CPUS]; +struct cpufreq_dom { + unsigned int dom; + cpumask_t map; + struct list_head node; +}; +static LIST_HEAD(cpufreq_dom_list_head); int cpufreq_limit_change(unsigned int cpu) { @@ -72,48 +77,71 @@ int cpufreq_add_cpu(unsigned int cpu) { int ret = 0; unsigned int firstcpu; - unsigned int dom; + unsigned int dom, domexist = 0; unsigned int j; + struct list_head *pos; + struct cpufreq_dom *cpufreq_dom; struct cpufreq_policy new_policy; struct cpufreq_policy *policy; struct processor_performance *perf = &processor_pminfo[cpu]->perf; /* to protect the case when Px was not controlled by xen */ - if (!processor_pminfo[cpu] || !(perf->init & XEN_PX_INIT)) + if (!processor_pminfo[cpu] || + !(perf->init & XEN_PX_INIT) || + !cpu_online(cpu)) + return -EINVAL; + + if (cpufreq_cpu_policy[cpu]) return 0; - - if (!cpu_online(cpu) || cpufreq_cpu_policy[cpu]) - return -EINVAL; ret = cpufreq_statistic_init(cpu); if (ret) return ret; dom = perf->domain_info.domain; - if (cpus_weight(cpufreq_dom_map[dom])) { + + list_for_each(pos, &cpufreq_dom_list_head) { + cpufreq_dom = list_entry(pos, struct cpufreq_dom, node); + if (dom == cpufreq_dom->dom) { + domexist = 1; + break; + } + } + + if (domexist) { /* share policy with the first cpu since on same boat */ - firstcpu = first_cpu(cpufreq_dom_map[dom]); + firstcpu = first_cpu(cpufreq_dom->map); policy = cpufreq_cpu_policy[firstcpu]; cpufreq_cpu_policy[cpu] = policy; - cpu_set(cpu, cpufreq_dom_map[dom]); + cpu_set(cpu, cpufreq_dom->map); cpu_set(cpu, policy->cpus); printk(KERN_EMERG"adding CPU %u\n", cpu); } else { + cpufreq_dom = xmalloc(struct cpufreq_dom); + if (!cpufreq_dom) { + cpufreq_statistic_exit(cpu); + return -ENOMEM; + } + memset(cpufreq_dom, 0, sizeof(struct cpufreq_dom)); + cpufreq_dom->dom = dom; + cpu_set(cpu, cpufreq_dom->map); + list_add(&cpufreq_dom->node, &cpufreq_dom_list_head); + /* for the first cpu, setup policy and do init work */ policy = xmalloc(struct cpufreq_policy); if (!policy) { + list_del(&cpufreq_dom->node); + xfree(cpufreq_dom); cpufreq_statistic_exit(cpu); return -ENOMEM; } memset(policy, 0, sizeof(struct cpufreq_policy)); - + policy->cpu = cpu; + cpu_set(cpu, policy->cpus); cpufreq_cpu_policy[cpu] = policy; - cpu_set(cpu, cpufreq_dom_map[dom]); - cpu_set(cpu, policy->cpus); - - policy->cpu = cpu; + ret = cpufreq_driver->init(policy); if (ret) goto err1; @@ -124,7 +152,7 @@ int cpufreq_add_cpu(unsigned int cpu) * After get full cpumap of the coordination domain, * we can safely start gov here. */ - if (cpus_weight(cpufreq_dom_map[dom]) == + if (cpus_weight(cpufreq_dom->map) == perf->domain_info.num_processors) { memcpy(&new_policy, policy, sizeof(struct cpufreq_policy)); policy->governor = NULL; @@ -138,51 +166,68 @@ err2: err2: cpufreq_driver->exit(policy); err1: - for_each_cpu_mask(j, cpufreq_dom_map[dom]) { + for_each_cpu_mask(j, cpufreq_dom->map) { cpufreq_cpu_policy[j] = NULL; cpufreq_statistic_exit(j); } - cpus_clear(cpufreq_dom_map[dom]); + list_del(&cpufreq_dom->node); + xfree(cpufreq_dom); xfree(policy); return ret; } int cpufreq_del_cpu(unsigned int cpu) { - unsigned int dom; + unsigned int dom, domexist = 0; + struct list_head *pos; + struct cpufreq_dom *cpufreq_dom; struct cpufreq_policy *policy; struct processor_performance *perf = &processor_pminfo[cpu]->perf; /* to protect the case when Px was not controlled by xen */ - if (!processor_pminfo[cpu] || !(perf->init & XEN_PX_INIT)) + if (!processor_pminfo[cpu] || + !(perf->init & XEN_PX_INIT) || + !cpu_online(cpu)) + return -EINVAL; + + if (!cpufreq_cpu_policy[cpu]) return 0; - - if (!cpu_online(cpu) || !cpufreq_cpu_policy[cpu]) - return -EINVAL; dom = perf->domain_info.domain; policy = cpufreq_cpu_policy[cpu]; - printk(KERN_EMERG"deleting CPU %u\n", cpu); + list_for_each(pos, &cpufreq_dom_list_head) { + cpufreq_dom = list_entry(pos, struct cpufreq_dom, node); + if (dom == cpufreq_dom->dom) { + domexist = 1; + break; + } + } + + if (!domexist) + return -EINVAL; /* for the first cpu of the domain, stop gov */ - if (cpus_weight(cpufreq_dom_map[dom]) == + if (cpus_weight(cpufreq_dom->map) == perf->domain_info.num_processors) __cpufreq_governor(policy, CPUFREQ_GOV_STOP); cpufreq_cpu_policy[cpu] = NULL; cpu_clear(cpu, policy->cpus); - cpu_clear(cpu, cpufreq_dom_map[dom]); + cpu_clear(cpu, cpufreq_dom->map); cpufreq_statistic_exit(cpu); /* for the last cpu of the domain, clean room */ /* It's safe here to free freq_table, drv_data and policy */ - if (!cpus_weight(cpufreq_dom_map[dom])) { + if (!cpus_weight(cpufreq_dom->map)) { cpufreq_driver->exit(policy); + list_del(&cpufreq_dom->node); + xfree(cpufreq_dom); xfree(policy); } + printk(KERN_EMERG"deleting CPU %u\n", cpu); return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:10 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:10 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjta-00024r-PT; Wed, 05 Nov 2008 07:02:10 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrm-0000w7-AN for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:18 -0800 X-ASG-Debug-ID: 1225897212-62a200090005-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 03A05DCA24 for ; Wed, 5 Nov 2008 07:00:17 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id ErTNu74YeRWSOn6S for ; Wed, 05 Nov 2008 07:00:17 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563404 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563404" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:17 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0GWf004464 for ; Wed, 5 Nov 2008 07:00:16 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0euo015889 for ; Wed, 5 Nov 2008 07:00:40 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0dR3015888 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:39 -0800 Message-Id: <200811051500.mA5F0dR3015888@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:39 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Specify NUMA node when alloc'ing compat l4 for 32-on-64 guest X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897218 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86: Specify NUMA node when alloc'ing compat l4 for 32-on-64 guest X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225275575 0 # Node ID bec755616e8e4b8a0dd65f7a28edc1b8936906d4 # Parent 2c7665f04038e4282e4f7de11716ba441d0f12c7 x86: Specify NUMA node when alloc'ing compat l4 for 32-on-64 guest Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -r 2c7665f04038 -r bec755616e8e xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Wed Oct 29 10:14:13 2008 +0000 +++ b/xen/arch/x86/domain.c Wed Oct 29 10:19:35 2008 +0000 @@ -174,9 +174,10 @@ void free_vcpu_struct(struct vcpu *v) static int setup_compat_l4(struct vcpu *v) { - struct page_info *pg = alloc_domheap_page(NULL, 0); + struct page_info *pg; l4_pgentry_t *l4tab; + pg = alloc_domheap_page(NULL, MEMF_node(vcpu_to_node(v))); if ( pg == NULL ) return -ENOMEM; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:17 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:17 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjth-000298-IH; Wed, 05 Nov 2008 07:02:17 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrn-0000ws-KM for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:19 -0800 X-ASG-Debug-ID: 1225897212-62a200090006-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 16187DCA28 for ; Wed, 5 Nov 2008 07:00:18 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id IdFoVmT8M2PCrA6h for ; Wed, 05 Nov 2008 07:00:18 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563405 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563405" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:18 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0IU2004467 for ; Wed, 5 Nov 2008 07:00:18 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0fhP015909 for ; Wed, 5 Nov 2008 07:00:41 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0fnM015907 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:41 -0800 Message-Id: <200811051500.mA5F0fnM015907@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:40 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] minios: Define __INSIDE_MINIOS__ rather than __MINIOS__ X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897219 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] minios: Define __INSIDE_MINIOS__ rather than __MINIOS__ X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225281878 0 # Node ID 183d2d7adc2f02db63aedaf199e3b006d2e4a053 # Parent bec755616e8e4b8a0dd65f7a28edc1b8936906d4 minios: Define __INSIDE_MINIOS__ rather than __MINIOS__ Signed-off-by: Ian Jackson --- extras/mini-os/Makefile | 3 --- extras/mini-os/include/sched.h | 2 +- extras/mini-os/minios.mk | 3 +++ 3 files changed, 4 insertions(+), 4 deletions(-) diff -r bec755616e8e -r 183d2d7adc2f extras/mini-os/Makefile --- a/extras/mini-os/Makefile Wed Oct 29 10:19:35 2008 +0000 +++ b/extras/mini-os/Makefile Wed Oct 29 12:04:38 2008 +0000 @@ -17,9 +17,6 @@ include minios.mk # Set tester flags # CFLAGS += -DBLKTEST_WRITE - -# Make the headers define our internal stuff -CFLAGS += -D__MINIOS__ # Define some default flags for linking. LDLIBS := diff -r bec755616e8e -r 183d2d7adc2f extras/mini-os/include/sched.h --- a/extras/mini-os/include/sched.h Wed Oct 29 10:19:35 2008 +0000 +++ b/extras/mini-os/include/sched.h Wed Oct 29 12:04:38 2008 +0000 @@ -48,7 +48,7 @@ void exit_thread(void) __attribute__((no void exit_thread(void) __attribute__((noreturn)); void schedule(void); -#ifdef __MINIOS__ +#ifdef __INSIDE_MINIOS__ #define current get_current() #endif diff -r bec755616e8e -r 183d2d7adc2f extras/mini-os/minios.mk --- a/extras/mini-os/minios.mk Wed Oct 29 10:19:35 2008 +0000 +++ b/extras/mini-os/minios.mk Wed Oct 29 12:04:38 2008 +0000 @@ -25,6 +25,9 @@ else else DEF_CFLAGS += -O3 endif + +# Make the headers define our internal stuff +DEF_CFLAGS += -D__INSIDE_MINIOS__ # Build the CFLAGS and ASFLAGS for compiling and assembling. # DEF_... flags are the common mini-os flags, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:23 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:23 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjtn-0002D5-NQ; Wed, 05 Nov 2008 07:02:23 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjro-0000xT-Fq for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:20 -0800 X-ASG-Debug-ID: 1225897212-62a200090007-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 294C5DCA31 for ; Wed, 5 Nov 2008 07:00:19 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id aL6mTvAIJwG3hdSp for ; Wed, 05 Nov 2008 07:00:19 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563406 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563406" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:19 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0Jer004470 for ; Wed, 5 Nov 2008 07:00:19 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0gHw015929 for ; Wed, 5 Nov 2008 07:00:42 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0gXq015928 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:42 -0800 Message-Id: <200811051500.mA5F0gXq015928@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:41 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Fix relinquish_memory() for PGT_partial pages. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897220 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Fix relinquish_memory() for PGT_partial pages. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225285777 0 # Node ID ae100f264f6ad4e828de1ca2d228cccf6ed2bbfd # Parent 183d2d7adc2f02db63aedaf199e3b006d2e4a053 x86: Fix relinquish_memory() for PGT_partial pages. Original patch by Jan Beulich. Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 2 ++ 1 files changed, 2 insertions(+) diff -r 183d2d7adc2f -r ae100f264f6a xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Wed Oct 29 12:04:38 2008 +0000 +++ b/xen/arch/x86/domain.c Wed Oct 29 13:09:37 2008 +0000 @@ -1688,6 +1688,8 @@ static int relinquish_memory( { if ( free_page_type(page, x, 0) != 0 ) BUG(); + if ( x & PGT_partial ) + page->u.inuse.type_info--; break; } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:29 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:29 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjtt-0002H3-R5; Wed, 05 Nov 2008 07:02:29 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrq-0000yN-60 for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:22 -0800 X-ASG-Debug-ID: 1225897212-62a200090008-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 97C3FDCA39 for ; Wed, 5 Nov 2008 07:00:21 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id sNecOULbcNOwC5zF for ; Wed, 05 Nov 2008 07:00:21 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563407 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563407" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:20 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0Kej004473 for ; Wed, 5 Nov 2008 07:00:20 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0hlj015948 for ; Wed, 5 Nov 2008 07:00:43 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0hnd015947 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:43 -0800 Message-Id: <200811051500.mA5F0hnd015947@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:42 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] cpufreq.c: shut up compiler about cpufreq_dom X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897221 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] cpufreq.c: shut up compiler about cpufreq_dom X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225299485 0 # Node ID 6a8fea290af5e6894fc9cbdbfd549ca01ee9ab76 # Parent ae100f264f6ad4e828de1ca2d228cccf6ed2bbfd cpufreq.c: shut up compiler about cpufreq_dom Some versions of GCC are too stupid to figure out that cpufreq_dom is only used if !!domexist and always set in that case, and complain that it may be used uninitialised. Signed-off-by: Ian Jackson --- xen/drivers/cpufreq/cpufreq.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r ae100f264f6a -r 6a8fea290af5 xen/drivers/cpufreq/cpufreq.c --- a/xen/drivers/cpufreq/cpufreq.c Wed Oct 29 13:09:37 2008 +0000 +++ b/xen/drivers/cpufreq/cpufreq.c Wed Oct 29 16:58:05 2008 +0000 @@ -80,7 +80,7 @@ int cpufreq_add_cpu(unsigned int cpu) unsigned int dom, domexist = 0; unsigned int j; struct list_head *pos; - struct cpufreq_dom *cpufreq_dom; + struct cpufreq_dom *cpufreq_dom = NULL; struct cpufreq_policy new_policy; struct cpufreq_policy *policy; struct processor_performance *perf = &processor_pminfo[cpu]->perf; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:40 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:40 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxju4-0002L0-IG; Wed, 05 Nov 2008 07:02:40 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrr-0000zF-Ei for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:23 -0800 X-ASG-Debug-ID: 1225897212-62a200090009-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 1C446DCA4F for ; Wed, 5 Nov 2008 07:00:22 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id txhdLkIic273K58g for ; Wed, 05 Nov 2008 07:00:22 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563408 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563408" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:22 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0MQx004476 for ; Wed, 5 Nov 2008 07:00:22 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0jCl015984 for ; Wed, 5 Nov 2008 07:00:45 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0joq015983 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:45 -0800 Message-Id: <200811051500.mA5F0joq015983@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:44 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] cpufreq: Fix another build failure. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897223 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] cpufreq: Fix another build failure. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225307212 0 # Node ID 85a2a54c70c866b3dc0802a0bbb7b9c9c0881fcd # Parent 6a8fea290af5e6894fc9cbdbfd549ca01ee9ab76 cpufreq: Fix another build failure. Signed-off-by: Ian Jackson --- xen/drivers/cpufreq/cpufreq.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 6a8fea290af5 -r 85a2a54c70c8 xen/drivers/cpufreq/cpufreq.c --- a/xen/drivers/cpufreq/cpufreq.c Wed Oct 29 16:58:05 2008 +0000 +++ b/xen/drivers/cpufreq/cpufreq.c Wed Oct 29 19:06:52 2008 +0000 @@ -181,7 +181,7 @@ int cpufreq_del_cpu(unsigned int cpu) { unsigned int dom, domexist = 0; struct list_head *pos; - struct cpufreq_dom *cpufreq_dom; + struct cpufreq_dom *cpufreq_dom = NULL; struct cpufreq_policy *policy; struct processor_performance *perf = &processor_pminfo[cpu]->perf; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:46 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:46 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjuA-0002Os-8A; Wed, 05 Nov 2008 07:02:46 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrs-0000zi-By for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:24 -0800 X-ASG-Debug-ID: 1225897212-62a20009000a-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 084FFDCA51 for ; Wed, 5 Nov 2008 07:00:23 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 7LikjYUYsX1OoYRE for ; Wed, 05 Nov 2008 07:00:23 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563409 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563409" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:23 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0MjV004479 for ; Wed, 5 Nov 2008 07:00:22 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0ksY016001 for ; Wed, 5 Nov 2008 07:00:46 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0k2e016000 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:46 -0800 Message-Id: <200811051500.mA5F0k2e016000@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:45 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] rombios: fix int13h for floppy disk X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897224 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] rombios: fix int13h for floppy disk X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225373227 0 # Node ID e8f0e625e043cd71e61dc6fb6124a3367298bbfe # Parent 85a2a54c70c866b3dc0802a0bbb7b9c9c0881fcd rombios: fix int13h for floppy disk A floppy on HVM can't be read correctly. This fix is taken from upstream bochs-2.3.7. Signed-off-by: Kouya Shimura --- tools/firmware/rombios/rombios.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 85a2a54c70c8 -r e8f0e625e043 tools/firmware/rombios/rombios.c --- a/tools/firmware/rombios/rombios.c Wed Oct 29 19:06:52 2008 +0000 +++ b/tools/firmware/rombios/rombios.c Thu Oct 30 13:27:07 2008 +0000 @@ -7216,7 +7216,7 @@ BX_INFO("floppy: drive>1 || head>1 ...\n outb(0x03f5, head); outb(0x03f5, sector); outb(0x03f5, 2); // 512 byte sector size - outb(0x03f5, 0); // last sector number possible on track + outb(0x03f5, sector + num_sectors - 1); // last sector to read on track outb(0x03f5, 0); // Gap length outb(0x03f5, 0xff); // Gap length @@ -7364,7 +7364,7 @@ BX_INFO("floppy: drive>1 || head>1 ...\n outb(0x03f5, head); outb(0x03f5, sector); outb(0x03f5, 2); // 512 byte sector size - outb(0x03f5, 0); // last sector number possible on track + outb(0x03f5, sector + num_sectors - 1); // last sector to write on track outb(0x03f5, 0); // Gap length outb(0x03f5, 0xff); // Gap length _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:52 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:52 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjuG-0002Sb-0Y; Wed, 05 Nov 2008 07:02:52 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrt-00010C-Dv for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:25 -0800 X-ASG-Debug-ID: 1225897212-62a20009000b-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 0046ADCA5F for ; Wed, 5 Nov 2008 07:00:24 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id VWZAACPNZIeEBj2v for ; Wed, 05 Nov 2008 07:00:24 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563410 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563410" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:24 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0NIO004482 for ; Wed, 5 Nov 2008 07:00:23 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0l2J016018 for ; Wed, 5 Nov 2008 07:00:47 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0kno016017 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:46 -0800 Message-Id: <200811051500.mA5F0kno016017@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:46 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] CPUIDLE: add idx field X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897225 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] CPUIDLE: add idx field X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225373597 0 # Node ID 1137464400a81bbfe7a5093a07102b2ded7a4684 # Parent e8f0e625e043cd71e61dc6fb6124a3367298bbfe CPUIDLE: add idx field This patch adds an idx field in the 'struct acpi_processor_cx'. It can simplify some coding lines. Signed-off-by: Guanqun Lu Signed-off-by: Wei Gang = --- xen/arch/x86/acpi/cpu_idle.c | 19 ++++++++++++------- xen/include/xen/cpuidle.h | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff -r e8f0e625e043 -r 1137464400a8 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Thu Oct 30 13:27:07 2008 +0000 +++ b/xen/arch/x86/acpi/cpu_idle.c Thu Oct 30 13:33:17 2008 +0000 @@ -75,13 +75,14 @@ static void print_acpi_power(uint32_t cp printk("==cpu%d==\n", cpu); printk("active state:\t\tC%d\n", - power->last_state ? (int)(power->last_state - power->states) : -1); + power->last_state ? power->last_state->idx : -1); printk("max_cstate:\t\tC%d\n", max_cstate); printk("states:\n"); for ( i = 1; i < power->count; i++ ) { - printk((power->last_state == &power->states[i]) ? " *" : " "); + printk((power->last_state && power->last_state->idx == i) ? + " *" : " "); printk("C%d:\t", i); printk("type[C%d] ", power->states[i].type); printk("latency[%03d] ", power->states[i].latency); @@ -222,7 +223,7 @@ static void acpi_processor_idle(void) if ( power->flags.bm_check && acpi_idle_bm_check() && cx->type == ACPI_STATE_C3 ) cx = power->safe_state; - if ( cx - &power->states[0] > max_cstate ) + if ( cx->idx > max_cstate ) cx = &power->states[max_cstate]; } if ( !cx ) @@ -328,7 +329,7 @@ static void acpi_processor_idle(void) } /* Trace cpu idle entry */ - TRACE_1D(TRC_PM_IDLE_ENTRY, cx - &power->states[0]); + TRACE_1D(TRC_PM_IDLE_ENTRY, cx->idx); /* * Before invoking C3, be aware that TSC/APIC timer may be * stopped by H/W. Without carefully handling of TSC/APIC stop issues, @@ -349,7 +350,7 @@ static void acpi_processor_idle(void) /* recovering TSC */ cstate_restore_tsc(); /* Trace cpu idle exit */ - TRACE_1D(TRC_PM_IDLE_EXIT, cx - &power->states[0]); + TRACE_1D(TRC_PM_IDLE_EXIT, cx->idx); if ( power->flags.bm_check && power->flags.bm_control ) { @@ -387,7 +388,12 @@ static void acpi_processor_idle(void) static int init_cx_pminfo(struct acpi_processor_power *acpi_power) { + int i; + memset(acpi_power, 0, sizeof(*acpi_power)); + + for ( i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++ ) + acpi_power->states[i].idx = i; acpi_power->states[ACPI_STATE_C1].type = ACPI_STATE_C1; @@ -761,8 +767,7 @@ int pmstat_get_cx_stat(uint32_t cpuid, s return 0; } - stat->last = (power->last_state) ? - (int)(power->last_state - &power->states[0]) : 0; + stat->last = power->last_state ? power->last_state->idx : 0; stat->nr = power->count; stat->idle_time = v->runstate.time[RUNSTATE_running]; if ( v->is_running ) diff -r e8f0e625e043 -r 1137464400a8 xen/include/xen/cpuidle.h --- a/xen/include/xen/cpuidle.h Thu Oct 30 13:27:07 2008 +0000 +++ b/xen/include/xen/cpuidle.h Thu Oct 30 13:33:17 2008 +0000 @@ -32,6 +32,7 @@ struct acpi_processor_cx { + u8 idx; u8 valid; u8 type; u32 address; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:02:58 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:02:58 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjuL-0002Wd-V1; Wed, 05 Nov 2008 07:02:57 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjru-00010n-KT for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:26 -0800 X-ASG-Debug-ID: 1225897212-62a20009000c-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 1401DDCA67 for ; Wed, 5 Nov 2008 07:00:25 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id svSGbQCDwypMeKEN for ; Wed, 05 Nov 2008 07:00:25 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563411 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563411" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:24 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0Oao004485 for ; Wed, 5 Nov 2008 07:00:24 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0l1H016035 for ; Wed, 5 Nov 2008 07:00:47 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0lKs016034 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:47 -0800 Message-Id: <200811051500.mA5F0lKs016034@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:47 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] CPUIDLE: Support C1 FFH entry X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897226 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] CPUIDLE: Support C1 FFH entry X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225373620 0 # Node ID 112e81ae5824e213b181a65f944b729ba270d658 # Parent 1137464400a81bbfe7a5093a07102b2ded7a4684 CPUIDLE: Support C1 FFH entry Add support for C1 FFH (mwait) entry. Meanwhile add timing for C1. The timing for C1 should be accurate for FFH case, but may not for halt case. Signed-off-by: Wei Gang --- xen/arch/x86/acpi/cpu_idle.c | 84 ++++++++++++++++++--------------------- xen/arch/x86/acpi/cpuidle_menu.c | 14 ------ xen/include/xen/cpuidle.h | 7 ++- 3 files changed, 48 insertions(+), 57 deletions(-) diff -r 1137464400a8 -r 112e81ae5824 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Thu Oct 30 13:33:17 2008 +0000 +++ b/xen/arch/x86/acpi/cpu_idle.c Thu Oct 30 13:33:40 2008 +0000 @@ -140,20 +140,26 @@ static void acpi_processor_ffh_cstate_en static void acpi_idle_do_entry(struct acpi_processor_cx *cx) { - if ( cx->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE ) - { + int unused; + + switch ( cx->entry_method ) + { + case ACPI_CSTATE_EM_FFH: /* Call into architectural FFH based C-state */ acpi_processor_ffh_cstate_enter(cx); - } - else - { - int unused; + return; + case ACPI_CSTATE_EM_SYSIO: /* IO port based C-state */ inb(cx->address); /* Dummy wait op - must do something useless after P_LVL2 read because chipsets cannot guarantee that STPCLK# signal gets asserted in time to freeze execution properly. */ unused = inl(pmtmr_ioport); + return; + case ACPI_CSTATE_EM_HALT: + acpi_safe_halt(); + local_irq_disable(); + return; } } @@ -253,35 +259,11 @@ static void acpi_processor_idle(void) switch ( cx->type ) { case ACPI_STATE_C1: - /* Trace cpu idle entry */ - TRACE_1D(TRC_PM_IDLE_ENTRY, 1); - - /* - * Invoke C1. - * Use the appropriate idle routine, the one that would - * be used without acpi C-states. - */ - if ( pm_idle_save ) - pm_idle_save(); - else - acpi_safe_halt(); - - /* Trace cpu idle exit */ - TRACE_1D(TRC_PM_IDLE_EXIT, 1); - - /* - * TBD: Can't get time duration while in C1, as resumes - * go to an ISR rather than here. Need to instrument - * base interrupt handler. - */ - sleep_ticks = 0xFFFFFFFF; - break; - case ACPI_STATE_C2: - if ( local_apic_timer_c2_ok ) + if ( cx->type == ACPI_STATE_C1 || local_apic_timer_c2_ok ) { /* Trace cpu idle entry */ - TRACE_1D(TRC_PM_IDLE_ENTRY, 2); + TRACE_1D(TRC_PM_IDLE_ENTRY, cx->idx); /* Get start time (ticks) */ t1 = inl(pmtmr_ioport); /* Invoke C2 */ @@ -289,7 +271,7 @@ static void acpi_processor_idle(void) /* Get end time (ticks) */ t2 = inl(pmtmr_ioport); /* Trace cpu idle exit */ - TRACE_1D(TRC_PM_IDLE_EXIT, 2); + TRACE_1D(TRC_PM_IDLE_EXIT, cx->idx); /* Re-enable interrupts */ local_irq_enable(); @@ -396,6 +378,7 @@ static int init_cx_pminfo(struct acpi_pr acpi_power->states[i].idx = i; acpi_power->states[ACPI_STATE_C1].type = ACPI_STATE_C1; + acpi_power->states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_EM_HALT; acpi_power->states[ACPI_STATE_C0].valid = 1; acpi_power->states[ACPI_STATE_C1].valid = 1; @@ -492,16 +475,13 @@ static int check_cx(struct acpi_processo break; case ACPI_ADR_SPACE_FIXED_HARDWARE: - if ( cx->type > ACPI_STATE_C1 ) - { - if ( cx->reg.bit_width != VENDOR_INTEL || - cx->reg.bit_offset != NATIVE_CSTATE_BEYOND_HALT ) - return -EINVAL; - - /* assume all logical cpu has the same support for mwait */ - if ( acpi_processor_ffh_cstate_probe(cx) ) - return -EINVAL; - } + if ( cx->reg.bit_width != VENDOR_INTEL || + cx->reg.bit_offset != NATIVE_CSTATE_BEYOND_HALT ) + return -EINVAL; + + /* assume all logical cpu has the same support for mwait */ + if ( acpi_processor_ffh_cstate_probe(cx) ) + return -EINVAL; break; default: @@ -605,7 +585,23 @@ static void set_cx( cx->valid = 1; cx->type = xen_cx->type; cx->address = xen_cx->reg.address; - cx->space_id = xen_cx->reg.space_id; + + switch ( xen_cx->reg.space_id ) + { + case ACPI_ADR_SPACE_FIXED_HARDWARE: + if ( xen_cx->reg.bit_width == VENDOR_INTEL && + xen_cx->reg.bit_offset == NATIVE_CSTATE_BEYOND_HALT ) + cx->entry_method = ACPI_CSTATE_EM_FFH; + else + cx->entry_method = ACPI_CSTATE_EM_HALT; + break; + case ACPI_ADR_SPACE_SYSTEM_IO: + cx->entry_method = ACPI_CSTATE_EM_SYSIO; + break; + default: + cx->entry_method = ACPI_CSTATE_EM_NONE; + } + cx->latency = xen_cx->latency; cx->power = xen_cx->power; diff -r 1137464400a8 -r 112e81ae5824 xen/arch/x86/acpi/cpuidle_menu.c --- a/xen/arch/x86/acpi/cpuidle_menu.c Thu Oct 30 13:33:17 2008 +0000 +++ b/xen/arch/x86/acpi/cpuidle_menu.c Thu Oct 30 13:33:40 2008 +0000 @@ -59,7 +59,7 @@ static int menu_select(struct acpi_proce data->expected_us = (u32) get_sleep_length_ns() / 1000; /* find the deepest idle state that satisfies our constraints */ - for ( i = 1; i < power->count; i++ ) + for ( i = 2; i < power->count; i++ ) { struct acpi_processor_cx *s = &power->states[i]; @@ -81,17 +81,7 @@ static void menu_reflect(struct acpi_pro unsigned int last_residency; unsigned int measured_us; - /* - * Ugh, this idle state doesn't support residency measurements, so we - * are basically lost in the dark. As a compromise, assume we slept - * for one full standard timer tick. However, be aware that this - * could potentially result in a suboptimal state transition. - */ - if ( target->type == ACPI_STATE_C1 ) - last_residency = USEC_PER_SEC / HZ; - else - last_residency = power->last_residency; - + last_residency = power->last_residency; measured_us = last_residency + data->elapsed_us; /* if wrapping, set to max uint (-1) */ diff -r 1137464400a8 -r 112e81ae5824 xen/include/xen/cpuidle.h --- a/xen/include/xen/cpuidle.h Thu Oct 30 13:33:17 2008 +0000 +++ b/xen/include/xen/cpuidle.h Thu Oct 30 13:33:40 2008 +0000 @@ -30,13 +30,18 @@ #define ACPI_PROCESSOR_MAX_POWER 8 #define CPUIDLE_NAME_LEN 16 +#define ACPI_CSTATE_EM_NONE 0 +#define ACPI_CSTATE_EM_SYSIO 1 +#define ACPI_CSTATE_EM_FFH 2 +#define ACPI_CSTATE_EM_HALT 3 + struct acpi_processor_cx { u8 idx; u8 valid; u8 type; u32 address; - u8 space_id; + u8 entry_method; /* ACPI_CSTATE_EM_xxx */ u32 latency; u32 latency_ticks; u32 power; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:04 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:04 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjuS-0002bI-Iv; Wed, 05 Nov 2008 07:03:04 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrv-00011P-Go for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:27 -0800 X-ASG-Debug-ID: 1225897212-62a20009000d-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 097F3DCA69 for ; Wed, 5 Nov 2008 07:00:26 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id wcMwo8V67lsJJwlH for ; Wed, 05 Nov 2008 07:00:26 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563412 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563412" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:26 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0P3e004488 for ; Wed, 5 Nov 2008 07:00:25 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0muI016053 for ; Wed, 5 Nov 2008 07:00:48 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0mlB016052 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:48 -0800 Message-Id: <200811051500.mA5F0mlB016052@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:48 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: eliminate domain cleanup hack in favor of using the preemptable X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897227 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: eliminate domain cleanup hack in favor of using the preemptable X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225377468 0 # Node ID 9e5cf6778a6d1057900c3709f544ac176ddfab67 # Parent 112e81ae5824e213b181a65f944b729ba270d658 x86: eliminate domain cleanup hack in favor of using the preemptable flavors of the respective functions. Signed-off-by: Jan Beulich --- xen/arch/x86/domain.c | 57 +++++++++++++++++++++---------------------- xen/arch/x86/mm.c | 12 --------- xen/include/asm-x86/config.h | 8 ------ 3 files changed, 30 insertions(+), 47 deletions(-) diff -r 112e81ae5824 -r 9e5cf6778a6d xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Thu Oct 30 13:33:40 2008 +0000 +++ b/xen/arch/x86/domain.c Thu Oct 30 14:37:48 2008 +0000 @@ -1640,31 +1640,22 @@ static int relinquish_memory( } if ( test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) ) - put_page_and_type(page); + ret = put_page_and_type_preemptible(page, 1); + switch ( ret ) + { + case 0: + break; + case -EAGAIN: + case -EINTR: + set_bit(_PGT_pinned, &page->u.inuse.type_info); + put_page(page); + goto out; + default: + BUG(); + } if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) put_page(page); - -#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION - /* - * Forcibly drop reference counts of page tables above top most (which - * were skipped to prevent long latencies due to deep recursion - see - * the special treatment in free_lX_table()). - */ - y = page->u.inuse.type_info; - if ( (type < PGT_root_page_table) && - unlikely(((y + PGT_type_mask) & - (PGT_type_mask|PGT_validated)) == type) ) - { - BUG_ON((y & PGT_count_mask) >= - (page->count_info & PGC_count_mask)); - while ( y & PGT_count_mask ) - { - put_page_and_type(page); - y = page->u.inuse.type_info; - } - } -#endif /* * Forcibly invalidate top-most, still valid page tables at this point @@ -1686,8 +1677,23 @@ static int relinquish_memory( x & ~(PGT_validated|PGT_partial)); if ( likely(y == x) ) { - if ( free_page_type(page, x, 0) != 0 ) + /* No need for atomic update of type_info here: noone else updates it. */ + switch ( ret = free_page_type(page, x, 1) ) + { + case 0: + break; + case -EINTR: + page->u.inuse.type_info |= PGT_validated; + put_page(page); + ret = -EAGAIN; + goto out; + case -EAGAIN: + page->u.inuse.type_info |= PGT_partial; + put_page(page); + goto out; + default: BUG(); + } if ( x & PGT_partial ) page->u.inuse.type_info--; break; @@ -1834,11 +1840,6 @@ int domain_relinquish_resources(struct d /* fallthrough */ case RELMEM_done: -#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION - ret = relinquish_memory(d, &d->page_list, PGT_l1_page_table); - if ( ret ) - return ret; -#endif break; default: diff -r 112e81ae5824 -r 9e5cf6778a6d xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu Oct 30 13:33:40 2008 +0000 +++ b/xen/arch/x86/mm.c Thu Oct 30 14:37:48 2008 +0000 @@ -1343,7 +1343,7 @@ static void free_l1_table(struct page_in static int free_l2_table(struct page_info *page, int preemptible) { -#if defined(CONFIG_COMPAT) || defined(DOMAIN_DESTRUCT_AVOID_RECURSION) +#ifdef CONFIG_COMPAT struct domain *d = page_get_owner(page); #endif unsigned long pfn = page_to_mfn(page); @@ -1351,11 +1351,6 @@ static int free_l2_table(struct page_inf unsigned int i = page->nr_validated_ptes - 1; int err = 0; -#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION - if ( d->arch.relmem == RELMEM_l3 ) - return 0; -#endif - pl2e = map_domain_page(pfn); ASSERT(page->nr_validated_ptes); @@ -1384,11 +1379,6 @@ static int free_l3_table(struct page_inf l3_pgentry_t *pl3e; unsigned int i = page->nr_validated_ptes - !page->partial_pte; int rc = 0; - -#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION - if ( d->arch.relmem == RELMEM_l4 ) - return 0; -#endif pl3e = map_domain_page(pfn); diff -r 112e81ae5824 -r 9e5cf6778a6d xen/include/asm-x86/config.h --- a/xen/include/asm-x86/config.h Thu Oct 30 13:33:40 2008 +0000 +++ b/xen/include/asm-x86/config.h Thu Oct 30 14:37:48 2008 +0000 @@ -40,14 +40,6 @@ #define CONFIG_HOTPLUG 1 #define CONFIG_HOTPLUG_CPU 1 - -/* - * Avoid deep recursion when tearing down pagetables during domain destruction, - * causing dom0 to become unresponsive and Xen to miss time-critical softirq - * deadlines. This will ultimately be replaced by built-in preemptibility of - * get_page_type(). - */ -#define DOMAIN_DESTRUCT_AVOID_RECURSION 1 #define HZ 100 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:10 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:10 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjuY-0002f1-IN; Wed, 05 Nov 2008 07:03:10 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrx-00012j-EF for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:29 -0800 X-ASG-Debug-ID: 1225897212-62a20009000e-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 952B0DCA6B for ; Wed, 5 Nov 2008 07:00:27 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id Dtnwx9qnsozCjJzY for ; Wed, 05 Nov 2008 07:00:27 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563413 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563413" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:27 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0QJT004491 for ; Wed, 5 Nov 2008 07:00:26 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0n3s016070 for ; Wed, 5 Nov 2008 07:00:49 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0n0B016069 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:49 -0800 Message-Id: <200811051500.mA5F0n0B016069@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:49 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: fix preemptable page type handling X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897228 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: fix preemptable page type handling X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225378404 0 # Node ID ed30f4efb728980ba84c34fc7fdc7be5f5a4a78e # Parent 9e5cf6778a6d1057900c3709f544ac176ddfab67 x86: fix preemptable page type handling - retain a page reference when PGT_partial is set on a page (and drop it when clearing that flag) - don't drop a page reference never acquired when freeing the page type of a page where the allocation of the type got preempted (and never completed) - don't acquire a page reference when allocating the page type of a page where freeing the type got preempted (and never completed, and hence didn't drop the respective reference) Signed-off-by: Jan Beulich --- xen/arch/x86/domain.c | 8 ++ xen/arch/x86/mm.c | 140 +++++++++++++++++++++++++++++++---------------- xen/include/asm-x86/mm.h | 30 +++++++++- 3 files changed, 129 insertions(+), 49 deletions(-) diff -r 9e5cf6778a6d -r ed30f4efb728 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Thu Oct 30 14:37:48 2008 +0000 +++ b/xen/arch/x86/domain.c Thu Oct 30 14:53:24 2008 +0000 @@ -1684,18 +1684,24 @@ static int relinquish_memory( break; case -EINTR: page->u.inuse.type_info |= PGT_validated; + if ( x & PGT_partial ) + put_page(page); put_page(page); ret = -EAGAIN; goto out; case -EAGAIN: page->u.inuse.type_info |= PGT_partial; - put_page(page); + if ( x & PGT_partial ) + put_page(page); goto out; default: BUG(); } if ( x & PGT_partial ) + { page->u.inuse.type_info--; + put_page(page); + } break; } } diff -r 9e5cf6778a6d -r ed30f4efb728 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu Oct 30 14:37:48 2008 +0000 +++ b/xen/arch/x86/mm.c Thu Oct 30 14:53:24 2008 +0000 @@ -566,19 +566,21 @@ static int get_page_and_type_from_pagenr static int get_page_and_type_from_pagenr(unsigned long page_nr, unsigned long type, struct domain *d, + int partial, int preemptible) { struct page_info *page = mfn_to_page(page_nr); int rc; - if ( unlikely(!get_page_from_pagenr(page_nr, d)) ) + if ( likely(partial >= 0) && + unlikely(!get_page_from_pagenr(page_nr, d)) ) return -EINVAL; rc = (preemptible ? get_page_type_preemptible(page, type) : (get_page_type(page, type) ? 0 : -EINVAL)); - if ( rc ) + if ( unlikely(rc) && partial >= 0 ) put_page(page); return rc; @@ -761,7 +763,7 @@ get_page_from_l2e( } rc = get_page_and_type_from_pagenr( - l2e_get_pfn(l2e), PGT_l1_page_table, d, 0); + l2e_get_pfn(l2e), PGT_l1_page_table, d, 0, 0); if ( unlikely(rc == -EINVAL) && get_l2_linear_pagetable(l2e, pfn, d) ) rc = 0; @@ -772,7 +774,7 @@ define_get_linear_pagetable(l3); define_get_linear_pagetable(l3); static int get_page_from_l3e( - l3_pgentry_t l3e, unsigned long pfn, struct domain *d, int preemptible) + l3_pgentry_t l3e, unsigned long pfn, struct domain *d, int partial, int preemptible) { int rc; @@ -786,7 +788,7 @@ get_page_from_l3e( } rc = get_page_and_type_from_pagenr( - l3e_get_pfn(l3e), PGT_l2_page_table, d, preemptible); + l3e_get_pfn(l3e), PGT_l2_page_table, d, partial, preemptible); if ( unlikely(rc == -EINVAL) && get_l3_linear_pagetable(l3e, pfn, d) ) rc = 0; @@ -797,7 +799,7 @@ define_get_linear_pagetable(l4); define_get_linear_pagetable(l4); static int get_page_from_l4e( - l4_pgentry_t l4e, unsigned long pfn, struct domain *d, int preemptible) + l4_pgentry_t l4e, unsigned long pfn, struct domain *d, int partial, int preemptible) { int rc; @@ -811,7 +813,7 @@ get_page_from_l4e( } rc = get_page_and_type_from_pagenr( - l4e_get_pfn(l4e), PGT_l3_page_table, d, preemptible); + l4e_get_pfn(l4e), PGT_l3_page_table, d, partial, preemptible); if ( unlikely(rc == -EINVAL) && get_l4_linear_pagetable(l4e, pfn, d) ) rc = 0; @@ -961,23 +963,32 @@ static int put_page_from_l2e(l2_pgentry_ return 1; } +static int __put_page_type(struct page_info *, int preemptible); static int put_page_from_l3e(l3_pgentry_t l3e, unsigned long pfn, - int preemptible) + int partial, int preemptible) { if ( (l3e_get_flags(l3e) & _PAGE_PRESENT) && (l3e_get_pfn(l3e) != pfn) ) + { + if ( unlikely(partial > 0) ) + return __put_page_type(l3e_get_page(l3e), preemptible); return put_page_and_type_preemptible(l3e_get_page(l3e), preemptible); + } return 1; } #if CONFIG_PAGING_LEVELS >= 4 static int put_page_from_l4e(l4_pgentry_t l4e, unsigned long pfn, - int preemptible) + int partial, int preemptible) { if ( (l4e_get_flags(l4e) & _PAGE_PRESENT) && (l4e_get_pfn(l4e) != pfn) ) + { + if ( unlikely(partial > 0) ) + return __put_page_type(l4e_get_page(l4e), preemptible); return put_page_and_type_preemptible(l4e_get_page(l4e), preemptible); + } return 1; } #endif @@ -1184,7 +1195,7 @@ static int alloc_l3_table(struct page_in unsigned long pfn = page_to_mfn(page); l3_pgentry_t *pl3e; unsigned int i; - int rc = 0; + int rc = 0, partial = page->partial_pte; #if CONFIG_PAGING_LEVELS == 3 /* @@ -1213,7 +1224,8 @@ static int alloc_l3_table(struct page_in if ( is_pv_32on64_domain(d) ) memset(pl3e + 4, 0, (L3_PAGETABLE_ENTRIES - 4) * sizeof(*pl3e)); - for ( i = page->nr_validated_ptes; i < L3_PAGETABLE_ENTRIES; i++ ) + for ( i = page->nr_validated_ptes; i < L3_PAGETABLE_ENTRIES; + i++, partial = 0 ) { if ( is_pv_32bit_domain(d) && (i == 3) ) { @@ -1224,16 +1236,17 @@ static int alloc_l3_table(struct page_in rc = get_page_and_type_from_pagenr(l3e_get_pfn(pl3e[i]), PGT_l2_page_table | PGT_pae_xen_l2, - d, preemptible); + d, partial, preemptible); } else if ( !is_guest_l3_slot(i) || - (rc = get_page_from_l3e(pl3e[i], pfn, d, preemptible)) > 0 ) + (rc = get_page_from_l3e(pl3e[i], pfn, d, + partial, preemptible)) > 0 ) continue; if ( rc == -EAGAIN ) { page->nr_validated_ptes = i; - page->partial_pte = 1; + page->partial_pte = partial ?: 1; } else if ( rc == -EINTR && i ) { @@ -1257,7 +1270,7 @@ static int alloc_l3_table(struct page_in if ( !is_guest_l3_slot(i) ) continue; unadjust_guest_l3e(pl3e[i], d); - put_page_from_l3e(pl3e[i], pfn, 0); + put_page_from_l3e(pl3e[i], pfn, 0, 0); } } @@ -1272,18 +1285,20 @@ static int alloc_l4_table(struct page_in unsigned long pfn = page_to_mfn(page); l4_pgentry_t *pl4e = page_to_virt(page); unsigned int i; - int rc = 0; - - for ( i = page->nr_validated_ptes; i < L4_PAGETABLE_ENTRIES; i++ ) + int rc = 0, partial = page->partial_pte; + + for ( i = page->nr_validated_ptes; i < L4_PAGETABLE_ENTRIES; + i++, partial = 0 ) { if ( !is_guest_l4_slot(d, i) || - (rc = get_page_from_l4e(pl4e[i], pfn, d, preemptible)) > 0 ) + (rc = get_page_from_l4e(pl4e[i], pfn, d, + partial, preemptible)) > 0 ) continue; if ( rc == -EAGAIN ) { page->nr_validated_ptes = i; - page->partial_pte = 1; + page->partial_pte = partial ?: 1; } else if ( rc == -EINTR ) { @@ -1299,7 +1314,7 @@ static int alloc_l4_table(struct page_in MEM_LOG("Failure in alloc_l4_table: entry %d", i); while ( i-- > 0 ) if ( is_guest_l4_slot(d, i) ) - put_page_from_l4e(pl4e[i], pfn, 0); + put_page_from_l4e(pl4e[i], pfn, 0, 0); } if ( rc < 0 ) return rc; @@ -1377,19 +1392,20 @@ static int free_l3_table(struct page_inf struct domain *d = page_get_owner(page); unsigned long pfn = page_to_mfn(page); l3_pgentry_t *pl3e; - unsigned int i = page->nr_validated_ptes - !page->partial_pte; - int rc = 0; + int rc = 0, partial = page->partial_pte; + unsigned int i = page->nr_validated_ptes - !partial; pl3e = map_domain_page(pfn); do { if ( is_guest_l3_slot(i) ) { - rc = put_page_from_l3e(pl3e[i], pfn, preemptible); + rc = put_page_from_l3e(pl3e[i], pfn, partial, preemptible); + if ( rc < 0 ) + break; + partial = 0; if ( rc > 0 ) continue; - if ( rc ) - break; unadjust_guest_l3e(pl3e[i], d); } } while ( i-- ); @@ -1399,7 +1415,7 @@ static int free_l3_table(struct page_inf if ( rc == -EAGAIN ) { page->nr_validated_ptes = i; - page->partial_pte = 1; + page->partial_pte = partial ?: -1; } else if ( rc == -EINTR && i < L3_PAGETABLE_ENTRIES - 1 ) { @@ -1416,18 +1432,21 @@ static int free_l4_table(struct page_inf struct domain *d = page_get_owner(page); unsigned long pfn = page_to_mfn(page); l4_pgentry_t *pl4e = page_to_virt(page); - unsigned int i = page->nr_validated_ptes - !page->partial_pte; - int rc = 0; + int rc = 0, partial = page->partial_pte; + unsigned int i = page->nr_validated_ptes - !partial; do { if ( is_guest_l4_slot(d, i) ) - rc = put_page_from_l4e(pl4e[i], pfn, preemptible); - } while ( rc >= 0 && i-- ); + rc = put_page_from_l4e(pl4e[i], pfn, partial, preemptible); + if ( rc < 0 ) + break; + partial = 0; + } while ( i-- ); if ( rc == -EAGAIN ) { page->nr_validated_ptes = i; - page->partial_pte = 1; + page->partial_pte = partial ?: -1; } else if ( rc == -EINTR && i < L4_PAGETABLE_ENTRIES - 1 ) { @@ -1703,7 +1722,7 @@ static int mod_l3_entry(l3_pgentry_t *pl return rc ? 0 : -EFAULT; } - rc = get_page_from_l3e(nl3e, pfn, d, preemptible); + rc = get_page_from_l3e(nl3e, pfn, d, 0, preemptible); if ( unlikely(rc < 0) ) return page_unlock(l3pg), rc; rc = 0; @@ -1732,7 +1751,7 @@ static int mod_l3_entry(l3_pgentry_t *pl } page_unlock(l3pg); - put_page_from_l3e(ol3e, pfn, 0); + put_page_from_l3e(ol3e, pfn, 0, 0); return rc; } @@ -1781,7 +1800,7 @@ static int mod_l4_entry(l4_pgentry_t *pl return rc ? 0 : -EFAULT; } - rc = get_page_from_l4e(nl4e, pfn, d, preemptible); + rc = get_page_from_l4e(nl4e, pfn, d, 0, preemptible); if ( unlikely(rc < 0) ) return page_unlock(l4pg), rc; rc = 0; @@ -1802,7 +1821,7 @@ static int mod_l4_entry(l4_pgentry_t *pl } page_unlock(l4pg); - put_page_from_l4e(ol4e, pfn, 0); + put_page_from_l4e(ol4e, pfn, 0, 0); return rc; } @@ -1865,6 +1884,10 @@ static int alloc_page_type(struct page_i { struct domain *owner = page_get_owner(page); int rc; + + /* Obtain an extra reference to retain if we set PGT_partial. */ + if ( preemptible && !get_page(page, owner) ) + return -EINVAL; /* A page table is dirtied when its type count becomes non-zero. */ if ( likely(owner != NULL) ) @@ -1900,8 +1923,13 @@ static int alloc_page_type(struct page_i if ( rc == -EAGAIN ) { page->u.inuse.type_info |= PGT_partial; - } - else if ( rc == -EINTR ) + return -EAGAIN; + } + + if ( preemptible ) + put_page(page); + + if ( rc == -EINTR ) { ASSERT((page->u.inuse.type_info & (PGT_count_mask|PGT_validated|PGT_partial)) == 1); @@ -2029,7 +2057,12 @@ static int __put_final_page_type( BUG_ON(rc != -EAGAIN); wmb(); page->u.inuse.type_info |= PGT_partial; - } + /* Must skip put_page() below. */ + preemptible = 0; + } + + if ( preemptible ) + put_page(page); return rc; } @@ -2039,6 +2072,10 @@ static int __put_page_type(struct page_i int preemptible) { unsigned long nx, x, y = page->u.inuse.type_info; + + /* Obtain an extra reference to retain if we set PGT_partial. */ + if ( preemptible && !get_page(page, page_get_owner(page)) ) + return -EINVAL; for ( ; ; ) { @@ -2061,6 +2098,8 @@ static int __put_page_type(struct page_i if ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) ) continue; + if ( x & PGT_partial ) + put_page(page); /* We cleared the 'valid bit' so we do the clean up. */ return __put_final_page_type(page, x, preemptible); } @@ -2081,8 +2120,15 @@ static int __put_page_type(struct page_i break; if ( preemptible && hypercall_preempt_check() ) + { + if ( preemptible ) + put_page(page); return -EINTR; - } + } + } + + if ( preemptible ) + put_page(page); return 0; } @@ -2187,7 +2233,11 @@ static int __get_page_type(struct page_i } if ( likely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) == x) ) + { + if ( (x & PGT_partial) && !(nx & PGT_partial) ) + put_page(page); break; + } if ( preemptible && hypercall_preempt_check() ) return -EINTR; @@ -2296,7 +2346,7 @@ int new_guest_cr3(unsigned long mfn) #endif okay = paging_mode_refcounts(d) ? get_page_from_pagenr(mfn, d) - : !get_page_and_type_from_pagenr(mfn, PGT_root_page_table, d, 0); + : !get_page_and_type_from_pagenr(mfn, PGT_root_page_table, d, 0, 0); if ( unlikely(!okay) ) { MEM_LOG("Error while installing new baseptr %lx", mfn); @@ -2540,7 +2590,7 @@ int do_mmuext_op( if ( paging_mode_refcounts(FOREIGNDOM) ) break; - rc = get_page_and_type_from_pagenr(mfn, type, FOREIGNDOM, 1); + rc = get_page_and_type_from_pagenr(mfn, type, FOREIGNDOM, 0, 1); okay = !rc; if ( unlikely(!okay) ) { @@ -2621,7 +2671,7 @@ int do_mmuext_op( okay = get_page_from_pagenr(mfn, d); else okay = !get_page_and_type_from_pagenr( - mfn, PGT_root_page_table, d, 0); + mfn, PGT_root_page_table, d, 0, 0); if ( unlikely(!okay) ) { MEM_LOG("Error while installing new mfn %lx", mfn); @@ -2728,7 +2778,7 @@ int do_mmuext_op( unsigned char *ptr; okay = !get_page_and_type_from_pagenr(mfn, PGT_writable_page, - FOREIGNDOM, 0); + FOREIGNDOM, 0, 0); if ( unlikely(!okay) ) { MEM_LOG("Error while clearing mfn %lx", mfn); @@ -2761,7 +2811,7 @@ int do_mmuext_op( } okay = !get_page_and_type_from_pagenr(mfn, PGT_writable_page, - FOREIGNDOM, 0); + FOREIGNDOM, 0, 0); if ( unlikely(!okay) ) { put_page(mfn_to_page(src_mfn)); diff -r 9e5cf6778a6d -r ed30f4efb728 xen/include/asm-x86/mm.h --- a/xen/include/asm-x86/mm.h Thu Oct 30 14:37:48 2008 +0000 +++ b/xen/include/asm-x86/mm.h Thu Oct 30 14:53:24 2008 +0000 @@ -61,12 +61,36 @@ struct page_info /* * When PGT_partial is true then this field is valid and indicates * that PTEs in the range [0, @nr_validated_ptes) have been validated. - * If @partial_pte is true then PTE at @nr_validated_ptes+1 has been - * partially validated. + * An extra page reference must be acquired (or not dropped) whenever + * PGT_partial gets set, and it must be dropped when the flag gets + * cleared. This is so that a get() leaving a page in partially + * validated state (where the caller would drop the reference acquired + * due to the getting of the type [apparently] failing [-EAGAIN]) + * would not accidentally result in a page left with zero general + * reference count, but non-zero type reference count (possible when + * the partial get() is followed immediately by domain destruction). + * Likewise, the ownership of the single type reference for partially + * (in-)validated pages is tied to this flag, i.e. the instance + * setting the flag must not drop that reference, whereas the instance + * clearing it will have to. + * + * If @partial_pte is positive then PTE at @nr_validated_ptes+1 has + * been partially validated. This implies that the general reference + * to the page (acquired from get_page_from_lNe()) would be dropped + * (again due to the apparent failure) and hence must be re-acquired + * when resuming the validation, but must not be dropped when picking + * up the page for invalidation. + * + * If @partial_pte is negative then PTE at @nr_validated_ptes+1 has + * been partially invalidated. This is basically the opposite case of + * above, i.e. the general reference to the page was not dropped in + * put_page_from_lNe() (due to the apparent failure), and hence it + * must be dropped when the put operation is resumed (and completes), + * but it must not be acquired if picking up the page for validation. */ struct { u16 nr_validated_ptes; - bool_t partial_pte; + s8 partial_pte; }; /* _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:17 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:17 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjuf-0002jM-47; Wed, 05 Nov 2008 07:03:17 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjrz-00014G-Mc for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:31 -0800 X-ASG-Debug-ID: 1225897228-686600010000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 227A1DCA6D for ; Wed, 5 Nov 2008 07:00:30 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id gz9qWoTj9ZFEEK5J for ; Wed, 05 Nov 2008 07:00:30 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563415 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563415" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:29 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0TV9004497 for ; Wed, 5 Nov 2008 07:00:29 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0qF2016115 for ; Wed, 5 Nov 2008 07:00:52 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0qgg016111 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:52 -0800 Message-Id: <200811051500.mA5F0qgg016111@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:51 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Change timer implementation to allow variable 'slop' in how late X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897231 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Change timer implementation to allow variable 'slop' in how late X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225461759 0 # Node ID f12d9595d07ceaa1b624a3e91774a3591f2cfc8c # Parent 85ba96069dfb3edf180656991aafa6cc8e368773 Change timer implementation to allow variable 'slop' in how late timers are fired. The default continues to be 50us, but this can be configured on Xen's command line. Signed-off-by: Yu Ke Signed-off-by: Wei Gang Signed-off-by: Keir Fraser --- xen/arch/x86/hpet.c | 2 xen/common/timer.c | 125 +++++++++++++++++++++++++++++------------------- xen/include/xen/time.h | 1 xen/include/xen/timer.h | 3 - 4 files changed, 79 insertions(+), 52 deletions(-) diff -r 85ba96069dfb -r f12d9595d07c xen/arch/x86/hpet.c --- a/xen/arch/x86/hpet.c Thu Oct 30 15:04:27 2008 +0000 +++ b/xen/arch/x86/hpet.c Fri Oct 31 14:02:39 2008 +0000 @@ -14,8 +14,6 @@ #include #include -#define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1)) - #define MAX_DELTA_NS MILLISECS(10*1000) #define MIN_DELTA_NS MICROSECS(20) diff -r 85ba96069dfb -r f12d9595d07c xen/common/timer.c --- a/xen/common/timer.c Thu Oct 30 15:04:27 2008 +0000 +++ b/xen/common/timer.c Fri Oct 31 14:02:39 2008 +0000 @@ -25,10 +25,12 @@ * We pull handlers off the timer list this far in future, * rather than reprogramming the time hardware. */ -#define TIMER_SLOP (50*1000) /* ns */ +static unsigned int timer_slop __read_mostly = 50000; /* 50 us */ +integer_param("timer_slop", timer_slop); struct timers { spinlock_t lock; + bool_t overflow; struct timer **heap; struct timer *list; struct timer *running; @@ -200,6 +202,7 @@ static int add_entry(struct timers *time return rc; /* Fall back to adding to the slower linked list. */ + timers->overflow = 1; t->status = TIMER_STATUS_in_list; return add_to_list(&timers->list, t); } @@ -258,6 +261,7 @@ void set_timer(struct timer *timer, s_ti __stop_timer(timer); timer->expires = expires; + timer->expires_end = expires + timer_slop; if ( likely(timer->status != TIMER_STATUS_killed) ) __add_timer(timer); @@ -344,19 +348,30 @@ void kill_timer(struct timer *timer) } +static void execute_timer(struct timers *ts, struct timer *t) +{ + void (*fn)(void *) = t->function; + void *data = t->data; + + ts->running = t; + spin_unlock_irq(&ts->lock); + (*fn)(data); + spin_lock_irq(&ts->lock); + ts->running = NULL; +} + + static void timer_softirq_action(void) { struct timer *t, **heap, *next; struct timers *ts; - s_time_t now, deadline; - void (*fn)(void *); - void *data; + s_time_t now; ts = &this_cpu(timers); heap = ts->heap; - /* If we are using overflow linked list, try to allocate a larger heap. */ - if ( unlikely(ts->list != NULL) ) + /* If we overflowed the heap, try to allocate a larger heap. */ + if ( unlikely(ts->overflow) ) { /* old_limit == (2^n)-1; new_limit == (2^(n+4))-1 */ int old_limit = GET_HEAP_LIMIT(heap); @@ -377,7 +392,26 @@ static void timer_softirq_action(void) spin_lock_irq(&ts->lock); - /* Try to move timers from overflow linked list to more efficient heap. */ + now = NOW(); + + /* Execute ready heap timers. */ + while ( (GET_HEAP_SIZE(heap) != 0) && + ((t = heap[1])->expires_end < now) ) + { + remove_from_heap(heap, t); + t->status = TIMER_STATUS_inactive; + execute_timer(ts, t); + } + + /* Execute ready list timers. */ + while ( ((t = ts->list) != NULL) && (t->expires_end < now) ) + { + ts->list = t->list_next; + t->status = TIMER_STATUS_inactive; + execute_timer(ts, t); + } + + /* Try to move timers from linked list to more efficient heap. */ next = ts->list; ts->list = NULL; while ( unlikely((t = next) != NULL) ) @@ -387,51 +421,44 @@ static void timer_softirq_action(void) add_entry(ts, t); } - now = NOW(); - - while ( (GET_HEAP_SIZE(heap) != 0) && - ((t = heap[1])->expires < (now + TIMER_SLOP)) ) - { - remove_entry(ts, t); - - ts->running = t; - - fn = t->function; - data = t->data; - - spin_unlock_irq(&ts->lock); - (*fn)(data); - spin_lock_irq(&ts->lock); - } - - deadline = GET_HEAP_SIZE(heap) ? heap[1]->expires : 0; - - while ( unlikely((t = ts->list) != NULL) ) - { - if ( t->expires >= (now + TIMER_SLOP) ) + ts->overflow = (ts->list != NULL); + if ( unlikely(ts->overflow) ) + { + /* Find earliest deadline at head of list or top of heap. */ + this_cpu(timer_deadline) = ts->list->expires; + if ( (GET_HEAP_SIZE(heap) != 0) && + ((t = heap[1])->expires < this_cpu(timer_deadline)) ) + this_cpu(timer_deadline) = t->expires; + } + else + { + /* + * Find the earliest deadline that encompasses largest number of timers + * on the heap. To do this we take timers from the heap while their + * valid deadline ranges continue to intersect. + */ + s_time_t start = 0, end = STIME_MAX; + struct timer **list_tail = &ts->list; + + while ( (GET_HEAP_SIZE(heap) != 0) && + ((t = heap[1])->expires <= end) ) { - if ( (deadline == 0) || (deadline > t->expires) ) - deadline = t->expires; - break; + remove_entry(ts, t); + + t->status = TIMER_STATUS_in_list; + t->list_next = NULL; + *list_tail = t; + list_tail = &t->list_next; + + start = t->expires; + if ( end > t->expires_end ) + end = t->expires_end; } - ts->list = t->list_next; - t->status = TIMER_STATUS_inactive; - - ts->running = t; - - fn = t->function; - data = t->data; - - spin_unlock_irq(&ts->lock); - (*fn)(data); - spin_lock_irq(&ts->lock); - } - - ts->running = NULL; - - this_cpu(timer_deadline) = deadline; - if ( !reprogram_timer(deadline) ) + this_cpu(timer_deadline) = start; + } + + if ( !reprogram_timer(this_cpu(timer_deadline)) ) raise_softirq(TIMER_SOFTIRQ); spin_unlock_irq(&ts->lock); diff -r 85ba96069dfb -r f12d9595d07c xen/include/xen/time.h --- a/xen/include/xen/time.h Thu Oct 30 15:04:27 2008 +0000 +++ b/xen/include/xen/time.h Fri Oct 31 14:02:39 2008 +0000 @@ -52,6 +52,7 @@ struct tm gmtime(unsigned long t); #define SECONDS(_s) ((s_time_t)((_s) * 1000000000ULL)) #define MILLISECS(_ms) ((s_time_t)((_ms) * 1000000ULL)) #define MICROSECS(_us) ((s_time_t)((_us) * 1000ULL)) +#define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1)) extern void update_vcpu_system_time(struct vcpu *v); extern void update_domain_wallclock_time(struct domain *d); diff -r 85ba96069dfb -r f12d9595d07c xen/include/xen/timer.h --- a/xen/include/xen/timer.h Thu Oct 30 15:04:27 2008 +0000 +++ b/xen/include/xen/timer.h Fri Oct 31 14:02:39 2008 +0000 @@ -15,12 +15,13 @@ struct timer { struct timer { /* System time expiry value (nanoseconds since boot). */ s_time_t expires; + s_time_t expires_end; /* Position in active-timer data structure. */ union { /* Timer-heap offset. */ unsigned int heap_offset; - /* Overflow linked list. */ + /* Linked list. */ struct timer *list_next; }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:23 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:23 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjul-0002nF-G4; Wed, 05 Nov 2008 07:03:23 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs1-000157-BK for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:33 -0800 X-ASG-Debug-ID: 1225897228-686600010001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id C8A00DCA6F for ; Wed, 5 Nov 2008 07:00:32 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id Cj5qqwNv67bEVKdd for ; Wed, 05 Nov 2008 07:00:32 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563416 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563416" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:31 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0VED004500 for ; Wed, 5 Nov 2008 07:00:31 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0s6v016152 for ; Wed, 5 Nov 2008 07:00:54 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0sXd016151 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:54 -0800 Message-Id: <200811051500.mA5F0sXd016151@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:53 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xend: ioport & irq persistence thru reboot X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897232 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] xend: ioport & irq persistence thru reboot X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225707789 0 # Node ID 91a2b9309a723637c31a52caa63dd78ead4f8fd2 # Parent f12d9595d07ceaa1b624a3e91774a3591f2cfc8c xend: ioport & irq persistence thru reboot When a domU is configured for a serial port as documented at: http://wiki.xensource.com/xenwiki/InstallationNotes the VM does see the serial port, however when dom0 is rebooted and the VM started it no longer has access to the serial port. xm list -l no longer shows the ioports or irq attributes Attached patch adds implementation of getDeviceConfiguration(), returns details dict and implements waitForDevice() to irqif.py and iopif.py. Also added preprocess_irq() to create.py. Signed-off-by: Pat Campbell --- tools/python/xen/xend/server/iopif.py | 20 +++++++++++++++++++- tools/python/xen/xend/server/irqif.py | 19 ++++++++++++++++++- tools/python/xen/xm/create.py | 9 +++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff -r f12d9595d07c -r 91a2b9309a72 tools/python/xen/xend/server/iopif.py --- a/tools/python/xen/xend/server/iopif.py Fri Oct 31 14:02:39 2008 +0000 +++ b/tools/python/xen/xend/server/iopif.py Mon Nov 03 10:23:09 2008 +0000 @@ -45,8 +45,21 @@ def parse_ioport(val): class IOPortsController(DevController): + valid_cfg = ['to', 'from', 'uuid'] + def __init__(self, vm): DevController.__init__(self, vm) + + def getDeviceConfiguration(self, devid, transaction = None): + result = DevController.getDeviceConfiguration(self, devid, transaction) + if transaction is None: + devinfo = self.readBackend(devid, *self.valid_cfg) + else: + devinfo = self.readBackendTxn(transaction, devid, *self.valid_cfg) + config = dict(zip(self.valid_cfg, devinfo)) + config = dict([(key, val) for key, val in config.items() + if val != None]) + return config def getDeviceDetails(self, config): """@see DevController.getDeviceDetails""" @@ -81,4 +94,9 @@ class IOPortsController(DevController): 'ioports: Failed to configure legacy i/o range: %s - %s' % (io_from, io_to)) - return (None, {}, {}) + back = dict([(k, config[k]) for k in self.valid_cfg if k in config]) + return (self.allocateDeviceID(), back, {}) + + def waitForDevice(self, devid): + # don't wait for hotplug + return diff -r f12d9595d07c -r 91a2b9309a72 tools/python/xen/xend/server/irqif.py --- a/tools/python/xen/xend/server/irqif.py Fri Oct 31 14:02:39 2008 +0000 +++ b/tools/python/xen/xend/server/irqif.py Mon Nov 03 10:23:09 2008 +0000 @@ -39,6 +39,18 @@ class IRQController(DevController): def __init__(self, vm): DevController.__init__(self, vm) + valid_cfg = ['irq', 'uuid'] + + def getDeviceConfiguration(self, devid, transaction = None): + result = DevController.getDeviceConfiguration(self, devid, transaction) + if transaction is None: + devinfo = self.readBackend(devid, *self.valid_cfg) + else: + devinfo = self.readBackendTxn(transaction, devid, *self.valid_cfg) + config = dict(zip(self.valid_cfg, devinfo)) + config = dict([(key, val) for key, val in config.items() + if val != None]) + return config def getDeviceDetails(self, config): """@see DevController.getDeviceDetails""" @@ -75,4 +87,9 @@ class IRQController(DevController): if rc < 0: raise VmError( 'irq: Failed to map irq %x' % (pirq)) - return (None, {}, {}) + back = dict([(k, config[k]) for k in self.valid_cfg if k in config]) + return (self.allocateDeviceID(), back, {}) + + def waitForDevice(self, devid): + # don't wait for hotplug + return diff -r f12d9595d07c -r 91a2b9309a72 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Fri Oct 31 14:02:39 2008 +0000 +++ b/tools/python/xen/xm/create.py Mon Nov 03 10:23:09 2008 +0000 @@ -1036,6 +1036,14 @@ def preprocess_ioports(vals): ioports.append(hexd) vals.ioports = ioports +def preprocess_irq(vals): + if not vals.irq: return + irq = [] + for v in vals.irq: + d = repr(v) + irq.append(d) + vals.irq = irq + def preprocess_vtpm(vals): if not vals.vtpm: return vtpms = [] @@ -1134,6 +1142,7 @@ def preprocess(vals): preprocess_vscsi(vals) preprocess_ioports(vals) preprocess_ip(vals) + preprocess_irq(vals) preprocess_nfs(vals) preprocess_vtpm(vals) preprocess_access_control(vals) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:29 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:29 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjur-0002rA-Iq; Wed, 05 Nov 2008 07:03:29 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs2-00015t-JS for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:34 -0800 X-ASG-Debug-ID: 1225897228-686600010002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id BB13ADCA73 for ; Wed, 5 Nov 2008 07:00:33 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id dFfSFUlT41ovUHgm for ; Wed, 05 Nov 2008 07:00:33 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563417 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563417" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:32 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0WUL004503 for ; Wed, 5 Nov 2008 07:00:32 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0tDX016169 for ; Wed, 5 Nov 2008 07:00:55 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0toj016168 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:55 -0800 Message-Id: <200811051500.mA5F0toj016168@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:54 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Cpufreq: Enhance hypervisor px sanity check X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897233 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Cpufreq: Enhance hypervisor px sanity check X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225707857 0 # Node ID 303b1014f91e5fa0783a5d7095626a47e82db9d0 # Parent 91a2b9309a723637c31a52caa63dd78ead4f8fd2 Cpufreq: Enhance hypervisor px sanity check This patch enhances hypervisor px sanity check in 2 level: Firstly, move per-cpu-level px sanity check from each cpufreq driver to common point (@ hypercall path). Secondly, add per-domain-level px sanity check to common point (@ cpufreq_add_cpu). Signed-off-by: Jinsong Liu --- xen/arch/ia64/xen/cpufreq/cpufreq.c | 15 ---------- xen/arch/x86/acpi/cpufreq/cpufreq.c | 12 -------- xen/drivers/cpufreq/cpufreq.c | 50 +++++++++++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 28 deletions(-) diff -r 91a2b9309a72 -r 303b1014f91e xen/arch/ia64/xen/cpufreq/cpufreq.c --- a/xen/arch/ia64/xen/cpufreq/cpufreq.c Mon Nov 03 10:23:09 2008 +0000 +++ b/xen/arch/ia64/xen/cpufreq/cpufreq.c Mon Nov 03 10:24:17 2008 +0000 @@ -209,21 +209,6 @@ acpi_cpufreq_cpu_init (struct cpufreq_po data->acpi_data = &processor_pminfo[cpu]->perf; - /* capability check */ - if (data->acpi_data->state_count <= 1) { - printk(KERN_WARNING "P-States\n"); - result = -ENODEV; - goto err_unreg; - } - - if ((data->acpi_data->control_register.space_id != - ACPI_ADR_SPACE_FIXED_HARDWARE) || - (data->acpi_data->status_register.space_id != - ACPI_ADR_SPACE_FIXED_HARDWARE)) { - result = -ENODEV; - goto err_unreg; - } - data->freq_table = xmalloc_array(struct cpufreq_frequency_table, (data->acpi_data->state_count + 1)); if (!data->freq_table) { diff -r 91a2b9309a72 -r 303b1014f91e xen/arch/x86/acpi/cpufreq/cpufreq.c --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Mon Nov 03 10:23:09 2008 +0000 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Mon Nov 03 10:24:17 2008 +0000 @@ -447,18 +447,6 @@ acpi_cpufreq_cpu_init(struct cpufreq_pol perf = data->acpi_data; policy->shared_type = perf->shared_type; - /* capability check */ - if (perf->state_count <= 1) { - printk("No P-States\n"); - result = -ENODEV; - goto err_unreg; - } - - if (perf->control_register.space_id != perf->status_register.space_id) { - result = -ENODEV; - goto err_unreg; - } - switch (perf->control_register.space_id) { case ACPI_ADR_SPACE_SYSTEM_IO: printk("xen_pminfo: @acpi_cpufreq_cpu_init," diff -r 91a2b9309a72 -r 303b1014f91e xen/drivers/cpufreq/cpufreq.c --- a/xen/drivers/cpufreq/cpufreq.c Mon Nov 03 10:23:09 2008 +0000 +++ b/xen/drivers/cpufreq/cpufreq.c Mon Nov 03 10:24:17 2008 +0000 @@ -117,6 +117,15 @@ int cpufreq_add_cpu(unsigned int cpu) cpu_set(cpu, cpufreq_dom->map); cpu_set(cpu, policy->cpus); + /* domain coordination sanity check */ + if ((perf->domain_info.coord_type != + processor_pminfo[firstcpu]->perf.domain_info.coord_type) || + (perf->domain_info.num_processors != + processor_pminfo[firstcpu]->perf.domain_info.num_processors)) { + ret = -EINVAL; + goto err2; + } + printk(KERN_EMERG"adding CPU %u\n", cpu); } else { cpufreq_dom = xmalloc(struct cpufreq_dom); @@ -303,6 +312,24 @@ int set_px_pminfo(uint32_t acpi_id, stru if ( dom0_px_info->flags & XEN_PX_PCT ) { + /* space_id check */ + if (dom0_px_info->control_register.space_id != + dom0_px_info->status_register.space_id) + { + ret = -EINVAL; + goto out; + } + +#ifdef CONFIG_IA64 + /* for IA64, currently it only supports FFH */ + if (dom0_px_info->control_register.space_id != + ACPI_ADR_SPACE_FIXED_HARDWARE) + { + ret = -EINVAL; + goto out; + } +#endif + memcpy ((void *)&pxpt->control_register, (void *)&dom0_px_info->control_register, sizeof(struct xen_pct_register)); @@ -312,8 +339,16 @@ int set_px_pminfo(uint32_t acpi_id, stru print_PCT(&pxpt->control_register); print_PCT(&pxpt->status_register); } + if ( dom0_px_info->flags & XEN_PX_PSS ) { + /* capability check */ + if (dom0_px_info->state_count <= 1) + { + ret = -EINVAL; + goto out; + } + if ( !(pxpt->states = xmalloc_array(struct xen_processor_px, dom0_px_info->state_count)) ) { @@ -325,14 +360,28 @@ int set_px_pminfo(uint32_t acpi_id, stru pxpt->state_count = dom0_px_info->state_count; print_PSS(pxpt->states,pxpt->state_count); } + if ( dom0_px_info->flags & XEN_PX_PSD ) { +#ifdef CONFIG_X86 + /* for X86, check domain coordination */ + /* for IA64, _PSD is optional for current IA64 cpufreq algorithm */ + if (dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_ALL && + dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_ANY && + dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_HW) + { + ret = -EINVAL; + goto out; + } +#endif + pxpt->shared_type = dom0_px_info->shared_type; memcpy ((void *)&pxpt->domain_info, (void *)&dom0_px_info->domain_info, sizeof(struct xen_psd_package)); print_PSD(&pxpt->domain_info); } + if ( dom0_px_info->flags & XEN_PX_PPC ) { pxpt->platform_limit = dom0_px_info->platform_limit; @@ -340,7 +389,6 @@ int set_px_pminfo(uint32_t acpi_id, stru if ( pxpt->init == XEN_PX_INIT ) { - ret = cpufreq_limit_change(cpuid); goto out; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:35 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:35 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjux-0002ur-Lc; Wed, 05 Nov 2008 07:03:35 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs3-00016P-Br for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:35 -0800 X-ASG-Debug-ID: 1225897228-686600010003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id CAD00DCA73 for ; Wed, 5 Nov 2008 07:00:34 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id ZimsLDkin4Sy28od for ; Wed, 05 Nov 2008 07:00:34 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563418 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563418" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:33 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0XUU004506 for ; Wed, 5 Nov 2008 07:00:33 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0uU7016186 for ; Wed, 5 Nov 2008 07:00:56 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0uFN016185 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:56 -0800 Message-Id: <200811051500.mA5F0uFN016185@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:55 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: simplify page reference handling for partially (in-)validated pages X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897234 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86: simplify page reference handling for partially (in-)validated pages X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225708322 0 # Node ID 540483d2a98f3fbabf06961cc0cc52e3c59c245b # Parent 303b1014f91e5fa0783a5d7095626a47e82db9d0 x86: simplify page reference handling for partially (in-)validated pages Simplify general page reference management for preempted (partially [in-]validated) pages: Reserve on reference that can be acquired without the risk of overflowing the reference count, thus allowing to have a simplified get_page() equivalent that cannot fail (but must be used with care). Doing this conversion pointed out a latent issue in the changes done previously in this area: The extra reference must be acquired before the 'normal' reference gets dropped, so the patch fixes this at once in both the alloc_page_type() and free_page_type() paths (it's really only the latter that failed to work with the change described above). Signed-off-by: Jan Beulich --- xen/arch/x86/mm.c | 90 +++++++++++++++++++++++++++--------------------------- 1 files changed, 46 insertions(+), 44 deletions(-) diff -r 303b1014f91e -r 540483d2a98f xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Mon Nov 03 10:24:17 2008 +0000 +++ b/xen/arch/x86/mm.c Mon Nov 03 10:32:02 2008 +0000 @@ -1856,7 +1856,8 @@ int get_page(struct page_info *page, str nx = x + 1; d = nd; if ( unlikely((x & PGC_count_mask) == 0) || /* Not allocated? */ - unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */ + /* Keep one spare reference to be acquired by get_page_light(). */ + unlikely(((nx + 1) & PGC_count_mask) <= 1) || /* Overflow? */ unlikely(d != _domain) ) /* Wrong owner? */ { if ( !_shadow_mode_refcounts(domain) && !domain->is_dying ) @@ -1878,16 +1879,34 @@ int get_page(struct page_info *page, str return 1; } +/* + * Special version of get_page() to be used exclusively when + * - a page is known to already have a non-zero reference count + * - the page does not need its owner to be checked + * - it will not be called more than once without dropping the thus + * acquired reference again. + * Due to get_page() reserving one reference, this call cannot fail. + */ +static void get_page_light(struct page_info *page) +{ + u32 x, nx, y = page->count_info; + + do { + x = y; + nx = x + 1; + BUG_ON(!(x & PGC_count_mask)); /* Not allocated? */ + BUG_ON(!(nx & PGC_count_mask)); /* Overflow? */ + y = cmpxchg(&page->count_info, x, nx); + } + while ( unlikely(y != x) ); +} + static int alloc_page_type(struct page_info *page, unsigned long type, int preemptible) { struct domain *owner = page_get_owner(page); int rc; - - /* Obtain an extra reference to retain if we set PGT_partial. */ - if ( preemptible && !get_page(page, owner) ) - return -EINVAL; /* A page table is dirtied when its type count becomes non-zero. */ if ( likely(owner != NULL) ) @@ -1922,14 +1941,10 @@ static int alloc_page_type(struct page_i wmb(); if ( rc == -EAGAIN ) { + get_page_light(page); page->u.inuse.type_info |= PGT_partial; - return -EAGAIN; - } - - if ( preemptible ) - put_page(page); - - if ( rc == -EINTR ) + } + else if ( rc == -EINTR ) { ASSERT((page->u.inuse.type_info & (PGT_count_mask|PGT_validated|PGT_partial)) == 1); @@ -2044,8 +2059,8 @@ static int __put_final_page_type( } else if ( rc == -EINTR ) { - ASSERT(!(page->u.inuse.type_info & - (PGT_count_mask|PGT_validated|PGT_partial))); + ASSERT((page->u.inuse.type_info & + (PGT_count_mask|PGT_validated|PGT_partial)) == 1); if ( !(shadow_mode_enabled(page_get_owner(page)) && (page->count_info & PGC_page_table)) ) page->tlbflush_timestamp = tlbflush_current_time(); @@ -2056,13 +2071,9 @@ static int __put_final_page_type( { BUG_ON(rc != -EAGAIN); wmb(); + get_page_light(page); page->u.inuse.type_info |= PGT_partial; - /* Must skip put_page() below. */ - preemptible = 0; - } - - if ( preemptible ) - put_page(page); + } return rc; } @@ -2072,10 +2083,7 @@ static int __put_page_type(struct page_i int preemptible) { unsigned long nx, x, y = page->u.inuse.type_info; - - /* Obtain an extra reference to retain if we set PGT_partial. */ - if ( preemptible && !get_page(page, page_get_owner(page)) ) - return -EINVAL; + int rc = 0; for ( ; ; ) { @@ -2098,10 +2106,11 @@ static int __put_page_type(struct page_i if ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) ) continue; + /* We cleared the 'valid bit' so we do the clean up. */ + rc = __put_final_page_type(page, x, preemptible); if ( x & PGT_partial ) put_page(page); - /* We cleared the 'valid bit' so we do the clean up. */ - return __put_final_page_type(page, x, preemptible); + break; } /* @@ -2120,17 +2129,10 @@ static int __put_page_type(struct page_i break; if ( preemptible && hypercall_preempt_check() ) - { - if ( preemptible ) - put_page(page); return -EINTR; - } - } - - if ( preemptible ) - put_page(page); - - return 0; + } + + return rc; } @@ -2138,6 +2140,7 @@ static int __get_page_type(struct page_i int preemptible) { unsigned long nx, x, y = page->u.inuse.type_info; + int rc = 0; ASSERT(!(type & ~(PGT_type_mask | PGT_pae_xen_l2))); @@ -2233,11 +2236,7 @@ static int __get_page_type(struct page_i } if ( likely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) == x) ) - { - if ( (x & PGT_partial) && !(nx & PGT_partial) ) - put_page(page); break; - } if ( preemptible && hypercall_preempt_check() ) return -EINTR; @@ -2264,10 +2263,13 @@ static int __get_page_type(struct page_i page->nr_validated_ptes = 0; page->partial_pte = 0; } - return alloc_page_type(page, type, preemptible); - } - - return 0; + rc = alloc_page_type(page, type, preemptible); + } + + if ( (x & PGT_partial) && !(nx & PGT_partial) ) + put_page(page); + + return rc; } void put_page_type(struct page_info *page) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:41 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:41 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjv3-0002yW-Kq; Wed, 05 Nov 2008 07:03:41 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs3-00016l-QC for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:35 -0800 X-ASG-Debug-ID: 1225897228-686600010004-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 5D199DCA78 for ; Wed, 5 Nov 2008 07:00:35 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id Yc2KEZH4YsTQoWm8 for ; Wed, 05 Nov 2008 07:00:35 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563419 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563419" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:34 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0Ykk004509 for ; Wed, 5 Nov 2008 07:00:34 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0v1d016203 for ; Wed, 5 Nov 2008 07:00:57 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0vl5016202 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:57 -0800 Message-Id: <200811051500.mA5F0vl5016202@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:56 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Fix GRANT_PTE_FLAGS. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897235 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86: Fix GRANT_PTE_FLAGS. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225708374 0 # Node ID 4ec25db9326a7e7f64a8471cbfd7b5852484757c # Parent 540483d2a98f3fbabf06961cc0cc52e3c59c245b x86: Fix GRANT_PTE_FLAGS. Since page table entries created through e.g. GNTTABOP_map_grant_ref are being passed through adjust_guest_l1e(), they must not generally get _PAGE_USER set - this will be taken care of by adjust_guest_l1e(), and it will ensure that these don't get _PAGE_GLOBAL set inadvertently. Due to the implied security aspect here (_PAGE_GLOBAL getting set on kernel pages for x86-64), I'd like to ask that this also be applied to older maintained branches. At the same time, set _PAGE_NX for pte-s created for grants (as long as hardware supports it), since it should be only data pages that remote domains are being given access to. Signed-off-by: Jan Beulich --- xen/include/asm-x86/page.h | 3 +++ xen/include/asm-x86/x86_32/page.h | 3 --- xen/include/asm-x86/x86_64/page.h | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff -r 540483d2a98f -r 4ec25db9326a xen/include/asm-x86/page.h --- a/xen/include/asm-x86/page.h Mon Nov 03 10:32:02 2008 +0000 +++ b/xen/include/asm-x86/page.h Mon Nov 03 10:32:54 2008 +0000 @@ -314,6 +314,9 @@ unsigned long clone_idle_pagetable(struc #define __PAGE_HYPERVISOR_NOCACHE \ (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED) +#define GRANT_PTE_FLAGS \ + (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_NX | _PAGE_GNTTAB) + #ifndef __ASSEMBLY__ static inline int get_order_from_bytes(paddr_t size) diff -r 540483d2a98f -r 4ec25db9326a xen/include/asm-x86/x86_32/page.h --- a/xen/include/asm-x86/x86_32/page.h Mon Nov 03 10:32:02 2008 +0000 +++ b/xen/include/asm-x86/x86_32/page.h Mon Nov 03 10:32:54 2008 +0000 @@ -105,9 +105,6 @@ extern unsigned int PAGE_HYPERVISOR_NOCA #define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF)) #define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF)) -#define GRANT_PTE_FLAGS \ - (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_GNTTAB) - /* * Disallow unused flag bits plus PAT/PSE, PCD, PWT and GLOBAL. * Permit the NX bit if the hardware supports it. diff -r 540483d2a98f -r 4ec25db9326a xen/include/asm-x86/x86_64/page.h --- a/xen/include/asm-x86/x86_64/page.h Mon Nov 03 10:32:02 2008 +0000 +++ b/xen/include/asm-x86/x86_64/page.h Mon Nov 03 10:32:54 2008 +0000 @@ -124,9 +124,6 @@ typedef l4_pgentry_t root_pgentry_t; #define PAGE_HYPERVISOR (__PAGE_HYPERVISOR | _PAGE_GLOBAL) #define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL) -#define GRANT_PTE_FLAGS \ - (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_GNTTAB|_PAGE_USER) - #define USER_MAPPINGS_ARE_GLOBAL #ifdef USER_MAPPINGS_ARE_GLOBAL /* _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:48 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:48 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjvA-00032n-Mx; Wed, 05 Nov 2008 07:03:48 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs5-00017b-Cu for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:37 -0800 X-ASG-Debug-ID: 1225897228-686600010005-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 898CADCA78 for ; Wed, 5 Nov 2008 07:00:36 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id lOmPsrZtXTTEAYBY for ; Wed, 05 Nov 2008 07:00:36 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563420 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563420" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:35 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0Zb1004512 for ; Wed, 5 Nov 2008 07:00:35 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0wsa016220 for ; Wed, 5 Nov 2008 07:00:58 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0w4D016219 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:58 -0800 Message-Id: <200811051500.mA5F0w4D016219@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:57 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xentrace: Trace mmio/io read/write value X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897236 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] xentrace: Trace mmio/io read/write value X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225719384 0 # Node ID 43a079fd50fdab01cd2be443bfef011b3b0495ae # Parent 4ec25db9326a7e7f64a8471cbfd7b5852484757c xentrace: Trace mmio/io read/write value Signed-off-by: George Dunlap Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/emulate.c | 30 ++++++++++++++++++++++++++++++ xen/include/public/trace.h | 2 ++ 2 files changed, 32 insertions(+) diff -r 4ec25db9326a -r 43a079fd50fd xen/arch/x86/hvm/emulate.c --- a/xen/arch/x86/hvm/emulate.c Mon Nov 03 10:32:54 2008 +0000 +++ b/xen/arch/x86/hvm/emulate.c Mon Nov 03 13:36:24 2008 +0000 @@ -14,10 +14,38 @@ #include #include #include +#include #include #include #include #include + +#define HVMTRACE_IO_ASSIST_WRITE 0x200 +static void hvmtrace_io_assist(int is_mmio, ioreq_t *p) +{ + unsigned int size, event; + unsigned char buffer[12]; + + if ( likely(!tb_init_done) ) + return; + + event = is_mmio ? TRC_HVM_MMIO_ASSIST : TRC_HVM_IO_ASSIST; + if ( !p->dir ) + event |= HVMTRACE_IO_ASSIST_WRITE; + + *(uint64_t *)buffer = p->addr; + size = (p->addr != (u32)p->addr) ? 8 : 4; + if ( size == 8 ) + event |= TRC_64_FLAG; + + if ( !p->data_is_ptr ) + { + *(uint32_t *)&buffer[size] = p->data; + size += 4; + } + + trace_var(event, 0/*!cycles*/, size, buffer); +} static int hvmemul_do_io( int is_mmio, paddr_t addr, unsigned long *reps, int size, @@ -110,6 +138,8 @@ static int hvmemul_do_io( p->df = df; p->data = value; p->io_count++; + + hvmtrace_io_assist(is_mmio, p); if ( is_mmio ) { diff -r 4ec25db9326a -r 43a079fd50fd xen/include/public/trace.h --- a/xen/include/public/trace.h Mon Nov 03 10:32:54 2008 +0000 +++ b/xen/include/public/trace.h Mon Nov 03 13:36:24 2008 +0000 @@ -142,7 +142,9 @@ #define TRC_HVM_INVLPG64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x14) #define TRC_HVM_MCE (TRC_HVM_HANDLER + 0x15) #define TRC_HVM_IO_ASSIST (TRC_HVM_HANDLER + 0x16) +#define TRC_HVM_IO_ASSIST64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x16) #define TRC_HVM_MMIO_ASSIST (TRC_HVM_HANDLER + 0x17) +#define TRC_HVM_MMIO_ASSIST64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x17) #define TRC_HVM_CLTS (TRC_HVM_HANDLER + 0x18) #define TRC_HVM_LMSW (TRC_HVM_HANDLER + 0x19) #define TRC_HVM_LMSW64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x19) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:03:54 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:03:54 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjvG-00036k-HJ; Wed, 05 Nov 2008 07:03:54 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs6-00018F-5t for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:38 -0800 X-ASG-Debug-ID: 1225897228-686600010006-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 6802CDCA7D for ; Wed, 5 Nov 2008 07:00:37 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 1WIbSqYjT9dPlmCO for ; Wed, 05 Nov 2008 07:00:37 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563421 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563421" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:36 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0aGX004515 for ; Wed, 5 Nov 2008 07:00:36 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0xn9016237 for ; Wed, 5 Nov 2008 07:00:59 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0xcU016236 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:59 -0800 Message-Id: <200811051500.mA5F0xcU016236@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:58 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: allow grant table originating ptes to have their guest available X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897237 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: allow grant table originating ptes to have their guest available X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225799160 0 # Node ID 6bd021d987d7deef4b3b05def5428b53481127b8 # Parent 43a079fd50fdab01cd2be443bfef011b3b0495ae x86: allow grant table originating ptes to have their guest available bits set. In order to allow 2.6.27's get_user_pages_fast() to correctly detect granted pages (so they would be passed to get_user_pages()), it must be possible to tell the grant table code in Xen to set the three available bits in the pte-s it creates. Signed-off-by: Jan Beulich --- xen/arch/x86/mm.c | 4 ++++ xen/common/kernel.c | 3 ++- xen/include/public/features.h | 6 ++++++ xen/include/public/grant_table.h | 9 ++++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff -r 43a079fd50fd -r 6bd021d987d7 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Mon Nov 03 13:36:24 2008 +0000 +++ b/xen/arch/x86/mm.c Tue Nov 04 11:46:00 2008 +0000 @@ -3332,6 +3332,10 @@ int create_grant_host_mapping(uint64_t a if ( !(flags & GNTMAP_readonly) ) l1e_add_flags(pte,_PAGE_RW); + l1e_add_flags(pte, + ((flags >> _GNTMAP_guest_avail0) * _PAGE_AVAIL0) + & _PAGE_AVAIL); + l1e_add_flags(pte, cacheattr_to_pte_flags(cache_flags >> 5)); if ( flags & GNTMAP_contains_pte ) diff -r 43a079fd50fd -r 6bd021d987d7 xen/common/kernel.c --- a/xen/common/kernel.c Mon Nov 03 13:36:24 2008 +0000 +++ b/xen/common/kernel.c Tue Nov 04 11:46:00 2008 +0000 @@ -222,7 +222,8 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDL #ifdef CONFIG_X86 if ( !is_hvm_vcpu(current) ) fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) | - (1U << XENFEAT_highmem_assist); + (1U << XENFEAT_highmem_assist) | + (1U << XENFEAT_gnttab_map_avail_bits); #endif break; default: diff -r 43a079fd50fd -r 6bd021d987d7 xen/include/public/features.h --- a/xen/include/public/features.h Mon Nov 03 13:36:24 2008 +0000 +++ b/xen/include/public/features.h Tue Nov 04 11:46:00 2008 +0000 @@ -62,6 +62,12 @@ /* x86: Does this Xen host support the MMU_{CLEAR,COPY}_PAGE hypercall? */ #define XENFEAT_highmem_assist 6 +/* + * If set, GNTTABOP_map_grant_ref honors flags to be placed into guest kernel + * available pte bits. + */ +#define XENFEAT_gnttab_map_avail_bits 7 + #define XENFEAT_NR_SUBMAPS 1 #endif /* __XEN_PUBLIC_FEATURES_H__ */ diff -r 43a079fd50fd -r 6bd021d987d7 xen/include/public/grant_table.h --- a/xen/include/public/grant_table.h Mon Nov 03 13:36:24 2008 +0000 +++ b/xen/include/public/grant_table.h Tue Nov 04 11:46:00 2008 +0000 @@ -360,7 +360,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and /* - * Bitfield values for update_pin_status.flags. + * Bitfield values for gnttab_map_grant_ref.flags. */ /* Map the grant entry for access by I/O devices. */ #define _GNTMAP_device_map (0) @@ -388,6 +388,13 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and #define GNTMAP_contains_pte (1<<_GNTMAP_contains_pte) /* + * Bits to be placed in guest kernel available PTE bits (architecture + * dependent; only supported when XENFEAT_gnttab_map_avail_bits is set). + */ +#define _GNTMAP_guest_avail0 (16) +#define GNTMAP_guest_avail_mask ((uint32_t)~0 << _GNTMAP_guest_avail0) + +/* * Values for error status returns. All errors are -ve. */ #define GNTST_okay (0) /* Normal return. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:01 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:01 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjvM-0003Ab-VI; Wed, 05 Nov 2008 07:04:00 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs8-00019T-4E for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:40 -0800 X-ASG-Debug-ID: 1225897228-686600010007-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 9D60EDCA7D for ; Wed, 5 Nov 2008 07:00:39 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id EvKBaNPtSTjQo5HQ for ; Wed, 05 Nov 2008 07:00:39 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563423 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563423" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:38 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0cId004521 for ; Wed, 5 Nov 2008 07:00:38 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F11Pa016273 for ; Wed, 5 Nov 2008 07:01:01 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F114W016272 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:01 -0800 Message-Id: <200811051501.mA5F114W016272@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:01:00 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xend: Add a multi-reader-single-writer lock implementation X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897239 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] xend: Add a multi-reader-single-writer lock implementation X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225880539 0 # Node ID 484cf12ba667a3d2077bda3df24177ace78ff3fe # Parent 4bfc67b09e9c4bf99adfd6623cb66945c1b661cf xend: Add a multi-reader-single-writer lock implementation This patch adds a reader-writer lock primitive to xend since python does not provide it by default. The implementation is based on a condition variable. Some test code is appended at the end of the file. Signed-off-by: Stefan Berger --- tools/python/xen/util/rwlock.py | 137 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 137 insertions(+) diff -r 4bfc67b09e9c -r 484cf12ba667 tools/python/xen/util/rwlock.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/python/xen/util/rwlock.py Wed Nov 05 10:22:19 2008 +0000 @@ -0,0 +1,137 @@ +""" Reader-writer lock implementation based on a condition variable """ + +#============================================================================ +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#============================================================================ +# Copyright (C) 2008 International Business Machines Corp. +# Author: Stefan Berger +#============================================================================ + +from threading import Condition + +class RWLock: + + RWLOCK_STATE_WRITER = -1 + RWLOCK_STATE_UNUSED = 0 + + def __init__(self): + self.__condition = Condition() + self.__state = RWLock.RWLOCK_STATE_UNUSED + self.__blocked_writers = 0 + + def acquire_reader(self): + self.__condition.acquire() + while True: + if self.__state == RWLock.RWLOCK_STATE_WRITER: + self.__condition.wait() + else: + break + self.__state += 1 + self.__condition.release() + + def acquire_writer(self): + self.__condition.acquire() + self.__acquire_writer(RWLock.RWLOCK_STATE_UNUSED) + self.__condition.release() + + def __acquire_writer(self, wait_for_state): + while True: + if self.__state == wait_for_state: + self.__state = RWLock.RWLOCK_STATE_WRITER + break + else: + self.__blocked_writers += 1 + self.__condition.wait() + self.__blocked_writers -= 1 + + def release(self): + self.__condition.acquire() + if self.__state == RWLock.RWLOCK_STATE_WRITER: + self.__state = RWLock.RWLOCK_STATE_UNUSED + elif self.__state == RWLock.RWLOCK_STATE_UNUSED: + assert False, 'Lock not in use.' + else: + self.__state -= 1 + self.__condition.notifyAll() + self.__condition.release() + + +if __name__ == '__main__': + from threading import Thread + from time import sleep + + rwlock = RWLock() + + class Base(Thread): + def __init__(self, name, timeout): + self.name = name + self.timeout = timeout + Thread.__init__(self) + + class Reader(Base): + def __init__(self, name = 'Reader', timeout = 10): + Base.__init__(self, name, timeout) + + def run(self): + print '%s begin' % self.name + rwlock.acquire_reader() + print '%s acquired' % self.name + sleep(self.timeout) + rwlock.release() + print '%s end' % self.name + + class ReaderTwice(Base): + def __init__(self, name = 'Reader', timeout = 10): + Base.__init__(self, name, timeout) + + def run(self): + print '%s begin' % self.name + rwlock.acquire_reader() + print '%s acquired once' % self.name + sleep(self.timeout) + rwlock.acquire_reader() + print '%s acquired twice' % self.name + sleep(self.timeout) + rwlock.release() + rwlock.release() + print '%s end' % self.name + + class Writer(Base): + def __init__(self, name = 'Writer', timeout = 10): + Base.__init__(self, name, timeout) + + def run(self): + print '%s begin' % self.name + rwlock.acquire_writer() + print '%s acquired' % self.name + sleep(self.timeout) + rwlock.release() + print '%s end' % self.name + + def run_test(threadlist, msg): + print msg + for t in threadlist: + t.start() + sleep(1) + for t in threads: + t.join() + print 'Done\n\n' + + threads = [] + threads.append( Reader('R1', 4) ) + threads.append( Reader('R2', 4) ) + threads.append( Writer('W1', 4) ) + threads.append( Reader('R3', 4) ) + run_test(threads, + 'Test: readers may bypass blocked writers') _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:06 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:06 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjvS-0003Eo-RR; Wed, 05 Nov 2008 07:04:06 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs9-0001AS-S6 for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:41 -0800 X-ASG-Debug-ID: 1225897240-688100020000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 0A14EDCA81 for ; Wed, 5 Nov 2008 07:00:40 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id FZsi73qsPvejcrY6 for ; Wed, 05 Nov 2008 07:00:40 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563424 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563424" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:39 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0dXx004524 for ; Wed, 5 Nov 2008 07:00:39 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F12UV016290 for ; Wed, 5 Nov 2008 07:01:02 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F12vc016289 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:02 -0800 Message-Id: <200811051501.mA5F12vc016289@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:01:01 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xend, security: Prevent changing of the policy while VMs are migrating X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897241 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=INFO_TLD X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 INFO_TLD URI: Contains an URL in the INFO top-level domain Subject: [Xen-changelog] [xen-unstable] xend, security: Prevent changing of the policy while VMs are migrating X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225880606 0 # Node ID ef202be3cf54e27cef7427739c5458435ec085f8 # Parent 484cf12ba667a3d2077bda3df24177ace78ff3fe xend, security: Prevent changing of the policy while VMs are migrating The net changes of this patch are that the reader-side lock is put into the path of the migration code and the writer lock into the path of the code that handles the changing of the policy. Simultaneous migrations of multiple hosts still work after this lock has been added. Signed-off-by: Stefan Berger --- tools/python/xen/xend/XendDomain.py | 29 +++++--- tools/python/xen/xend/XendDomainInfo.py | 111 ++++++++++++++++---------------- 2 files changed, 76 insertions(+), 64 deletions(-) diff -r 484cf12ba667 -r ef202be3cf54 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Wed Nov 05 10:22:19 2008 +0000 +++ b/tools/python/xen/xend/XendDomain.py Wed Nov 05 10:23:26 2008 +0000 @@ -50,7 +50,7 @@ from xen.xend.XendAPIConstants import * from xen.xend.xenstore.xstransact import xstransact from xen.xend.xenstore.xswatch import xswatch -from xen.util import mkdir +from xen.util import mkdir, rwlock from xen.xend import uuid xc = xen.lowlevel.xc.xc() @@ -92,6 +92,8 @@ class XendDomain: self.domains = {} self.managed_domains = {} self.domains_lock = threading.RLock() + + self.policy_lock = rwlock.RWLock() # xen api instance vars # TODO: nothing uses this at the moment @@ -1139,16 +1141,21 @@ class XendDomain: """ try: - return XendCheckpoint.restore(self, fd, paused=paused, relocating=relocating) - except XendError, e: - log.exception("Restore failed") - raise - except: - # I don't really want to log this exception here, but the error - # handling in the relocation-socket handling code (relocate.py) is - # poor, so we need to log this for debugging. - log.exception("Restore failed") - raise XendError("Restore failed") + self.policy_lock.acquire_reader() + + try: + return XendCheckpoint.restore(self, fd, paused=paused, relocating=relocating) + except XendError, e: + log.exception("Restore failed") + raise + except: + # I don't really want to log this exception here, but the error + # handling in the relocation-socket handling code (relocate.py) is + # poor, so we need to log this for debugging. + log.exception("Restore failed") + raise XendError("Restore failed") + finally: + self.policy_lock.release() def domain_unpause(self, domid): """Unpause domain execution. diff -r 484cf12ba667 -r ef202be3cf54 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Nov 05 10:22:19 2008 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Nov 05 10:23:26 2008 +0000 @@ -3011,64 +3011,69 @@ class XendDomainInfo: if not xspol: xspol = poladmin.get_policy_by_name(policy) - if state in [ DOM_STATE_RUNNING, DOM_STATE_PAUSED ]: - #if domain is running or paused try to relabel in hypervisor - if not xspol: - return (-xsconstants.XSERR_POLICY_NOT_LOADED, "", "", 0) - - if typ != xspol.get_type_name() or \ - policy != xspol.get_name(): - return (-xsconstants.XSERR_BAD_LABEL, "", "", 0) - - if typ == xsconstants.ACM_POLICY_ID: - new_ssidref = xspol.vmlabel_to_ssidref(label) - if new_ssidref == xsconstants.INVALID_SSIDREF: + try: + xen.xend.XendDomain.instance().policy_lock.acquire_writer() + + if state in [ DOM_STATE_RUNNING, DOM_STATE_PAUSED ]: + #if domain is running or paused try to relabel in hypervisor + if not xspol: + return (-xsconstants.XSERR_POLICY_NOT_LOADED, "", "", 0) + + if typ != xspol.get_type_name() or \ + policy != xspol.get_name(): return (-xsconstants.XSERR_BAD_LABEL, "", "", 0) - # Check that all used resources are accessible under the - # new label - if not is_policy_update and \ - not security.resources_compatible_with_vmlabel(xspol, - self, label): - return (-xsconstants.XSERR_BAD_LABEL, "", "", 0) - - #Check label against expected one. Can only do this - # if the policy hasn't changed underneath in the meantime - if xspol_old == None: - old_label = self.get_security_label() - if old_label != old_seclab: - log.info("old_label != old_seclab: %s != %s" % - (old_label, old_seclab)) + if typ == xsconstants.ACM_POLICY_ID: + new_ssidref = xspol.vmlabel_to_ssidref(label) + if new_ssidref == xsconstants.INVALID_SSIDREF: return (-xsconstants.XSERR_BAD_LABEL, "", "", 0) - # relabel domain in the hypervisor - rc, errors = security.relabel_domains([[domid, new_ssidref]]) - log.info("rc from relabeling in HV: %d" % rc) - else: - return (-xsconstants.XSERR_POLICY_TYPE_UNSUPPORTED, "", "", 0) - - if rc == 0: - # HALTED, RUNNING or PAUSED - if domid == 0: - if xspol: + # Check that all used resources are accessible under the + # new label + if not is_policy_update and \ + not security.resources_compatible_with_vmlabel(xspol, + self, label): + return (-xsconstants.XSERR_BAD_LABEL, "", "", 0) + + #Check label against expected one. Can only do this + # if the policy hasn't changed underneath in the meantime + if xspol_old == None: + old_label = self.get_security_label() + if old_label != old_seclab: + log.info("old_label != old_seclab: %s != %s" % + (old_label, old_seclab)) + return (-xsconstants.XSERR_BAD_LABEL, "", "", 0) + + # relabel domain in the hypervisor + rc, errors = security.relabel_domains([[domid, new_ssidref]]) + log.info("rc from relabeling in HV: %d" % rc) + else: + return (-xsconstants.XSERR_POLICY_TYPE_UNSUPPORTED, "", "", 0) + + if rc == 0: + # HALTED, RUNNING or PAUSED + if domid == 0: + if xspol: + self.info['security_label'] = seclab + ssidref = poladmin.set_domain0_bootlabel(xspol, label) + else: + return (-xsconstants.XSERR_POLICY_NOT_LOADED, "", "", 0) + else: + if self.info.has_key('security_label'): + old_label = self.info['security_label'] + # Check label against expected one, unless wildcard + if old_label != old_seclab: + return (-xsconstants.XSERR_BAD_LABEL, "", "", 0) + self.info['security_label'] = seclab - ssidref = poladmin.set_domain0_bootlabel(xspol, label) - else: - return (-xsconstants.XSERR_POLICY_NOT_LOADED, "", "", 0) - else: - if self.info.has_key('security_label'): - old_label = self.info['security_label'] - # Check label against expected one, unless wildcard - if old_label != old_seclab: - return (-xsconstants.XSERR_BAD_LABEL, "", "", 0) - - self.info['security_label'] = seclab - - try: - xen.xend.XendDomain.instance().managed_config_save(self) - except: - pass - return (rc, errors, old_label, new_ssidref) + + try: + xen.xend.XendDomain.instance().managed_config_save(self) + except: + pass + return (rc, errors, old_label, new_ssidref) + finally: + xen.xend.XendDomain.instance().policy_lock.release() def get_on_shutdown(self): after_shutdown = self.info.get('actions_after_shutdown') _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:12 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:12 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjvY-0003IU-BV; Wed, 05 Nov 2008 07:04:12 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjs9-0001AU-UY for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:42 -0800 X-ASG-Debug-ID: 1225897240-688100020001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 66F73DCA83 for ; Wed, 5 Nov 2008 07:00:41 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 9nVAbEQ4fCh3CZJb for ; Wed, 05 Nov 2008 07:00:41 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563425 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563425" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:40 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0eAT004527 for ; Wed, 5 Nov 2008 07:00:40 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F13cp016307 for ; Wed, 5 Nov 2008 07:01:03 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F130a016306 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:03 -0800 Message-Id: <200811051501.mA5F130a016306@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:01:02 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, hvm: Only warn on memory attribute conflicts for real RAM. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897241 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, hvm: Only warn on memory attribute conflicts for real RAM. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225880711 0 # Node ID baad1475f2cd316f05c609ffb2866e064689bb2f # Parent ef202be3cf54e27cef7427739c5458435ec085f8 x86, hvm: Only warn on memory attribute conflicts for real RAM. From: Disheng Su Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/mtrr.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff -r ef202be3cf54 -r baad1475f2cd xen/arch/x86/hvm/mtrr.c --- a/xen/arch/x86/hvm/mtrr.c Wed Nov 05 10:23:26 2008 +0000 +++ b/xen/arch/x86/hvm/mtrr.c Wed Nov 05 10:25:11 2008 +0000 @@ -392,12 +392,13 @@ uint32_t get_pat_flags(struct vcpu *v, */ if ( pat_entry_value == INVALID_MEM_TYPE ) { - gdprintk(XENLOG_WARNING, - "Conflict occurs for a given guest l1e flags:%x " - "at %"PRIx64" (the effective mm type:%d), " - "because the host mtrr type is:%d\n", - gl1e_flags, (uint64_t)gpaddr, guest_eff_mm_type, - shadow_mtrr_type); + if (mfn_valid(paddr_to_pfn(spaddr))) + gdprintk(XENLOG_WARNING, + "Conflict occurs for a given guest l1e flags:%x " + "at %"PRIx64" (the effective mm type:%d), " + "because the host mtrr type is:%d\n", + gl1e_flags, (uint64_t)gpaddr, guest_eff_mm_type, + shadow_mtrr_type); pat_entry_value = PAT_TYPE_UNCACHABLE; } /* 4. Get the pte flags */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:18 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:18 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjve-0003MF-AC; Wed, 05 Nov 2008 07:04:18 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsA-0001BA-OW for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:42 -0800 X-ASG-Debug-ID: 1225897240-688100020002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 3B2B1DCA84 for ; Wed, 5 Nov 2008 07:00:41 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id lOq2230AI1ZoT0M6 for ; Wed, 05 Nov 2008 07:00:41 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563427 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563427" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:41 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0fXe004530 for ; Wed, 5 Nov 2008 07:00:41 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F14iB016324 for ; Wed, 5 Nov 2008 07:01:04 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F145m016323 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:04 -0800 Message-Id: <200811051501.mA5F145m016323@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:01:03 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: fix a typo X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897242 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: fix a typo X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225880779 0 # Node ID 1e437b5b418a1c47c96f8c65442bc63ab35f671c # Parent baad1475f2cd316f05c609ffb2866e064689bb2f x86: fix a typo Signed-off-by Kevin Tian --- xen/arch/x86/cpu/mcheck/p4.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r baad1475f2cd -r 1e437b5b418a xen/arch/x86/cpu/mcheck/p4.c --- a/xen/arch/x86/cpu/mcheck/p4.c Wed Nov 05 10:25:11 2008 +0000 +++ b/xen/arch/x86/cpu/mcheck/p4.c Wed Nov 05 10:26:19 2008 +0000 @@ -51,7 +51,7 @@ static void intel_thermal_interrupt(stru ack_APIC_irq(); - if (NOW() > next[cpu]) + if (NOW() < next[cpu]) return; next[cpu] = NOW() + MILLISECS(5000); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:25 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:25 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjvl-0003Qm-Bi; Wed, 05 Nov 2008 07:04:25 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsC-0001CN-ML for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:44 -0800 X-ASG-Debug-ID: 1225897240-688100020003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 6BDB7DCA89 for ; Wed, 5 Nov 2008 07:00:42 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id QFpafxDfysxOlcHa for ; Wed, 05 Nov 2008 07:00:42 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563428 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563428" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:42 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0gkP004533 for ; Wed, 5 Nov 2008 07:00:42 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F156x016341 for ; Wed, 5 Nov 2008 07:01:05 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F15Vm016340 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:05 -0800 Message-Id: <200811051501.mA5F15Vm016340@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:01:04 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: PV support for hugepages X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897243 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: PV support for hugepages X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225882641 0 # Node ID 5fd51e1e9c798f18a06a43c4cb83df93ac0698dd # Parent 1e437b5b418a1c47c96f8c65442bc63ab35f671c x86: PV support for hugepages Hugepage support must be enabled via the hypervisor command line option "allowhugepage". There is currently no support in the tools for saving/restoring/migrating guests who use hugepages. Signed-off-by: Dave McCracken --- xen/arch/x86/mm.c | 89 ++++++++++++++++++++++++++++++++------ xen/arch/x86/traps.c | 10 ++-- xen/include/asm-x86/mm.h | 1 xen/include/asm-x86/x86_32/page.h | 2 xen/include/asm-x86/x86_64/page.h | 2 5 files changed, 86 insertions(+), 18 deletions(-) diff -r 1e437b5b418a -r 5fd51e1e9c79 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Wed Nov 05 10:26:19 2008 +0000 +++ b/xen/arch/x86/mm.c Wed Nov 05 10:57:21 2008 +0000 @@ -160,6 +160,9 @@ unsigned long total_pages; #define PAGE_CACHE_ATTRS (_PAGE_PAT|_PAGE_PCD|_PAGE_PWT) +int opt_allow_hugepage; +boolean_param("allowhugepage", opt_allow_hugepage); + #define l1_disallow_mask(d) \ ((d != dom_io) && \ (rangeset_is_empty((d)->iomem_caps) && \ @@ -584,6 +587,28 @@ static int get_page_and_type_from_pagenr put_page(page); return rc; +} + +static int get_data_page( + struct page_info *page, struct domain *d, int writeable) +{ + int rc; + + if ( writeable ) + rc = get_page_and_type(page, d, PGT_writable_page); + else + rc = get_page(page, d); + + return rc; +} + +static void put_data_page( + struct page_info *page, int writeable) +{ + if ( writeable ) + put_page_and_type(page); + else + put_page(page); } /* @@ -700,10 +725,9 @@ get_page_from_l1e( * contribute to writeable mapping refcounts. (This allows the * qemu-dm helper process in dom0 to map the domain's memory without * messing up the count of "real" writable mappings.) */ - okay = (((l1f & _PAGE_RW) && - !(unlikely(paging_mode_external(d) && (d != curr->domain)))) - ? get_page_and_type(page, d, PGT_writable_page) - : get_page(page, d)); + okay = get_data_page( + page, d, + (l1f & _PAGE_RW) && !(paging_mode_external(d) && (d != curr->domain))); if ( !okay ) { MEM_LOG("Error getting mfn %lx (pfn %lx) from L1 entry %" PRIpte @@ -751,6 +775,7 @@ get_page_from_l2e( get_page_from_l2e( l2_pgentry_t l2e, unsigned long pfn, struct domain *d) { + unsigned long mfn = l2e_get_pfn(l2e); int rc; if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) ) @@ -762,10 +787,37 @@ get_page_from_l2e( return -EINVAL; } - rc = get_page_and_type_from_pagenr( - l2e_get_pfn(l2e), PGT_l1_page_table, d, 0, 0); - if ( unlikely(rc == -EINVAL) && get_l2_linear_pagetable(l2e, pfn, d) ) - rc = 0; + if ( !(l2e_get_flags(l2e) & _PAGE_PSE) ) + { + rc = get_page_and_type_from_pagenr(mfn, PGT_l1_page_table, d, 0, 0); + if ( unlikely(rc == -EINVAL) && get_l2_linear_pagetable(l2e, pfn, d) ) + rc = 0; + } + else if ( !opt_allow_hugepage || (mfn & (L1_PAGETABLE_ENTRIES-1)) ) + { + rc = -EINVAL; + } + else + { + unsigned long m = mfn; + int writeable = !!(l2e_get_flags(l2e) & _PAGE_RW); + + do { + rc = get_data_page(mfn_to_page(m), d, writeable); + if ( unlikely(!rc) ) + { + while ( m-- > mfn ) + put_data_page(mfn_to_page(m), writeable); + return -EINVAL; + } + } while ( m++ < (mfn + (L1_PAGETABLE_ENTRIES-1)) ); + +#ifdef __x86_64__ + map_pages_to_xen( + (unsigned long)mfn_to_virt(mfn), mfn, L1_PAGETABLE_ENTRIES, + PAGE_HYPERVISOR | l2e_get_flags(l2e)); +#endif + } return rc; } @@ -954,13 +1006,24 @@ void put_page_from_l1e(l1_pgentry_t l1e, */ static int put_page_from_l2e(l2_pgentry_t l2e, unsigned long pfn) { - if ( (l2e_get_flags(l2e) & _PAGE_PRESENT) && - (l2e_get_pfn(l2e) != pfn) ) + if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) || (l2e_get_pfn(l2e) == pfn) ) + return 1; + + if ( l2e_get_flags(l2e) & _PAGE_PSE ) + { + unsigned long mfn = l2e_get_pfn(l2e), m = mfn; + int writeable = l2e_get_flags(l2e) & _PAGE_RW; + ASSERT(opt_allow_hugepage && !(mfn & (L1_PAGETABLE_ENTRIES-1))); + do { + put_data_page(mfn_to_page(m), writeable); + } while ( m++ < (mfn + (L1_PAGETABLE_ENTRIES-1)) ); + } + else { put_page_and_type(l2e_get_page(l2e)); - return 0; - } - return 1; + } + + return 0; } static int __put_page_type(struct page_info *, int preemptible); diff -r 1e437b5b418a -r 5fd51e1e9c79 xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Wed Nov 05 10:26:19 2008 +0000 +++ b/xen/arch/x86/traps.c Wed Nov 05 10:57:21 2008 +0000 @@ -723,7 +723,8 @@ static void pv_cpuid(struct cpu_user_reg { /* Modify Feature Information. */ __clear_bit(X86_FEATURE_VME, &d); - __clear_bit(X86_FEATURE_PSE, &d); + if ( !opt_allow_hugepage ) + __clear_bit(X86_FEATURE_PSE, &d); __clear_bit(X86_FEATURE_PGE, &d); __clear_bit(X86_FEATURE_MCE, &d); __clear_bit(X86_FEATURE_MCA, &d); @@ -2003,9 +2004,12 @@ static int emulate_privileged_op(struct case 4: /* Read CR4 */ /* * Guests can read CR4 to see what features Xen has enabled. We - * therefore lie about PGE & PSE as they are unavailable to guests. + * therefore lie about PGE as it is unavailable to guests. + * Also disallow PSE if hugepages are not enabled. */ - *reg = read_cr4() & ~(X86_CR4_PGE|X86_CR4_PSE); + *reg = read_cr4() & ~X86_CR4_PGE; + if ( !opt_allow_hugepage ) + *reg &= ~X86_CR4_PSE; break; default: diff -r 1e437b5b418a -r 5fd51e1e9c79 xen/include/asm-x86/mm.h --- a/xen/include/asm-x86/mm.h Wed Nov 05 10:26:19 2008 +0000 +++ b/xen/include/asm-x86/mm.h Wed Nov 05 10:57:21 2008 +0000 @@ -263,6 +263,7 @@ pae_copy_root(struct vcpu *v, l3_pgentry int check_descriptor(const struct domain *, struct desc_struct *d); +extern int opt_allow_hugepage; /****************************************************************************** * With shadow pagetables, the different kinds of address start diff -r 1e437b5b418a -r 5fd51e1e9c79 xen/include/asm-x86/x86_32/page.h --- a/xen/include/asm-x86/x86_32/page.h Wed Nov 05 10:26:19 2008 +0000 +++ b/xen/include/asm-x86/x86_32/page.h Wed Nov 05 10:57:21 2008 +0000 @@ -112,7 +112,7 @@ extern unsigned int PAGE_HYPERVISOR_NOCA #define BASE_DISALLOW_MASK (0xFFFFF198U & ~_PAGE_NX) #define L1_DISALLOW_MASK (BASE_DISALLOW_MASK | _PAGE_GNTTAB) -#define L2_DISALLOW_MASK (BASE_DISALLOW_MASK) +#define L2_DISALLOW_MASK (BASE_DISALLOW_MASK & ~_PAGE_PSE) #define L3_DISALLOW_MASK 0xFFFFF1FEU /* must-be-zero */ #endif /* __X86_32_PAGE_H__ */ diff -r 1e437b5b418a -r 5fd51e1e9c79 xen/include/asm-x86/x86_64/page.h --- a/xen/include/asm-x86/x86_64/page.h Wed Nov 05 10:26:19 2008 +0000 +++ b/xen/include/asm-x86/x86_64/page.h Wed Nov 05 10:57:21 2008 +0000 @@ -115,7 +115,7 @@ typedef l4_pgentry_t root_pgentry_t; #define BASE_DISALLOW_MASK (0xFF800198U & ~_PAGE_NX) #define L1_DISALLOW_MASK (BASE_DISALLOW_MASK | _PAGE_GNTTAB) -#define L2_DISALLOW_MASK (BASE_DISALLOW_MASK) +#define L2_DISALLOW_MASK (BASE_DISALLOW_MASK & ~_PAGE_PSE) #define L3_DISALLOW_MASK (BASE_DISALLOW_MASK) #define L4_DISALLOW_MASK (BASE_DISALLOW_MASK) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:31 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:31 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjvq-0003UZ-VJ; Wed, 05 Nov 2008 07:04:31 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsD-0001Cm-Jp for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:45 -0800 X-ASG-Debug-ID: 1225897244-688100030000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id F04FCDCA8B for ; Wed, 5 Nov 2008 07:00:44 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id uTB1X3ijn1WV0lDe for ; Wed, 05 Nov 2008 07:00:44 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563429 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563429" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:43 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0hf0004536 for ; Wed, 5 Nov 2008 07:00:43 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F16ko016411 for ; Wed, 5 Nov 2008 07:01:06 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F16m3016410 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:06 -0800 Message-Id: <200811051501.mA5F16m3016410@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:01:05 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] blktap: ensure vma->vm_mm's mmap_sem is being held whenever it is being modified X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897244 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] blktap: ensure vma->vm_mm's mmap_sem is being held whenever it is being modified X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225894117 0 # Node ID be9555ea5512d801a50f075037806a37ce17c209 # Parent 2fb13b8cbe134fdb3f18ee21e641e52655066c62 blktap: ensure vma->vm_mm's mmap_sem is being held whenever it is being modified Signed-off-by: Jan Beulich --- drivers/xen/blktap/blktap.c | 43 +++++++++++++++++++++++++++++++++---------- 1 files changed, 33 insertions(+), 10 deletions(-) diff -r 2fb13b8cbe13 -r be9555ea5512 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Thu Oct 30 13:34:43 2008 +0000 +++ b/drivers/xen/blktap/blktap.c Wed Nov 05 14:08:37 2008 +0000 @@ -611,9 +611,13 @@ static int blktap_release(struct inode * /* Clear any active mappings and free foreign map table */ if (info->vma) { + struct mm_struct *mm = info->vma->vm_mm; + + down_write(&mm->mmap_sem); zap_page_range( info->vma, info->vma->vm_start, info->vma->vm_end - info->vma->vm_start, NULL); + up_write(&mm->mmap_sem); kfree(info->vma->vm_private_data); @@ -992,12 +996,13 @@ static void fast_flush_area(pending_req_ int tapidx) { struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST*2]; - unsigned int i, invcount = 0; + unsigned int i, invcount = 0, locked = 0; struct grant_handle_pair *khandle; uint64_t ptep; int ret, mmap_idx; unsigned long kvaddr, uvaddr; tap_blkif_t *info; + struct mm_struct *mm; info = tapfds[tapidx]; @@ -1007,13 +1012,15 @@ static void fast_flush_area(pending_req_ return; } + mm = info->vma ? info->vma->vm_mm : NULL; + if (info->vma != NULL && xen_feature(XENFEAT_auto_translated_physmap)) { - down_write(&info->vma->vm_mm->mmap_sem); + down_write(&mm->mmap_sem); zap_page_range(info->vma, MMAP_VADDR(info->user_vstart, u_idx, 0), req->nr_pages << PAGE_SHIFT, NULL); - up_write(&info->vma->vm_mm->mmap_sem); + up_write(&mm->mmap_sem); return; } @@ -1038,10 +1045,13 @@ static void fast_flush_area(pending_req_ if (khandle->user != INVALID_GRANT_HANDLE) { BUG_ON(xen_feature(XENFEAT_auto_translated_physmap)); + if (!locked++) + down_write(&mm->mmap_sem); if (create_lookup_pte_addr( - info->vma->vm_mm, + mm, MMAP_VADDR(info->user_vstart, u_idx, i), &ptep) !=0) { + up_write(&mm->mmap_sem); WPRINTK("Couldn't get a pte addr!\n"); return; } @@ -1060,10 +1070,17 @@ static void fast_flush_area(pending_req_ GNTTABOP_unmap_grant_ref, unmap, invcount); BUG_ON(ret); - if (info->vma != NULL && !xen_feature(XENFEAT_auto_translated_physmap)) + if (info->vma != NULL && + !xen_feature(XENFEAT_auto_translated_physmap)) { + if (!locked++) + down_write(&mm->mmap_sem); zap_page_range(info->vma, MMAP_VADDR(info->user_vstart, u_idx, 0), req->nr_pages << PAGE_SHIFT, NULL); + } + + if (locked) + up_write(&mm->mmap_sem); } /****************************************************************** @@ -1346,6 +1363,7 @@ static void dispatch_rw_block_io(blkif_t int pending_idx = RTN_PEND_IDX(pending_req,pending_req->mem_idx); int usr_idx; uint16_t mmap_idx = pending_req->mem_idx; + struct mm_struct *mm; if (blkif->dev_num < 0 || blkif->dev_num > MAX_TAP_DEV) goto fail_response; @@ -1389,6 +1407,9 @@ static void dispatch_rw_block_io(blkif_t pending_req->status = BLKIF_RSP_OKAY; pending_req->nr_pages = nseg; op = 0; + mm = info->vma->vm_mm; + if (!xen_feature(XENFEAT_auto_translated_physmap)) + down_write(&mm->mmap_sem); for (i = 0; i < nseg; i++) { unsigned long uvaddr; unsigned long kvaddr; @@ -1407,9 +1428,9 @@ static void dispatch_rw_block_io(blkif_t if (!xen_feature(XENFEAT_auto_translated_physmap)) { /* Now map it to user. */ - ret = create_lookup_pte_addr(info->vma->vm_mm, - uvaddr, &ptep); + ret = create_lookup_pte_addr(mm, uvaddr, &ptep); if (ret) { + up_write(&mm->mmap_sem); WPRINTK("Couldn't get a pte addr!\n"); goto fail_flush; } @@ -1431,6 +1452,8 @@ static void dispatch_rw_block_io(blkif_t BUG_ON(ret); if (!xen_feature(XENFEAT_auto_translated_physmap)) { + up_write(&mm->mmap_sem); + for (i = 0; i < (nseg*2); i+=2) { unsigned long uvaddr; unsigned long kvaddr; @@ -1504,7 +1527,7 @@ static void dispatch_rw_block_io(blkif_t goto fail_flush; if (xen_feature(XENFEAT_auto_translated_physmap)) - down_write(&info->vma->vm_mm->mmap_sem); + down_write(&mm->mmap_sem); /* Mark mapped pages as reserved: */ for (i = 0; i < req->nr_segments; i++) { unsigned long kvaddr; @@ -1518,13 +1541,13 @@ static void dispatch_rw_block_io(blkif_t MMAP_VADDR(info->user_vstart, usr_idx, i), pg); if (ret) { - up_write(&info->vma->vm_mm->mmap_sem); + up_write(&mm->mmap_sem); goto fail_flush; } } } if (xen_feature(XENFEAT_auto_translated_physmap)) - up_write(&info->vma->vm_mm->mmap_sem); + up_write(&mm->mmap_sem); /*record [mmap_idx,pending_idx] to [usr_idx] mapping*/ info->idx_map[usr_idx] = MAKE_ID(mmap_idx, pending_idx); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:38 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:38 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjvx-0003YD-UO; Wed, 05 Nov 2008 07:04:37 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsD-0001Cw-P8 for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:45 -0800 X-ASG-Debug-ID: 1225897228-686600010008-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 2EAE7DCA87 for ; Wed, 5 Nov 2008 07:00:40 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id tocngESEsSANvmdv for ; Wed, 05 Nov 2008 07:00:40 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563422 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563422" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:37 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0bOB004518 for ; Wed, 5 Nov 2008 07:00:37 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F10fA016254 for ; Wed, 5 Nov 2008 07:01:00 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F10Rl016253 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:00 -0800 Message-Id: <200811051501.mA5F10Rl016253@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:59 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] tools/hotplug: Separate OS-specific scripts. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897243 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: -1001.00 X-Barracuda-Spam-Status: No, SCORE=-1001.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 Subject: [Xen-changelog] [xen-unstable] tools/hotplug: Separate OS-specific scripts. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225800822 0 # Node ID 4bfc67b09e9c4bf99adfd6623cb66945c1b661cf # Parent 6bd021d987d7deef4b3b05def5428b53481127b8 tools/hotplug: Separate OS-specific scripts. Signed-off-by: Christoph Egger Signed-off-by: Keir Fraser --- tools/examples/blktap | 93 ---- tools/examples/block | 381 ----------------- tools/examples/block-common.sh | 116 ----- tools/examples/block-enbd | 27 - tools/examples/block-nbd | 27 - tools/examples/external-device-migrate | 91 ---- tools/examples/init.d/sysconfig.xendomains | 137 ------ tools/examples/init.d/xend | 66 -- tools/examples/init.d/xendomains | 531 ------------------------ tools/examples/locking.sh | 98 ---- tools/examples/logging.sh | 22 tools/examples/network-bridge | 310 -------------- tools/examples/network-nat | 119 ----- tools/examples/network-route | 27 - tools/examples/vif-bridge | 100 ---- tools/examples/vif-common.sh | 151 ------ tools/examples/vif-nat | 192 -------- tools/examples/vif-route | 56 -- tools/examples/vscsi | 22 tools/examples/vtpm | 22 tools/examples/vtpm-common.sh | 448 -------------------- tools/examples/vtpm-delete | 18 tools/examples/vtpm-hotplug-common.sh | 35 - tools/examples/vtpm-impl | 208 --------- tools/examples/vtpm-migration.sh | 19 tools/examples/xen-backend.agent | 39 - tools/examples/xen-backend.rules | 9 tools/examples/xen-hotplug-cleanup | 22 tools/examples/xen-hotplug-common.sh | 93 ---- tools/examples/xen-network-common.sh | 118 ----- tools/examples/xen-script-common.sh | 44 - tools/Makefile | 1 tools/examples/Makefile | 58 -- tools/hotplug/Linux/Makefile | 97 ++++ tools/hotplug/Linux/blktap | 93 ++++ tools/hotplug/Linux/block | 381 +++++++++++++++++ tools/hotplug/Linux/block-common.sh | 116 +++++ tools/hotplug/Linux/block-enbd | 27 + tools/hotplug/Linux/block-nbd | 27 + tools/hotplug/Linux/external-device-migrate | 98 ++++ tools/hotplug/Linux/init.d/sysconfig.xendomains | 137 ++++++ tools/hotplug/Linux/init.d/xend | 66 ++ tools/hotplug/Linux/init.d/xendomains | 531 ++++++++++++++++++++++++ tools/hotplug/Linux/locking.sh | 98 ++++ tools/hotplug/Linux/logging.sh | 22 tools/hotplug/Linux/network-bridge | 310 ++++++++++++++ tools/hotplug/Linux/network-nat | 119 +++++ tools/hotplug/Linux/network-route | 27 + tools/hotplug/Linux/vif-bridge | 100 ++++ tools/hotplug/Linux/vif-common.sh | 151 ++++++ tools/hotplug/Linux/vif-nat | 192 ++++++++ tools/hotplug/Linux/vif-route | 56 ++ tools/hotplug/Linux/vscsi | 22 tools/hotplug/Linux/vtpm | 22 tools/hotplug/Linux/vtpm-common.sh | 448 ++++++++++++++++++++ tools/hotplug/Linux/vtpm-delete | 18 tools/hotplug/Linux/vtpm-hotplug-common.sh | 35 + tools/hotplug/Linux/vtpm-impl | 208 +++++++++ tools/hotplug/Linux/vtpm-migration.sh | 19 tools/hotplug/Linux/xen-backend.agent | 39 + tools/hotplug/Linux/xen-backend.rules | 9 tools/hotplug/Linux/xen-hotplug-cleanup | 22 tools/hotplug/Linux/xen-hotplug-common.sh | 93 ++++ tools/hotplug/Linux/xen-network-common.sh | 118 +++++ tools/hotplug/Linux/xen-script-common.sh | 44 + tools/hotplug/Makefile | 9 tools/hotplug/NetBSD/Makefile | 41 + tools/hotplug/NetBSD/block-nbsd | 88 +++ tools/hotplug/NetBSD/qemu-ifup-nbsd | 3 tools/hotplug/NetBSD/vif-bridge-nbsd | 35 + tools/hotplug/NetBSD/vif-ip-nbsd | 33 + tools/hotplug/common/Makefile | 37 + 72 files changed, 3993 insertions(+), 3698 deletions(-) diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/Makefile --- a/tools/Makefile Tue Nov 04 11:46:00 2008 +0000 +++ b/tools/Makefile Tue Nov 04 12:13:42 2008 +0000 @@ -9,6 +9,7 @@ SUBDIRS-y += xenstore SUBDIRS-y += xenstore SUBDIRS-y += misc SUBDIRS-y += examples +SUBDIRS-y += hotplug SUBDIRS-y += xentrace SUBDIRS-$(CONFIG_XCUTILS) += xcutils SUBDIRS-$(CONFIG_X86) += firmware diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/Makefile --- a/tools/examples/Makefile Tue Nov 04 11:46:00 2008 +0000 +++ b/tools/examples/Makefile Tue Nov 04 12:13:42 2008 +0000 @@ -24,41 +24,6 @@ XEN_CONFIGS += xend-pci-quirks.sxp XEN_CONFIGS += xend-pci-quirks.sxp XEN_CONFIGS += xend-pci-permissive.sxp -# Xen script dir and scripts to go there. -XEN_SCRIPT_DIR = /etc/xen/scripts -XEN_SCRIPTS = network-bridge vif-bridge -XEN_SCRIPTS += network-route vif-route -XEN_SCRIPTS += network-nat vif-nat -XEN_SCRIPTS += block -XEN_SCRIPTS += block-enbd block-nbd -XEN_SCRIPTS += blktap -XEN_SCRIPTS += vtpm vtpm-delete -XEN_SCRIPTS += xen-hotplug-cleanup -XEN_SCRIPTS += external-device-migrate -XEN_SCRIPTS += vscsi -XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh -XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh -XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh -XEN_SCRIPT_DATA += vtpm-migration.sh vtpm-impl - -XEN_HOTPLUG_DIR = /etc/hotplug -XEN_HOTPLUG_SCRIPTS = xen-backend.agent - -UDEV_RULES_DIR = /etc/udev -UDEV_RULES = xen-backend.rules - -DI = $(if $(DISTDIR),$(shell readlink -f $(DISTDIR)),) -DE = $(if $(DESTDIR),$(shell readlink -f $(DESTDIR)),) -ifeq ($(findstring $(DI),$(DE)),$(DI)) -HOTPLUGS=install-hotplug install-udev -else -ifeq ($(shell [ -x /usr/bin/udevinfo ] && [ `/usr/bin/udevinfo -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/'` -ge 059 ] && echo 1),1) -HOTPLUGS=install-udev -else -HOTPLUGS=install-hotplug -endif -endif - .PHONY: all all: @@ -66,7 +31,7 @@ build: build: .PHONY: install -install: all install-readmes install-initd install-configs install-scripts $(HOTPLUGS) +install: all install-readmes install-configs $(HOTPLUGS) .PHONY: install-readmes install-readmes: @@ -77,14 +42,6 @@ install-readmes: $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \ done -.PHONY: install-initd -install-initd: - [ -d $(DESTDIR)/etc/init.d ] || $(INSTALL_DIR) $(DESTDIR)/etc/init.d - [ -d $(DESTDIR)/etc/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)/etc/sysconfig - $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d - $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)/etc/init.d - $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)/etc/sysconfig/xendomains - .PHONY: install-configs install-configs: $(XEN_CONFIGS) [ -d $(DESTDIR)$(XEN_CONFIG_DIR) ] || \ @@ -94,19 +51,6 @@ install-configs: $(XEN_CONFIGS) set -e; for i in $(XEN_CONFIGS); \ do [ -e $(DESTDIR)$(XEN_CONFIG_DIR)/$$i ] || \ $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_CONFIG_DIR); \ - done - -.PHONY: install-scripts -install-scripts: - [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \ - $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) - set -e; for i in $(XEN_SCRIPTS); \ - do \ - $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ - done - set -e; for i in $(XEN_SCRIPT_DATA); \ - do \ - $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ done .PHONY: install-hotplug diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/blktap --- a/tools/examples/blktap Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2005, XenSource Ltd. - -dir=$(dirname "$0") -. "$dir/xen-hotplug-common.sh" -. "$dir/block-common.sh" - -findCommand "$@" - -## -# check_blktap_sharing file mode -# -# Perform the sharing check for the given blktap and mode. -# -check_blktap_sharing() -{ - local file="$1" - local mode="$2" - - local base_path="$XENBUS_BASE_PATH/$XENBUS_TYPE" - for dom in $(xenstore-list "$base_path") - do - for dev in $(xenstore-list "$base_path/$dom") - do - params=$(xenstore_read "$base_path/$dom/$dev/params" | cut -d: -f2) - if [ "$file" = "$params" ] - then - - if [ "$mode" = 'w' ] - then - if ! same_vm "$dom" - then - echo 'guest' - return - fi - else - local m=$(xenstore_read "$base_path/$dom/$dev/mode") - m=$(canonicalise_mode "$m") - - if [ "$m" = 'w' ] - then - if ! same_vm "$dom" - then - echo 'guest' - return - fi - fi - fi - fi - done - done - - echo 'ok' -} - - -t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING') -if [ -n "$t" ] -then - p=$(xenstore_read "$XENBUS_PATH/params") - # if we have a ':', chew from head including : - if echo $p | grep -q \: - then - p=${p#*:} - fi -fi -# some versions of readlink cannot be passed a regular file -if [ -L "$p" ]; then - file=$(readlink -f "$p") || fatal "$p link does not exist." -else - file="$p" -fi - -if [ "$command" = 'add' ] -then - [ -e "$file" ] || { fatal $file does not exist; } - - FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") - FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm") - mode=$(xenstore_read "$XENBUS_PATH/mode") - mode=$(canonicalise_mode "$mode") - - if [ "$mode" != '!' ] - then - result=$(check_blktap_sharing "$file" "$mode") - [ "$result" = 'ok' ] || ebusy "$file already in use by other domain" - fi - - success -fi - -exit 0 diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/block --- a/tools/examples/block Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,381 +0,0 @@ -#!/bin/bash - -dir=$(dirname "$0") -. "$dir/block-common.sh" - -expand_dev() { - local dev - case $1 in - /*) - dev=$1 - ;; - *) - dev=/dev/$1 - ;; - esac - echo -n $dev -} - - -## -# check_sharing device mode -# -# Check whether the device requested is already in use. To use the device in -# read-only mode, it may be in use in read-only mode, but may not be in use in -# read-write anywhere at all. To use the device in read-write mode, it must -# not be in use anywhere at all. -# -# Prints one of -# -# 'local': the device may not be used because it is mounted in the current -# (i.e. the privileged domain) in a way incompatible with the -# requested mode; -# 'guest': the device may not be used because it already mounted by a guest -# in a way incompatible with the requested mode; or -# 'ok': the device may be used. -# -check_sharing() -{ - local dev="$1" - local mode="$2" - - local devmm=$(device_major_minor "$dev") - local file - - if [ "$mode" = 'w' ] - then - toskip="^$" - else - toskip="^[^ ]* [^ ]* [^ ]* ro[, ]" - fi - - for file in $(cat /proc/mounts | grep -v "$toskip" | cut -f 1 -d ' ') - do - if [ -e "$file" ] - then - local d=$(device_major_minor "$file") - - if [ "$d" = "$devmm" ] - then - echo 'local' - return - fi - fi - done - - local base_path="$XENBUS_BASE_PATH/$XENBUS_TYPE" - for dom in $(xenstore-list "$base_path") - do - for dev in $(xenstore-list "$base_path/$dom") - do - d=$(xenstore_read_default "$base_path/$dom/$dev/physical-device" "") - - if [ "$d" = "$devmm" ] - then - if [ "$mode" = 'w' ] - then - if ! same_vm $dom - then - echo 'guest' - return - fi - else - local m=$(xenstore_read "$base_path/$dom/$dev/mode") - m=$(canonicalise_mode "$m") - - if [ "$m" = 'w' ] - then - if ! same_vm $dom - then - echo 'guest' - return - fi - fi - fi - fi - done - done - - echo 'ok' -} - - -## -# check_device_sharing dev mode -# -# Perform the sharing check for the given physical device and mode. -# -check_device_sharing() -{ - local dev="$1" - local mode=$(canonicalise_mode "$2") - local result - - if [ "x$mode" = 'x!' ] - then - return 0 - fi - - result=$(check_sharing "$dev" "$mode") - - if [ "$result" != 'ok' ] - then - do_ebusy "Device $dev is mounted " "$mode" "$result" - fi -} - - -## -# check_device_sharing file dev mode -# -# Perform the sharing check for the given file mounted through the given -# loopback interface, in the given mode. -# -check_file_sharing() -{ - local file="$1" - local dev="$2" - local mode="$3" - - result=$(check_sharing "$dev" "$mode") - - if [ "$result" != 'ok' ] - then - do_ebusy "File $file is loopback-mounted through $dev, -which is mounted " "$mode" "$result" - fi -} - - -## -# do_ebusy prefix mode result -# -# Helper function for check_device_sharing check_file_sharing, calling ebusy -# with an error message constructed from the given prefix, mode, and result -# from a call to check_sharing. -# -do_ebusy() -{ - local prefix="$1" - local mode="$2" - local result="$3" - - if [ "$result" = 'guest' ] - then - dom='a guest ' - when='now' - else - dom='the privileged ' - when='by a guest' - fi - - if [ "$mode" = 'w' ] - then - m1='' - m2='' - else - m1='read-write ' - m2='read-only ' - fi - - release_lock "block" - ebusy \ -"${prefix}${m1}in ${dom}domain, -and so cannot be mounted ${m2}${when}." -} - - -t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING') - -case "$command" in - add) - phys=$(xenstore_read_default "$XENBUS_PATH/physical-device" 'MISSING') - if [ "$phys" != 'MISSING' ] - then - # Depending upon the hotplug configuration, it is possible for this - # script to be called twice, so just bail. - exit 0 - fi - - if [ -n "$t" ] - then - p=$(xenstore_read "$XENBUS_PATH/params") - mode=$(xenstore_read "$XENBUS_PATH/mode") - fi - - case $t in - phy) - dev=$(expand_dev $p) - FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") - FRONTEND_UUID=$(xenstore_read_default \ - "/local/domain/$FRONTEND_ID/vm" 'unknown') - - if [ -L "$dev" ] - then - dev=$(readlink -f "$dev") || fatal "$dev link does not exist." - fi - test -e "$dev" || fatal "$dev does not exist." - test -b "$dev" || fatal "$dev is not a block device." - - claim_lock "block" - check_device_sharing "$dev" "$mode" - write_dev "$dev" - release_lock "block" - exit 0 - ;; - - file) - # Canonicalise the file, for sharing check comparison, and the mode - # for ease of use here. - file=$(readlink -f "$p") || fatal "$p does not exist." - test -f "$file" || fatal "$file does not exist." - mode=$(canonicalise_mode "$mode") - - claim_lock "block" - - if [ "$mode" = 'w' ] && ! stat "$file" -c %A | grep -q w - then - release_lock "block" - ebusy \ -"File $file is read-only, and so I will not -mount it read-write in a guest domain." - fi - - loopdev='' - for dev in /dev/loop* - do - if [ ! -b "$dev" ] - then - continue - fi - - f=$(losetup "$dev" 2>/dev/null) || f='' - - if [ "$f" ] - then - # $dev is in use. Check sharing. - if [ "x$mode" = 'x!' ] - then - continue - fi - - f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g') - - # $f is the filename, as read from losetup, but the loopback - # driver truncates filenames at 64 characters, so we need to go - # trawling through the store if it's longer than that. Truncation - # is indicated by an asterisk at the end of the filename. - if expr index "$f" '*' >/dev/null - then - found="" - for dom in $(xenstore-list "$XENBUS_BASE_PATH") - do - for domdev in $(xenstore-list "$XENBUS_BASE_PATH/$dom") - do - d=$(xenstore_read_default \ - "$XENBUS_BASE_PATH/$dom/$domdev/node" "") - if [ "$d" = "$dev" ] - then - f=$(xenstore_read "$XENBUS_BASE_PATH/$dom/$domdev/params") - found=1 - break 2 - fi - done - done - - if [ ! "$found" ] - then - # This loopback device is in use by someone else, so skip it. - log debug "Loopback sharing check skips device $dev." - continue - fi - fi - - # Canonicalise the filename for the comparison. - - # I have seen this readlink fails because the filename given by - # losetup is only the basename. This cannot happen when the loop - # device is set up through this script, because file is - # canonicalised above, but it may happen when loop devices are set - # up some other way. This readlink may also conceivably fail if - # the file backing this loop device has been removed. - - # For maximum safety, in the case that $f does not resolve, we - # assume that $file and $f are in the same directory. - - # If you create a loopback filesystem, remove it and continue to - # run on it, and then create another file with the same name, then - # this check will block that -- don't do that. - - # If you create loop devices through some other mechanism, use - # relative filenames, and then use the same filename through this - # script, then this check will block that -- don't do that either. - - f=$(readlink -f "$f" || echo $(dirname "$file")/$(basename "$f")) - - - if [ "$f" = "$file" ] - then - check_file_sharing "$file" "$dev" "$mode" - fi - else - # $dev is not in use, so we'll remember it for use later; we want - # to finish the sharing check first. - - if [ "$loopdev" = '' ] - then - loopdev="$dev" - fi - fi - done - - if [ "$loopdev" = '' ] - then - release_lock "block" - fatal 'Failed to find an unused loop device' - fi - - if LANG=C losetup -h 2>&1 | grep read-only >/dev/null - then - roflag="-$mode"; roflag="${roflag#-w}"; roflag="${roflag#-!}" - else - roflag='' - fi - do_or_die losetup $roflag "$loopdev" "$file" - xenstore_write "$XENBUS_PATH/node" "$loopdev" - write_dev "$loopdev" - release_lock "block" - exit 0 - ;; - - "") - claim_lock "block" - success - release_lock "block" - ;; - esac - ;; - - remove) - case $t in - phy) - exit 0 - ;; - - file) - node=$(xenstore_read "$XENBUS_PATH/node") - losetup -d "$node" - exit 0 - ;; - - "") - exit 0 - ;; - esac - ;; - -esac - -# If we've reached here, $t is neither phy nor file, so fire a helper script. -[ -x /etc/xen/scripts/block-"$t" ] && \ - /etc/xen/scripts/block-"$t" "$command" $node diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/block-common.sh --- a/tools/examples/block-common.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -# -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - - -dir=$(dirname "$0") -. "$dir/xen-hotplug-common.sh" - -findCommand "$@" - -if [ "$command" != "add" ] && - [ "$command" != "remove" ] -then - log err "Invalid command: $command" - exit 1 -fi - - -XENBUS_PATH="${XENBUS_PATH:?}" - - -ebusy() -{ - xenstore_write "$XENBUS_PATH/hotplug-error" "$*" \ - "$XENBUS_PATH/hotplug-status" busy - log err "$@" - exit 1 -} - - -## -# Print the given device's major and minor numbers, written in hex and -# separated by a colon. -device_major_minor() -{ - stat -L -c %t:%T "$1" -} - - -## -# Write physical-device = MM,mm to the store, where MM and mm are the major -# and minor numbers of device respectively. -# -# @param device The device from which major and minor numbers are read, which -# will be written into the store. -# -write_dev() { - local mm - - mm=$(device_major_minor "$1") - - if [ -z $mm ] - then - fatal "Backend device does not exist" - fi - - xenstore_write "$XENBUS_PATH/physical-device" "$mm" - - success -} - - -## -# canonicalise_mode mode -# -# Takes the given mode, which may be r, w, ro, rw, w!, or rw!, or variations -# thereof, and canonicalises them to one of -# -# 'r': perform checks for a new read-only mount; -# 'w': perform checks for a read-write mount; or -# '!': perform no checks at all. -# -canonicalise_mode() -{ - local mode="$1" - - if ! expr index "$mode" 'w' >/dev/null - then - echo 'r' - elif ! expr index "$mode" '!' >/dev/null - then - echo 'w' - else - echo '!' - fi -} - - -same_vm() -{ - local otherdom="$1" - # Note that othervm can be MISSING here, because Xend will be racing with - # the hotplug scripts -- the entries in /local/domain can be removed by - # Xend before the hotplug scripts have removed the entry in - # /local/domain/0/backend/. In this case, we want to pretend that the - # VM is the same as FRONTEND_UUID, because that way the 'sharing' will be - # allowed. - local othervm=$(xenstore_read_default "/local/domain/$otherdom/vm" \ - "$FRONTEND_UUID") - - [ "$FRONTEND_UUID" = "$othervm" ] -} - diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/block-enbd --- a/tools/examples/block-enbd Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -#!/bin/bash - -# Usage: block-enbd [bind server ctl_port |unbind node] -# -# The node argument to unbind is the name of the device node we are to -# unbind. -# -# This assumes you're running a correctly configured server at the other end! - -dir=$(dirname "$0") -. "$dir/block-common.sh" - -case "$command" in - add) - for dev in /dev/nd*; do - if nbd-client $2:$3 $dev; then - write_dev $dev - exit 0 - fi - done - exit 1 - ;; - remove) - nbd-client -d $2 - exit 0 - ;; -esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/block-nbd --- a/tools/examples/block-nbd Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -#!/bin/bash - -# Usage: block-nbd [bind server ctl_port |unbind node] -# -# The node argument to unbind is the name of the device node we are to -# unbind. -# -# This assumes you're running a correctly configured server at the other end! - -dir=$(dirname "$0") -. "$dir/block-common.sh" - -case "$command" in - add) - for dev in /dev/nbd*; do - if nbd-client $2 $3 $dev; then - write_dev $dev - exit 0 - fi - done - exit 1 - ;; - remove) - nbd-client -d $2 - exit 0 - ;; -esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/external-device-migrate --- a/tools/examples/external-device-migrate Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2005 IBM Corporation -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -set -x - -# This script is called by XenD for migration of external devices -# It does not handle the migration of those devices itself, but -# passes the requests on to further applications -# It handles the low-level command line parsing and some of the -# synchronization - -dir=$(dirname "$0") -. "$dir/logging.sh" - - -function ext_dev_migrate_usage() { -cat < : n-th migration step --host : the destination host --domname : name of the domain that is migrating --type : the type of device that is migrating --subtype : the subtype of the device --recover : indicates recovery request; an error - occurred during migration --help : display this help screen -EOF -} - -# Parse the command line paramters. The following parameters must be -# passed as the first ones in the sequence: -# -step [required] -# -host [required] -# -domname [required] -# -type [required] -# -subtype [optional] -# -recover [optional] -# The remaining ones will be passed to the called function. -function evaluate_params() -{ - local step host domname typ recover filename func stype - stype="" - while [ $# -ge 1 ]; do - case "$1" in - -step) step=$2; shift; shift;; - -host) host=$2; shift; shift;; - -domname) domname=$2; shift; shift;; - -type) typ=$2; shift; shift;; - -subtype) stype=$2; shift; shift;; - -recover) recover=1; shift;; - -help) ext_dev_migrate_usage; exit 0;; - *) break;; - esac - done - - if [ "$step" = "" -o \ - "$host" = "" -o \ - "$typ" = "" -o \ - "$domname" = "" ]; then - echo "Error: Parameter(s) missing (-step/-host/-type/-domname)" 1>&2 - echo "" 1>&2 - echo "$0 -help for usage." 1>&2 - exit 1 - fi - - filename="$dir/$typ$stype-migration.sh" - if [ ! -r $filename ]; then - echo "Error: Could not find script '$filename'" - return - fi - . "$filename" - - if [ "$recover" = "1" ]; then - func="$typ"_recover - eval $func $host $domname $step $* - else - func="$typ"_migration_step - eval $func $host $domname $step $* - fi -} - -evaluate_params "$@" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/init.d/sysconfig.xendomains --- a/tools/examples/init.d/sysconfig.xendomains Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -## Path: System/xen -## Description: xen domain start/stop on boot -## Type: string -## Default: -# -# The xendomains script can send SysRq requests to domains on shutdown. -# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility -# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks -# of the domains ("s"). -# -XENDOMAINS_SYSRQ="" - -## Type: integer -## Default: 100000 -# -# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait -# (in microseconds) after each SysRq, so the domain has a chance to react. -# If you want to a quick'n'dirty shutdown via SysRq, you may want to set -# it to a relatively high value (1200000). -# -XENDOMAINS_USLEEP=100000 - -## Type: integer -## Default: 5000000 -# -# When creating a guest domain, it is sensible to allow a little time for it -# to get started before creating another domain or proceeding through the -# boot process. Without this, the booting guests will thrash the disk as they -# start up. This timeout (in microseconds) specifies the delay after guest -# domain creation. -# -XENDOMAINS_CREATE_USLEEP=5000000 - -## Type: string -## Default: "" -# -# Set this to a non-empty string if you want to migrate virtual machines -# on shutdown. The string will be passed to the xm migrate DOMID command -# as is: It should contain the target IP address of the physical machine -# to migrate to and optionally parameters like --live. Leave empty if -# you don't want to try virtual machine relocation on shutdown. -# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for -# that domain. -# -XENDOMAINS_MIGRATE="" - -## Type: string -## Default: /var/lib/xen/save -# -# Directory to save running domains to when the system (dom0) is -# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE -# is set (see below). Leave empty to disable domain saving on shutdown -# (e.g. because you rather shut domains down). -# If domain saving does succeed, SHUTDOWN will not be executed. -# -XENDOMAINS_SAVE=/var/lib/xen/save - -## Type: string -## Default: "--halt --wait" -# -# If neither MIGRATE nor SAVE were enabled or if they failed, you can -# try to shut down a domain by sending it a shutdown request. To do this, -# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting -# for the domain to be really down. Leave empty to skip domain shutdown. -# -XENDOMAINS_SHUTDOWN="--halt --wait" - -## Type: string -## Default: "--all --halt --wait" -# -# After we have gone over all virtual machines (resp. all automatically -# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq, -# migrated, saved and/or shutdown according to the settings above, we -# might want to shutdown the virtual machines that are still running -# for some reason or another. To do this, set this variable to -# "--all --halt --wait", it will be passed to xm shutdown. -# Leave it empty not to do anything special here. -# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY -# is set.) -# -XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait" - -## Type: boolean -## Default: true -# -# This variable determines whether saved domains from XENDOMAINS_SAVE -# will be restored on system startup. -# -XENDOMAINS_RESTORE=true - -## Type: string -## Default: /etc/xen/auto -# -# This variable sets the directory where domains configurations -# are stored that should be started on system startup automatically. -# Leave empty if you don't want to start domains automatically -# (or just don't place any xen domain config files in that dir). -# Note that the script tries to be clever if both RESTORE and AUTO are -# set: It will first restore saved domains and then only start domains -# in AUTO which are not running yet. -# Note that the name matching is somewhat fuzzy. -# -XENDOMAINS_AUTO=/etc/xen/auto - -## Type: boolean -## Default: false -# -# If this variable is set to "true", only the domains started via config -# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ, -# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise -# all running domains will be. -# Note that the name matching is somewhat fuzzy. -# -XENDOMAINS_AUTO_ONLY=false - -## Type: integer -## Default: 300 -# -# On xendomains stop, a number of xm commands (xm migrate, save, shutdown, -# shutdown --all) may be executed. In the worst case, these commands may -# stall forever, which will prevent a successful shutdown of the machine. -# If this variable is non-zero, the script will set up a watchdog timer -# for every of these xm commands and time it out after the number of seconds -# specified by this variable. -# Note that SHUTDOWN_ALL will not be called if no virtual machines or only -# zombies are still running, so you don't need to enable this timeout just -# for the zombie case. -# The setting should be large enough to make sure that migrate/save/shutdown -# can succeed. If you do live migrations, keep in mind that live migration -# of a 1GB machine over Gigabit ethernet may actually take something like -# 100s (assuming that live migration uses 10% of the network # bandwidth). -# Depending on the virtual machine, a shutdown may also require a significant -# amount of time. So better setup this variable to a huge number and hope the -# watchdog never fires. -# -XENDOMAINS_STOP_MAXWAIT=300 - diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/init.d/xend --- a/tools/examples/init.d/xend Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -#!/bin/bash -# -# xend Script to start and stop the Xen control daemon. -# -# Author: Keir Fraser -# -# chkconfig: 2345 98 01 -# description: Starts and stops the Xen control daemon. -### BEGIN INIT INFO -# Provides: xend -# Required-Start: $syslog $remote_fs -# Should-Start: -# Required-Stop: $syslog $remote_fs -# Should-Stop: -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Default-Enabled: yes -# Short-Description: Start/stop xend -# Description: Starts and stops the Xen control daemon. -### END INIT INFO - -if ! grep -q "control_d" /proc/xen/capabilities ; then - exit 0 -fi - -# Wait for Xend to be up -function await_daemons_up -{ - i=1 - rets=10 - xend status - while [ $? -ne 0 -a $i -lt $rets ]; do - sleep 1 - echo -n . - i=$(($i + 1)) - xend status - done -} - -case "$1" in - start) - xend start - await_daemons_up - ;; - stop) - xend stop - ;; - status) - xend status - ;; - reload) - xend reload - ;; - restart|force-reload) - xend restart - await_daemons_up - ;; - *) - # do not advertise unreasonable commands that there is no reason - # to use with this device - echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" - exit 1 -esac - -exit $? - diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/init.d/xendomains --- a/tools/examples/init.d/xendomains Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,531 +0,0 @@ -#!/bin/bash -# -# /etc/init.d/xendomains -# Start / stop domains automatically when domain 0 boots / shuts down. -# -# chkconfig: 345 99 00 -# description: Start / stop Xen domains. -# -# This script offers fairly basic functionality. It should work on Redhat -# but also on LSB-compliant SuSE releases and on Debian with the LSB package -# installed. (LSB is the Linux Standard Base) -# -# Based on the example in the "Designing High Quality Integrated Linux -# Applications HOWTO" by Avi Alkalay -# -# -### BEGIN INIT INFO -# Provides: xendomains -# Required-Start: $syslog $remote_fs xend -# Should-Start: -# Required-Stop: $syslog $remote_fs xend -# Should-Stop: -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Default-Enabled: yes -# Short-Description: Start/stop secondary xen domains -# Description: Start / stop domains automatically when domain 0 -# boots / shuts down. -### END INIT INFO - -# Correct exit code would probably be 5, but it's enough -# if xend complains if we're not running as privileged domain -if ! [ -e /proc/xen/privcmd ]; then - exit 0 -fi - -LOCKFILE=/var/lock/subsys/xendomains -XENDOM_CONFIG=/etc/sysconfig/xendomains - -test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -. $XENDOM_CONFIG - -# Use the SUSE rc_ init script functions; -# emulate them on LSB, RH and other systems -if test -e /etc/rc.status; then - # SUSE rc script library - . /etc/rc.status -else - _cmd=$1 - declare -a _SMSG - if test "${_cmd}" = "status"; then - _SMSG=(running dead dead unused unknown) - _RC_UNUSED=3 - else - _SMSG=(done failed failed missed failed skipped unused failed failed) - _RC_UNUSED=6 - fi - if test -e /etc/init.d/functions; then - # REDHAT - . /etc/init.d/functions - echo_rc() - { - #echo -n " [${_SMSG[${_RC_RV}]}] " - if test ${_RC_RV} = 0; then - success " [${_SMSG[${_RC_RV}]}] " - else - failure " [${_SMSG[${_RC_RV}]}] " - fi - } - elif test -e /lib/lsb/init-functions; then - # LSB - . /lib/lsb/init-functions - if alias log_success_msg >/dev/null 2>/dev/null; then - echo_rc() - { - echo " [${_SMSG[${_RC_RV}]}] " - } - else - echo_rc() - { - if test ${_RC_RV} = 0; then - log_success_msg " [${_SMSG[${_RC_RV}]}] " - else - log_failure_msg " [${_SMSG[${_RC_RV}]}] " - fi - } - fi - else - # emulate it - echo_rc() - { - echo " [${_SMSG[${_RC_RV}]}] " - } - fi - rc_reset() { _RC_RV=0; } - rc_failed() - { - if test -z "$1"; then - _RC_RV=1; - elif test "$1" != "0"; then - _RC_RV=$1; - fi - return ${_RC_RV} - } - rc_check() - { - return rc_failed $? - } - rc_status() - { - rc_failed $? - if test "$1" = "-r"; then _RC_RV=0; shift; fi - if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi - if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi - if test "$1" = "-v"; then echo_rc; shift; fi - if test "$1" = "-r"; then _RC_RV=0; shift; fi - return ${_RC_RV} - } - rc_exit() { exit ${_RC_RV}; } - rc_active() - { - if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi - if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi - return 1 - } -fi - -if ! which usleep >&/dev/null -then - usleep() - { - if [ -n "$1" ] - then - sleep $(( $1 / 1000000 )) - fi - } -fi - -# Reset status of this service -rc_reset - -## -# Returns 0 (success) if the given parameter names a directory, and that -# directory is not empty. -# -contains_something() -{ - if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ] - then - return 0 - else - return 1 - fi -} - -# read name from xen config file -rdname() -{ - NM=$(xm create --quiet --dryrun --defconfig "$1" | - sed -n 's/^.*(name \(.*\))$/\1/p') -} - -rdnames() -{ - NAMES= - if ! contains_something "$XENDOMAINS_AUTO" - then - return - fi - for dom in $XENDOMAINS_AUTO/*; do - rdname $dom - if test -z $NAMES; then - NAMES=$NM; - else - NAMES="$NAMES|$NM" - fi - done -} - -parseln() -{ - if [[ "$1" =~ "\(domain" ]]; then - name=;id= - else if [[ "$1" =~ "\(name" ]]; then - name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/') - else if [[ "$1" =~ "\(domid" ]]; then - id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/') - fi; fi; fi - - [ -n "$name" -a -n "$id" ] && return 0 || return 1 -} - -is_running() -{ - rdname $1 - RC=1 - name=;id= - while read LN; do - parseln "$LN" || continue - if test $id = 0; then continue; fi - case $name in - ($NM) - RC=0 - ;; - esac - done < <(xm list -l | grep '(\(domain\|domid\|name\)') - return $RC -} - -start() -{ - if [ -f $LOCKFILE ]; then - echo -n "xendomains already running (lockfile exists)" - return; - fi - - saved_domains=" " - if [ "$XENDOMAINS_RESTORE" = "true" ] && - contains_something "$XENDOMAINS_SAVE" - then - mkdir -p $(dirname "$LOCKFILE") - touch $LOCKFILE - echo -n "Restoring Xen domains:" - saved_domains=`ls $XENDOMAINS_SAVE` - for dom in $XENDOMAINS_SAVE/*; do - if [ -f $dom ] ; then - HEADER=`head -c 16 $dom | head -n 1 2> /dev/null` - if [ $HEADER = "LinuxGuestRecord" ]; then - echo -n " ${dom##*/}" - xm restore $dom - if [ $? -ne 0 ]; then - rc_failed $? - echo -n '!' - else - # mv $dom ${dom%/*}/.${dom##*/} - rm $dom - fi - fi - fi - done - echo . - fi - - if contains_something "$XENDOMAINS_AUTO" - then - touch $LOCKFILE - echo -n "Starting auto Xen domains:" - # We expect config scripts for auto starting domains to be in - # XENDOMAINS_AUTO - they could just be symlinks to files elsewhere - - # Create all domains with config files in XENDOMAINS_AUTO. - # TODO: We should record which domain name belongs - # so we have the option to selectively shut down / migrate later - # If a domain statefile from $XENDOMAINS_SAVE matches a domain name - # in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't - # restore correctly it requires administrative attention. - for dom in $XENDOMAINS_AUTO/*; do - echo -n " ${dom##*/}" - shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p') - echo $saved_domains | grep -w $shortdom > /dev/null - if [ $? -eq 0 ] || is_running $dom; then - echo -n "(skip)" - else - xm create --quiet --defconfig $dom - if [ $? -ne 0 ]; then - rc_failed $? - echo -n '!' - else - usleep $XENDOMAINS_CREATE_USLEEP - fi - fi - done - fi -} - -all_zombies() -{ - name=;id= - while read LN; do - parseln "$LN" || continue - if test $id = 0; then continue; fi - if test "$state" != "-b---d" -a "$state" != "-----d"; then - return 1; - fi - done < <(xm list -l | grep '(\(domain\|domid\|name\)') - return 0 -} - -# Wait for max $XENDOMAINS_STOP_MAXWAIT for xm $1 to finish; -# if it has not exited by that time kill it, so the init script will -# succeed within a finite amount of time; if $2 is nonnull, it will -# kill the command as well as soon as no domain (except for zombies) -# are left (used for shutdown --all). -watchdog_xm() -{ - if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then - exit - fi - usleep 20000 - for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do - # exit if xm save/migrate/shutdown is finished - PSAX=`ps axlw | grep "xm $1" | grep -v grep` - if test -z "$PSAX"; then exit; fi - echo -n "."; sleep 1 - # go to kill immediately if there's only zombies left - if all_zombies && test -n "$2"; then break; fi - done - sleep 1 - read PSF PSUID PSPID PSPPID < <(echo "$PSAX") - # kill xm $1 - kill $PSPID >/dev/null 2>&1 -} - -stop() -{ - # Collect list of domains to shut down - if test "$XENDOMAINS_AUTO_ONLY" = "true"; then - rdnames - fi - echo -n "Shutting down Xen domains:" - name=;id= - while read LN; do - parseln "$LN" || continue - if test $id = 0; then continue; fi - echo -n " $name" - if test "$XENDOMAINS_AUTO_ONLY" = "true"; then - eval " - case \"\$name\" in - ($NAMES) - # nothing - ;; - (*) - echo -n '(skip)' - continue - ;; - esac - " - fi - # XENDOMAINS_SYSRQ chould be something like just "s" - # or "s e i u" or even "s e s i u o" - # for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so - if test -n "$XENDOMAINS_SYSRQ"; then - for sysrq in $XENDOMAINS_SYSRQ; do - echo -n "(SR-$sysrq)" - xm sysrq $id $sysrq - if test $? -ne 0; then - rc_failed $? - echo -n '!' - fi - # usleep just ignores empty arg - usleep $XENDOMAINS_USLEEP - done - fi - if test "$state" = "-b---d" -o "$state" = "-----d"; then - echo -n "(zomb)" - continue - fi - if test -n "$XENDOMAINS_MIGRATE"; then - echo -n "(migr)" - watchdog_xm migrate & - WDOG_PID=$! - xm migrate $id $XENDOMAINS_MIGRATE - if test $? -ne 0; then - rc_failed $? - echo -n '!' - kill $WDOG_PID >/dev/null 2>&1 - else - kill $WDOG_PID >/dev/null 2>&1 - continue - fi - fi - if test -n "$XENDOMAINS_SAVE"; then - echo -n "(save)" - watchdog_xm save & - WDOG_PID=$! - mkdir -p "$XENDOMAINS_SAVE" - xm save $id $XENDOMAINS_SAVE/$name - if test $? -ne 0; then - rc_failed $? - echo -n '!' - kill $WDOG_PID >/dev/null 2>&1 - else - kill $WDOG_PID >/dev/null 2>&1 - continue - fi - fi - if test -n "$XENDOMAINS_SHUTDOWN"; then - # XENDOMAINS_SHUTDOWN should be "--halt --wait" - echo -n "(shut)" - watchdog_xm shutdown & - WDOG_PID=$! - xm shutdown $id $XENDOMAINS_SHUTDOWN - if test $? -ne 0; then - rc_failed $? - echo -n '!' - fi - kill $WDOG_PID >/dev/null 2>&1 - fi - done < <(xm list -l | grep '(\(domain\|domid\|name\)') - - # NB. this shuts down ALL Xen domains (politely), not just the ones in - # AUTODIR/* - # This is because it's easier to do ;-) but arguably if this script is run - # on system shutdown then it's also the right thing to do. - if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then - # XENDOMAINS_SHUTDOWN_ALL should be "--all --halt --wait" - echo -n " SHUTDOWN_ALL " - watchdog_xm shutdown 1 & - WDOG_PID=$! - xm shutdown $XENDOMAINS_SHUTDOWN_ALL - if test $? -ne 0; then - rc_failed $? - echo -n '!' - fi - kill $WDOG_PID >/dev/null 2>&1 - fi - - # Unconditionally delete lock file - rm -f $LOCKFILE -} - -check_domain_up() -{ - name=;id= - while read LN; do - parseln "$LN" || continue - if test $id = 0; then continue; fi - case $name in - ($1) - return 0 - ;; - esac - done < <(xm list -l | grep '(\(domain\|domid\|name\)') - return 1 -} - -check_all_auto_domains_up() -{ - if ! contains_something "$XENDOMAINS_AUTO" - then - return 0 - fi - missing= - for nm in $XENDOMAINS_AUTO/*; do - rdname $nm - found=0 - if check_domain_up "$NM"; then - echo -n " $name" - else - missing="$missing $NM" - fi - done - if test -n "$missing"; then - echo -n " MISS AUTO:$missing" - return 1 - fi - return 0 -} - -check_all_saved_domains_up() -{ - if ! contains_something "$XENDOMAINS_SAVE" - then - return 0 - fi - missing=`/bin/ls $XENDOMAINS_SAVE` - echo -n " MISS SAVED: " $missing - return 1 -} - -# This does NOT necessarily restart all running domains: instead it -# stops all running domains and then boots all the domains specified in -# AUTODIR. If other domains have been started manually then they will -# not get restarted. -# Commented out to avoid confusion! - -restart() -{ - stop - start -} - -reload() -{ - restart -} - - -case "$1" in - start) - start - rc_status - if test -f $LOCKFILE; then rc_status -v; fi - ;; - - stop) - stop - rc_status -v - ;; - - restart) - restart - ;; - reload) - reload - ;; - - status) - echo -n "Checking for xendomains:" - if test ! -f $LOCKFILE; then - rc_failed 3 - else - check_all_auto_domains_up - rc_status - check_all_saved_domains_up - rc_status - fi - rc_status -v - ;; - - *) - echo "Usage: $0 {start|stop|restart|reload|status}" - rc_failed 3 - rc_status -v - ;; -esac - -rc_exit diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/locking.sh --- a/tools/examples/locking.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -# -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -# -# Serialisation -# - -LOCK_SLEEPTIME=1 -LOCK_SPINNING_RETRIES=5 -LOCK_RETRIES=100 -LOCK_BASEDIR=/var/run/xen-hotplug - - -claim_lock() -{ - local lockdir="$LOCK_BASEDIR/$1" - mkdir -p "$LOCK_BASEDIR" - _claim_lock "$lockdir" -} - - -release_lock() -{ - _release_lock "$LOCK_BASEDIR/$1" -} - - -_claim_lock() -{ - local lockdir="$1" - local owner=$(_lock_owner "$lockdir") - local retries=0 - - while [ $retries -lt $LOCK_RETRIES ] - do - mkdir "$lockdir" 2>/dev/null && trap "release_lock $1; sigerr" ERR && - _update_lock_info "$lockdir" && return - - local new_owner=$(_lock_owner "$lockdir") - if [ "$new_owner" != "$owner" ] - then - owner="$new_owner" - retries=0 - fi - - if [ $retries -gt $LOCK_SPINNING_RETRIES ] - then - sleep $LOCK_SLEEPTIME - else - sleep 0 - fi - retries=$(($retries + 1)) - done - _steal_lock "$lockdir" -} - - -_release_lock() -{ - trap sigerr ERR - rm -rf "$1" 2>/dev/null || true -} - - -_steal_lock() -{ - local lockdir="$1" - local owner=$(cat "$lockdir/owner" 2>/dev/null || echo "unknown") - log err "Forced to steal lock on $lockdir from $owner!" - _release_lock "$lockdir" - _claim_lock "$lockdir" -} - - -_lock_owner() -{ - cat "$1/owner" 2>/dev/null || echo "unknown" -} - - -_update_lock_info() -{ - echo "$$: $0" >"$1/owner" -} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/logging.sh --- a/tools/examples/logging.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -# -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -log() { - local level="$1" - shift - logger -p "daemon.$level" -- "$0:" "$@" || echo "$0 $@" >&2 -} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/network-bridge --- a/tools/examples/network-bridge Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,310 +0,0 @@ -#!/bin/bash -#============================================================================ -# Default Xen network start/stop script. -# Xend calls a network script when it starts. -# The script name to use is defined in /etc/xen/xend-config.sxp -# in the network-script field. -# -# This script creates a bridge (default ${netdev}), adds a device -# (defaults to the device on the default gateway route) to it, copies -# the IP addresses from the device to the bridge and adjusts the routes -# accordingly. -# -# If all goes well, this should ensure that networking stays up. -# However, some configurations are upset by this, especially -# NFS roots. If the bridged setup does not meet your needs, -# configure a different script, for example using routing instead. -# -# Usage: -# -# network-bridge (start|stop|status) {VAR=VAL}* -# -# Vars: -# -# bridge The bridge to use (default ${netdev}). -# netdev The interface to add to the bridge (default gateway device). -# antispoof Whether to use iptables to prevent spoofing (default no). -# -# Internal Vars: -# pdev="p${netdev}" -# tdev=tmpbridge -# -# start: -# Creates the bridge as tdev -# Copies the IP and MAC addresses from pdev to bridge -# Renames netdev to be pdev -# Renames tdev to bridge -# Enslaves pdev to bridge -# -# stop: -# Removes pdev from the bridge -# Transfers addresses, routes from bridge to pdev -# Renames bridge to tdev -# Renames pdev to netdev -# Deletes tdev -# -# status: -# Print addresses, interfaces, routes -# -#============================================================================ - - -dir=$(dirname "$0") -. "$dir/xen-script-common.sh" -. "$dir/xen-network-common.sh" - -findCommand "$@" -evalVariables "$@" - -is_network_root () { - local rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' /etc/mtab) - local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab) - - [[ "$rootfs" =~ "^nfs" ]] || [[ "$rootopts" =~ "_netdev" ]] && has_nfsroot=1 || has_nfsroot=0 - if [ $has_nfsroot -eq 1 ]; then - local bparms=$(cat /proc/cmdline) - for p in $bparms; do - local ipaddr=$(echo $p | awk /nfsroot=/'{ print substr($1,9,index($1,":")-9) }') - if [ "$ipaddr" != "" ]; then - local nfsdev=$(ip route get $ipaddr | awk /$ipaddr/'{ print $3 }') - [[ "$nfsdev" == "$netdev" ]] && return 0 || return 1 - fi - done - fi - return 1 -} - -find_alt_device () { - local interf=$1 - local prefix=${interf%[[:digit:]]} - local ifs=$(ip link show | grep " $prefix" |\ - gawk '{ printf ("%s",substr($2,1,length($2)-1)) }' |\ - sed s/$interf//) - echo "$ifs" -} - -netdev=${netdev:-$(ip route list 0.0.0.0/0 | \ - sed 's/.*dev \([a-z]\+[0-9]\+\).*$/\1/')} -if is_network_root ; then - altdevs=$(find_alt_device $netdev) - for netdev in $altdevs; do break; done - if [ -z "$netdev" ]; then - [ -x /usr/bin/logger ] && /usr/bin/logger "network-bridge: bridging not supported on network root; not starting" - exit - fi -fi -netdev=${netdev:-eth0} -bridge=${bridge:-${netdev}} -antispoof=${antispoof:-no} - -pdev="p${netdev}" -tdev=tmpbridge - -get_ip_info() { - addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e 's/ .*//'` - gateway=`ip route show dev $1 | fgrep default | sed 's/default via //'` -} - -do_ifup() { - if ! ifup $1 ; then - if [ -n "$addr_pfx" ] ; then - # use the info from get_ip_info() - ip addr flush $1 - ip addr add ${addr_pfx} dev $1 - ip link set dev $1 up - [ -n "$gateway" ] && ip route add default via ${gateway} - fi - fi -} - -# Usage: transfer_addrs src dst -# Copy all IP addresses (including aliases) from device $src to device $dst. -transfer_addrs () { - local src=$1 - local dst=$2 - # Don't bother if $dst already has IP addresses. - if ip addr show dev ${dst} | egrep -q '^ *inet ' ; then - return - fi - # Address lines start with 'inet' and have the device in them. - # Replace 'inet' with 'ip addr add' and change the device name $src - # to 'dev $src'. - ip addr show dev ${src} | egrep '^ *inet ' | sed -e " -s/inet/ip addr add/ -s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@ -s/${src}/dev ${dst} label ${dst}/ -s/secondary// -" | sh -e - # Remove automatic routes on destination device - ip route list | sed -ne " -/dev ${dst}\( \|$\)/ { - s/^/ip route del / - p -}" | sh -e -} - -# Usage: transfer_routes src dst -# Get all IP routes to device $src, delete them, and -# add the same routes to device $dst. -# The original routes have to be deleted, otherwise adding them -# for $dst fails (duplicate routes). -transfer_routes () { - local src=$1 - local dst=$2 - # List all routes and grep the ones with $src in. - # Stick 'ip route del' on the front to delete. - # Change $src to $dst and use 'ip route add' to add. - ip route list | sed -ne " -/dev ${src}\( \|$\)/ { - h - s/^/ip route del / - P - g - s/${src}/${dst}/ - s/^/ip route add / - P - d -}" | sh -e -} - - -## -# link_exists interface -# -# Returns 0 if the interface named exists (whether up or down), 1 otherwise. -# -link_exists() -{ - if ip link show "$1" >/dev/null 2>/dev/null - then - return 0 - else - return 1 - fi -} - -# Set the default forwarding policy for $dev to drop. -# Allow forwarding to the bridge. -antispoofing () { - iptables -P FORWARD DROP - iptables -F FORWARD - iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT -} - -# Usage: show_status dev bridge -# Print ifconfig and routes. -show_status () { - local dev=$1 - local bridge=$2 - - echo '============================================================' - ip addr show ${dev} - ip addr show ${bridge} - echo ' ' - brctl show ${bridge} - echo ' ' - ip route list - echo ' ' - route -n - echo '============================================================' -} - -op_start () { - if [ "${bridge}" = "null" ] ; then - return - fi - - if link_exists "$pdev"; then - # The device is already up. - return - fi - - create_bridge ${tdev} - - preiftransfer ${netdev} - transfer_addrs ${netdev} ${tdev} - if ! ifdown ${netdev}; then - # If ifdown fails, remember the IP details. - get_ip_info ${netdev} - ip link set ${netdev} down - ip addr flush ${netdev} - fi - ip link set ${netdev} name ${pdev} - ip link set ${tdev} name ${bridge} - - setup_bridge_port ${pdev} - - add_to_bridge2 ${bridge} ${pdev} - do_ifup ${bridge} - - if [ ${antispoof} = 'yes' ] ; then - antispoofing - fi -} - -op_stop () { - if [ "${bridge}" = "null" ]; then - return - fi - if ! link_exists "$bridge"; then - return - fi - - transfer_addrs ${bridge} ${pdev} - if ! ifdown ${bridge}; then - get_ip_info ${bridge} - fi - ip link set ${pdev} down - ip addr flush ${bridge} - - brctl delif ${bridge} ${pdev} - ip link set ${bridge} down - - ip link set ${bridge} name ${tdev} - ip link set ${pdev} name ${netdev} - do_ifup ${netdev} - - brctl delbr ${tdev} -} - -# adds $dev to $bridge but waits for $dev to be in running state first -add_to_bridge2() { - local bridge=$1 - local dev=$2 - local maxtries=10 - - echo -n "Waiting for ${dev} to negotiate link." - ip link set ${dev} up - for i in `seq ${maxtries}` ; do - if ifconfig ${dev} | grep -q RUNNING ; then - break - else - echo -n '.' - sleep 1 - fi - done - - if [ ${i} -eq ${maxtries} ] ; then echo -n '(link isnt in running state)' ; fi - echo - - add_to_bridge ${bridge} ${dev} -} - -case "$command" in - start) - op_start - ;; - - stop) - op_stop - ;; - - status) - show_status ${netdev} ${bridge} - ;; - - *) - echo "Unknown command: $command" >&2 - echo 'Valid commands are: start, stop, status' >&2 - exit 1 -esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/network-nat --- a/tools/examples/network-nat Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -#!/bin/bash -x -#============================================================================ -# Default Xen network start/stop script when using NAT. -# Xend calls a network script when it starts. -# The script name to use is defined in /etc/xen/xend-config.sxp -# in the network-script field. -# -# Usage: -# -# network-nat (start|stop|status) {VAR=VAL}* -# -# Vars: -# -# netdev The gateway interface (default eth0). -# antispoof Whether to use iptables to prevent spoofing (default no). -# dhcp Whether to alter the local DHCP configuration (default no). -# -#============================================================================ - -dir=$(dirname "$0") -. "$dir/xen-script-common.sh" -. "$dir/xen-network-common.sh" - -findCommand "$@" -evalVariables "$@" - -netdev=${netdev:-eth0} -# antispoofing not yet implemented -antispoof=${antispoof:-no} - -# turn on dhcp feature by default if dhcpd is installed -if [ -f /etc/dhcpd.conf ] -then - dhcp=${dhcp:-yes} -else - dhcp=${dhcp:-no} -fi - - -if [ "$dhcp" != 'no' ] -then - dhcpd_conf_file=$(find_dhcpd_conf_file) - dhcpd_init_file=$(find_dhcpd_init_file) - if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ] - then - echo 'Failed to find dhcpd configuration or init file.' >&2 - exit 1 - fi -fi - - -function dhcp_start() -{ - if ! grep -q "subnet 10.0.0.0" "$dhcpd_conf_file" - then - echo >>"$dhcpd_conf_file" "subnet 10.0.0.0 netmask 255.255.0.0 {}" - fi - - "$dhcpd_init_file" restart -} - - -function dhcp_stop() -{ - local tmpfile=$(mktemp) - grep -v "subnet 10.0.0.0" "$dhcpd_conf_file" >"$tmpfile" - if diff "$tmpfile" "$dhcpd_conf_file" >&/dev/null - then - rm "$tmpfile" - else - mv "$tmpfile" "$dhcpd_conf_file" - fi - - "$dhcpd_init_file" restart -} - - -op_start() { - echo 1 >/proc/sys/net/ipv4/ip_forward - iptables -t nat -A POSTROUTING -o ${netdev} -j MASQUERADE - [ "$dhcp" != 'no' ] && dhcp_start -} - - -op_stop() { - [ "$dhcp" != 'no' ] && dhcp_stop - iptables -t nat -D POSTROUTING -o ${netdev} -j MASQUERADE -} - - -show_status() { - echo '============================================================' - ifconfig - echo ' ' - ip route list - echo ' ' - route -n - echo '============================================================' - -} - -case "$command" in - start) - op_start - ;; - - stop) - op_stop - ;; - - status) - show_status - ;; - - *) - echo "Unknown command: $command" >&2 - echo 'Valid commands are: start, stop, status' >&2 - exit 1 -esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/network-route --- a/tools/examples/network-route Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -#!/bin/bash -#============================================================================ -# Default Xen network start/stop script. -# Xend calls a network script when it starts. -# The script name to use is defined in /etc/xen/xend-config.sxp -# in the network-script field. -# -# Usage: -# -# network-route (start|stop|status) {VAR=VAL}* -# -# Vars: -# -# netdev The gateway interface (default eth0). -# antispoof Whether to use iptables to prevent spoofing (default yes). -# -#============================================================================ - -dir=$(dirname "$0") -. "$dir/xen-script-common.sh" - -evalVariables "$@" - -netdev=${netdev:-eth${vifnum}} - -echo 1 >/proc/sys/net/ipv4/ip_forward -echo 1 >/proc/sys/net/ipv4/conf/${netdev}/proxy_arp diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vif-bridge --- a/tools/examples/vif-bridge Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -#!/bin/bash -#============================================================================ -# /etc/xen/vif-bridge -# -# Script for configuring a vif in bridged mode. -# The hotplugging system will call this script if it is specified either in -# the device configuration given to Xend, or the default Xend configuration -# in /etc/xen/xend-config.sxp. If the script is specified in neither of those -# places, then this script is the default. -# -# Usage: -# vif-bridge (add|remove|online|offline) -# -# Environment vars: -# vif vif interface name (required). -# XENBUS_PATH path to this device's details in the XenStore (required). -# -# Read from the store: -# bridge bridge to add the vif to (optional). Defaults to searching for the -# bridge itself. -# ip list of IP networks for the vif, space-separated (optional). -# -# up: -# Enslaves the vif interface to the bridge and adds iptables rules -# for its ip addresses (if any). -# -# down: -# Removes the vif interface from the bridge and removes the iptables -# rules for its ip addresses (if any). -#============================================================================ - -dir=$(dirname "$0") -. "$dir/vif-common.sh" - -bridge=${bridge:-} -bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge") - -if [ -z "$bridge" ] -then - bridge=$(brctl show | cut -d " -" -f 2 | cut -f 1) - - if [ -z "$bridge" ] - then - fatal "Could not find bridge, and none was specified" - fi -else - # - # Old style bridge setup with netloop, used to have a bridge name - # of xenbrX, enslaving pethX and vif0.X, and then configuring - # eth0. - # - # New style bridge setup does not use netloop, so the bridge name - # is ethX and the physical device is enslaved pethX - # - # So if... - # - # - User asks for xenbrX - # - AND xenbrX doesn't exist - # - AND there is a ethX device which is a bridge - # - # ..then we translate xenbrX to ethX - # - # This lets old config files work without modification - # - if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ] - then - if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ] - then - bridge="eth${bridge#xenbr}" - fi - fi -fi - -RET=0 -ip link show $bridge 1>/dev/null 2>&1 || RET=1 -if [ "$RET" -eq 1 ] -then - fatal "Could not find bridge device $bridge" -fi - -case "$command" in - online) - setup_bridge_port "$vif" - add_to_bridge "$bridge" "$vif" - ;; - - offline) - do_without_error brctl delif "$bridge" "$vif" - do_without_error ifconfig "$vif" down - ;; -esac - -handle_iptable - -log debug "Successful vif-bridge $command for $vif, bridge $bridge." -if [ "$command" == "online" ] -then - success -fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vif-common.sh --- a/tools/examples/vif-common.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -# -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - - -dir=$(dirname "$0") -. "$dir/xen-hotplug-common.sh" -. "$dir/xen-network-common.sh" - -findCommand "$@" - -if [ "$command" != "online" ] && - [ "$command" != "offline" ] && - [ "$command" != "add" ] && - [ "$command" != "remove" ] -then - log err "Invalid command: $command" - exit 1 -fi - -case "$command" in - add | remove) - exit 0 - ;; -esac - - -# Parameters may be read from the environment, the command line arguments, and -# the store, with overriding in that order. The environment is given by the -# driver, the command line is given by the Xend global configuration, and -# store details are given by the per-domain or per-device configuration. - -evalVariables "$@" - -ip=${ip:-} -ip=$(xenstore_read_default "$XENBUS_PATH/ip" "$ip") - -# Check presence of compulsory args. -XENBUS_PATH="${XENBUS_PATH:?}" -vif="${vif:?}" - - -vifname=$(xenstore_read_default "$XENBUS_PATH/vifname" "") -if [ "$vifname" ] -then - if [ "$command" == "online" ] && ! ip link show "$vifname" >&/dev/null - then - do_or_die ip link set "$vif" name "$vifname" - fi - vif="$vifname" -fi - - -frob_iptable() -{ - if [ "$command" == "online" ] - then - local c="-A" - else - local c="-D" - fi - - iptables "$c" FORWARD -m physdev --physdev-in "$vif" "$@" -j ACCEPT \ - 2>/dev/null || - [ "$c" == "-D" ] || - log err \ - "iptables $c FORWARD -m physdev --physdev-in $vif $@ -j ACCEPT failed. -If you are using iptables, this may affect networking for guest domains." -} - - -## -# Add or remove the appropriate entries in the iptables. With antispoofing -# turned on, we have to explicitly allow packets to the interface, regardless -# of the ip setting. If ip is set, then we additionally restrict the packets -# to those coming from the specified networks, though we allow DHCP requests -# as well. -# -handle_iptable() -{ - # Check for a working iptables installation. Checking for the iptables - # binary is not sufficient, because the user may not have the appropriate - # modules installed. If iptables is not working, then there's no need to do - # anything with it, so we can just return. - if ! iptables -L -n >&/dev/null - then - return - fi - - if [ "$ip" != "" ] - then - local addr - for addr in $ip - do - frob_iptable -s "$addr" - done - - # Always allow the domain to talk to a DHCP server. - frob_iptable -p udp --sport 68 --dport 67 - else - # No IP addresses have been specified, so allow anything. - frob_iptable - fi -} - - -## -# ip_of interface -# -# Print the IP address currently in use at the given interface, or nothing if -# the interface is not up. -# -ip_of() -{ - ip addr show "$1" | awk "/^.*inet.*$1\$/{print \$2}" | sed -n '1 s,/.*,,p' -} - - -## -# dom0_ip -# -# Print the IP address of the interface in dom0 through which we are routing. -# This is the IP address on the interface specified as "netdev" as a parameter -# to these scripts, or eth0 by default. This function will call fatal if no -# such interface could be found. -# -dom0_ip() -{ - local nd=${netdev:-eth0} - local result=$(ip_of "$nd") - if [ -z "$result" ] - then - fatal -"$netdev is not up. Bring it up or specify another interface with " \ -"netdev= as a parameter to $0." - fi - echo "$result" -} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vif-nat --- a/tools/examples/vif-nat Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,192 +0,0 @@ -#!/bin/bash -#============================================================================ -# /etc/xen/vif-nat -# -# Script for configuring a vif in routed-nat mode. -# The hotplugging system will call this script if it is specified either in -# the device configuration given to Xend, or the default Xend configuration -# in /etc/xen/xend-config.sxp. If the script is specified in neither of those -# places, then vif-bridge is the default. -# -# Usage: -# vif-nat (add|remove|online|offline) -# -# Environment vars: -# vif vif interface name (required). -# XENBUS_PATH path to this device's details in the XenStore (required). -# -# Parameters: -# dhcp Whether to alter the local DHCP configuration to include this -# new host (default no). -# -# Read from the store: -# ip list of IP networks for the vif, space-separated (default given in -# this script). -#============================================================================ - - -dir=$(dirname "$0") -. "$dir/vif-common.sh" - -# turn on dhcp feature by default if dhcpd is installed -if [ -f /etc/dhcpd.conf ] -then - dhcp=${dhcp:-yes} -else - dhcp=${dhcp:-no} -fi - -if [ "$dhcp" != 'no' ] -then - dhcpd_conf_file=$(find_dhcpd_conf_file) - dhcpd_init_file=$(find_dhcpd_init_file) - dhcpd_arg_file=$(find_dhcpd_arg_file) - if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ] || [ -z "$dhcpd_arg_file" ] - then - echo 'Failed to find dhcpd configuration or init or args file.' >&2 - exit 1 - fi -fi - - -domid=$(xenstore_read "$XENBUS_PATH/frontend-id") -vifid=$(xenstore_read "$XENBUS_PATH/handle") -vifid=$(( $vifid + 1 )) - - -ip_from_dom() -{ - local domid1=$(( $domid / 256 )) - local domid2=$(( $domid % 256 )) - - echo "10.$domid1.$domid2.$vifid/16" -} - - -routing_ip() -{ - echo $(echo $1 | awk -F. '{print $1"."$2"."$3"."$4 + 127}') -} - - -dotted_quad() -{ - echo\ - $(( ($1 & 0xFF000000) >> 24))\ -.$(( ($1 & 0x00FF0000) >> 16))\ -.$(( ($1 & 0x0000FF00) >> 8 ))\ -.$(( $1 & 0x000000FF )) -} - - -if [ "$ip" = "" ] -then - ip=$(ip_from_dom) -fi - -router_ip=$(routing_ip "$ip") - -# Split the given IP/bits pair. -vif_ip=`echo ${ip} | awk -F/ '{print $1}'` - -hostname=$(xenstore_read "$XENBUS_PATH/domain" | tr -- '_.:/+' '-----') -if [ "$vifid" != "1" ] -then - hostname="$hostname-$vifid" -fi - -dhcparg_remove_entry() -{ - local tmpfile=$(mktemp) - sed -e "s/$vif //" "$dhcpd_arg_file" >"$tmpfile" - if diff "$tmpfile" "$dhcpd_arg_file" >/dev/null - then - rm "$tmpfile" - else - mv "$tmpfile" "$dhcpd_arg_file" - fi -} - -dhcparg_add_entry() -{ - dhcparg_remove_entry - local tmpfile=$(mktemp) - # handle Red Hat, SUSE, and Debian styles, with or without quotes - sed -e 's/^DHCPDARGS="*\([^"]*\)"*/DHCPDARGS="\1'"$vif "'"/' \ - "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file" - sed -e 's/^DHCPD_INTERFACE="*\([^"]*\)"*/DHCPD_INTERFACE="\1'"$vif "'"/' \ - "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file" - sed -e 's/^INTERFACES="*\([^"]*\)"*/INTERFACES="\1'"$vif "'"/' \ - "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file" - rm -f "$tmpfile" -} - -dhcp_remove_entry() -{ - local tmpfile=$(mktemp) - grep -v "host $hostname" "$dhcpd_conf_file" >"$tmpfile" - if diff "$tmpfile" "$dhcpd_conf_file" >/dev/null - then - rm "$tmpfile" - else - mv "$tmpfile" "$dhcpd_conf_file" - fi - dhcparg_remove_entry -} - - -dhcp_up() -{ - claim_lock "vif-nat-dhcp" - dhcp_remove_entry - mac=$(xenstore_read "$XENBUS_PATH/mac") - echo >>"$dhcpd_conf_file" \ -"host $hostname { hardware ethernet $mac; fixed-address $vif_ip; option routers $router_ip; option host-name \"$hostname\"; }" - dhcparg_add_entry - release_lock "vif-nat-dhcp" - "$dhcpd_init_file" restart || true -} - - -dhcp_down() -{ - claim_lock "vif-nat-dhcp" - dhcp_remove_entry - release_lock "vif-nat-dhcp" - "$dhcpd_init_file" restart || true # We need to ignore failure because - # ISC dhcpd 3 borks if there is nothing - # for it to do, which is the case if - # the outgoing interface is not - # configured to offer leases and there - # are no vifs. -} - - -case "$command" in - online) - if ip route | grep -q "dev $vif" - then - log debug "$vif already up" - exit 0 - fi - - do_or_die ip link set "$vif" up arp on - do_or_die ip addr add "$router_ip" dev "$vif" - do_or_die ip route add "$vif_ip" dev "$vif" src "$router_ip" - echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp - [ "$dhcp" != 'no' ] && dhcp_up - ;; - offline) - [ "$dhcp" != 'no' ] && dhcp_down - do_without_error ifconfig "$vif" down - ;; -esac - - -handle_iptable - -log debug "Successful vif-nat $command for $vif." -if [ "$command" = "online" ] -then - success -fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vif-route --- a/tools/examples/vif-route Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -#!/bin/bash -#============================================================================ -# /etc/xen/vif-route -# -# Script for configuring a vif in routed mode. -# The hotplugging system will call this script if it is specified either in -# the device configuration given to Xend, or the default Xend configuration -# in /etc/xen/xend-config.sxp. If the script is specified in neither of those -# places, then vif-bridge is the default. -# -# Usage: -# vif-route (add|remove|online|offline) -# -# Environment vars: -# vif vif interface name (required). -# XENBUS_PATH path to this device's details in the XenStore (required). -# -# Read from the store: -# ip list of IP networks for the vif, space-separated (default given in -# this script). -#============================================================================ - -dir=$(dirname "$0") -. "$dir/vif-common.sh" - -main_ip=$(dom0_ip) - -case "$command" in - online) - ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up - echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp - ipcmd='add' - cmdprefix='' - ;; - offline) - do_without_error ifdown ${vif} - ipcmd='del' - cmdprefix='do_without_error' - ;; -esac - -if [ "${ip}" ] ; then - # If we've been given a list of IP addresses, then add routes from dom0 to - # the guest using those addresses. - for addr in ${ip} ; do - ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip} - done -fi - -handle_iptable - -log debug "Successful vif-route $command for $vif." -if [ "$command" = "online" ] -then - success -fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vscsi --- a/tools/examples/vscsi Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, FUJITSU Limited -# Based on the block scripts code. -# - -dir=$(dirname "$0") -. "$dir/xen-hotplug-common.sh" - -findCommand "$@" - -case "$command" in - add) - success - ;; - remove) - # TODO - exit 0 - ;; -esac - -exit 0 diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vtpm --- a/tools/examples/vtpm Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#!/bin/bash - -dir=$(dirname "$0") -. "$dir/vtpm-hotplug-common.sh" - -vtpm_fatal_error=0 - -case "$command" in - add) - vtpm_create_instance - ;; - remove) - vtpm_remove_instance - ;; -esac - -if [ $vtpm_fatal_error -eq 0 ]; then - log debug "Successful vTPM operation '$command'." - success -else - fatal "Error while executing vTPM operation '$command'." -fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vtpm-common.sh --- a/tools/examples/vtpm-common.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,448 +0,0 @@ -# -# Copyright (c) 2005 IBM Corporation -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -dir=$(dirname "$0") -. "$dir/logging.sh" -. "$dir/locking.sh" - -VTPMDB="/var/vtpm/vtpm.db" - -#In the vtpm-impl file some commands should be defined: -# vtpm_create, vtpm_setup, vtpm_start, etc. (see below) -if [ -r "$dir/vtpm-impl.alt" ]; then - . "$dir/vtpm-impl.alt" -elif [ -r "$dir/vtpm-impl" ]; then - . "$dir/vtpm-impl" -else - function vtpm_create () { - true - } - function vtpm_setup() { - true - } - function vtpm_start() { - true - } - function vtpm_suspend() { - true - } - function vtpm_resume() { - true - } - function vtpm_delete() { - true - } - function vtpm_migrate() { - echo "Error: vTPM migration accross machines not implemented." - } - function vtpm_migrate_local() { - echo "Error: local vTPM migration not supported" - } - function vtpm_migrate_recover() { - true - } -fi - - -#Find the instance number for the vtpm given the name of the domain -# Parameters -# - vmname : the name of the vm -# Return value -# Returns '0' if instance number could not be found, otherwise -# it returns the instance number in the variable 'instance' -function vtpmdb_find_instance () { - local vmname ret instance - vmname=$1 - ret=0 - - instance=$(cat $VTPMDB | \ - awk -vvmname=$vmname \ - '{ \ - if ( 1 != index($1,"#")) { \ - if ( $1 == vmname ) { \ - print $2; \ - exit; \ - } \ - } \ - }') - if [ "$instance" != "" ]; then - ret=$instance - fi - echo "$ret" -} - - -# Check whether a particular instance number is still available -# returns "0" if it is not available, "1" otherwise. -function vtpmdb_is_free_instancenum () { - local instance instances avail i - instance=$1 - avail=1 - #Allowed instance number range: 1-255 - if [ $instance -eq 0 -o $instance -gt 255 ]; then - avail=0 - else - instances=$(cat $VTPMDB | \ - gawk \ - '{ \ - if (1 != index($1,"#")) { \ - printf("%s ",$2); \ - } \ - }') - for i in $instances; do - if [ $i -eq $instance ]; then - avail=0 - break - fi - done - fi - echo "$avail" -} - - -# Get an available instance number given the database -# Returns an unused instance number -function vtpmdb_get_free_instancenum () { - local ctr instances don found - instances=$(cat $VTPMDB | \ - gawk \ - '{ \ - if (1 != index($1,"#")) { \ - printf("%s ",$2); \ - } \ - }') - ctr=1 - don=0 - while [ $don -eq 0 ]; do - found=0 - for i in $instances; do - if [ $i -eq $ctr ]; then - found=1; - break; - fi - done - - if [ $found -eq 0 ]; then - don=1 - break - fi - let ctr=ctr+1 - done - echo "$ctr" -} - - -# Add a domain name and instance number to the DB file -function vtpmdb_add_instance () { - local res vmname inst - vmname=$1 - inst=$2 - - if [ ! -f $VTPMDB ]; then - echo "#Database for VM to vTPM association" > $VTPMDB - echo "#1st column: domain name" >> $VTPMDB - echo "#2nd column: TPM instance number" >> $VTPMDB - fi - res=$(vtpmdb_validate_entry $vmname $inst) - if [ $res -eq 0 ]; then - echo "$vmname $inst" >> $VTPMDB - fi -} - - -#Validate whether an entry is the same as passed to this -#function -function vtpmdb_validate_entry () { - local res rc vmname inst - rc=0 - vmname=$1 - inst=$2 - - res=$(cat $VTPMDB | \ - gawk -vvmname=$vmname \ - -vinst=$inst \ - '{ \ - if ( 1 == index($1,"#")) {\ - } else \ - if ( $1 == vmname && \ - $2 == inst) { \ - printf("1"); \ - exit; \ - } else \ - if ( $1 == vmname || \ - $2 == inst) { \ - printf("2"); \ - exit; \ - } \ - }') - - if [ "$res" == "1" ]; then - rc=1 - elif [ "$res" == "2" ]; then - rc=2 - fi - echo "$rc" -} - - -#Remove an entry from the vTPM database given its domain name -#and instance number -function vtpmdb_remove_entry () { - local vmname instance VTPMDB_TMP - vmname=$1 - instance=$2 - VTPMDB_TMP="$VTPMDB".tmp - - $(cat $VTPMDB | \ - gawk -vvmname=$vmname \ - '{ \ - if ( $1 != vmname ) { \ - print $0; \ - } \ - '} > $VTPMDB_TMP) - if [ -e $VTPMDB_TMP ]; then - mv -f $VTPMDB_TMP $VTPMDB - vtpm_delete $instance - else - log err "Error creating temporary file '$VTPMDB_TMP'." - fi -} - - -# Find the reason for the creation of this device: -# Returns 'resume' or 'create' -function vtpm_get_create_reason () { - local resume - resume=$(xenstore_read $XENBUS_PATH/resume) - if [ "$resume" == "True" ]; then - echo "resume" - else - echo "create" - fi -} - - -#Create a vTPM instance -# If no entry in the TPM database is found, the instance is -# created and an entry added to the database. -function vtpm_create_instance () { - local res instance domname reason uuid - uuid=$(xenstore_read "$XENBUS_PATH"/uuid) - reason=$(vtpm_get_create_reason) - - claim_lock vtpmdb - - instance="0" - - if [ "$uuid" != "" ]; then - instance=$(vtpmdb_find_instance $uuid) - fi - if [ "$instance" == "0" ]; then - domname=$(xenstore_read "$XENBUS_PATH"/domain) - instance=$(vtpmdb_find_instance $domname) - fi - - if [ "$instance" == "0" -a "$reason" != "create" ]; then - release_lock vtpmdb - return - fi - - if [ "$instance" == "0" ]; then - #Try to give the preferred instance to the domain - instance=$(xenstore_read "$XENBUS_PATH"/pref_instance) - if [ "$instance" != "" ]; then - res=$(vtpmdb_is_free_instancenum $instance) - if [ $res -eq 0 ]; then - instance=$(vtpmdb_get_free_instancenum) - fi - else - instance=$(vtpmdb_get_free_instancenum) - fi - - vtpm_create $instance - - if [ $vtpm_fatal_error -eq 0 ]; then - if [ "$uuid" != "" ]; then - vtpmdb_add_instance $uuid $instance - else - vtpmdb_add_instance $domname $instance - fi - fi - else - if [ "$reason" == "resume" ]; then - vtpm_resume $instance - else - vtpm_start $instance - fi - fi - - release_lock vtpmdb - - xenstore_write $XENBUS_PATH/instance $instance -} - - -#Remove an instance when a VM is terminating or suspending. -#Since it is assumed that the VM will appear again, the -#entry is kept in the VTPMDB file. -function vtpm_remove_instance () { - local instance reason domname uuid - #Stop script execution quietly if path does not exist (anymore) - xenstore-exists "$XENBUS_PATH"/domain - uuid=$(xenstore_read "$XENBUS_PATH"/uuid) - - claim_lock vtpmdb - - instance="0" - - if [ "$uuid" != "" ]; then - instance=$(vtpmdb_find_instance $uuid) - fi - - if [ "$instance" == "0" ]; then - domname=$(xenstore_read "$XENBUS_PATH"/domain) - instance=$(vtpmdb_find_instance $domname) - fi - - if [ "$instance" != "0" ]; then - vtpm_suspend $instance - fi - - release_lock vtpmdb -} - - -#Remove an entry in the VTPMDB file given the domain's name -#1st parameter: The name of the domain -function vtpm_delete_instance () { - local instance - - claim_lock vtpmdb - - instance=$(vtpmdb_find_instance $1) - if [ "$instance" != "0" ]; then - vtpmdb_remove_entry $1 $instance - fi - - release_lock vtpmdb -} - -# Determine whether the given address is local to this machine -# Return values: -# "-1" : the given machine name is invalid -# "0" : this is not an address of this machine -# "1" : this is an address local to this machine -function vtpm_isLocalAddress() { - local addr res - addr=$(ping $1 -c 1 | \ - gawk '{ print substr($3,2,length($3)-2); exit }') - if [ "$addr" == "" ]; then - echo "-1" - return - fi - res=$(ifconfig | grep "inet addr" | \ - gawk -vaddr=$addr \ - '{ \ - if ( addr == substr($2, 6)) {\ - print "1"; \ - } \ - }' \ - ) - if [ "$res" == "" ]; then - echo "0" - return - fi - echo "1" -} - -# Perform a migration step. This function differentiates between migration -# to the local host or to a remote machine. -# Parameters: -# 1st: destination host to migrate to -# 2nd: name of the domain to migrate -# 3rd: the migration step to perform -function vtpm_migration_step() { - local res=$(vtpm_isLocalAddress $1) - if [ "$res" == "0" ]; then - vtpm_migrate $1 $2 $3 - else - vtpm_migrate_local - fi -} - -# Recover from migration due to an error. This function differentiates -# between migration to the local host or to a remote machine. -# Parameters: -# 1st: destination host the migration was going to -# 2nd: name of the domain that was to be migrated -# 3rd: the last successful migration step that was done -function vtpm_recover() { - local res - res=$(vtpm_isLocalAddress $1) - if [ "$res" == "0" ]; then - vtpm_migrate_recover $1 $2 $3 - fi -} - - -#Determine the domain id given a domain's name. -#1st parameter: name of the domain -#return value: domain id or -1 if domain id could not be determined -function vtpm_domid_from_name () { - local id name ids - ids=$(xenstore-list /local/domain) - for id in $ids; do - name=$(xenstore-read /local/domain/$id/name) - if [ "$name" == "$1" ]; then - echo "$id" - return - fi - done - echo "-1" -} - -#Determine the virtual TPM's instance number using the domain ID. -#1st parm: domain ID -function vtpm_uuid_by_domid() { - echo $(xenstore-read /local/domain/0/backend/vtpm/$1/0/uuid) -} - - -# Determine the vTPM's UUID by the name of the VM -function vtpm_uuid_from_vmname() { - local domid=$(vtpm_domid_from_name $1) - if [ "$domid" != "-1" ]; then - echo $(vtpm_uuid_by_domid $domid) - return - fi - echo "" -} - -#Add a virtual TPM instance number and its associated domain name -#to the VTPMDB file and activate usage of this virtual TPM instance -#by writing the instance number into the xenstore -#1st parm: name of virtual machine -#2nd parm: instance of associated virtual TPM -function vtpm_add_and_activate() { - local domid=$(vtpm_domid_from_name $1) - local vtpm_uuid=$(vtpm_uuid_from_vmname $1) - if [ "$vtpm_uuid" != "" -a "$domid" != "-1" ]; then - vtpmdb_add_instance $vtpm_uuid $2 - xenstore-write backend/vtpm/$domid/0/instance $2 - fi -} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vtpm-delete --- a/tools/examples/vtpm-delete Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#!/bin/bash - -# This scripts must be called the following way: -# vtpm-delete -# or -# vtpm-delete --vmname - -dir=$(dirname "$0") -. "$dir/vtpm-common.sh" - -if [ "$1" == "--vmname" ]; then - vtpm_uuid=$(vtpm_uuid_from_vmname $2) - if [ "$vtpm_uuid" != "" ];then - vtpm_delete_instance $vtpm_uuid - fi -else - vtpm_delete_instance $1 -fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vtpm-hotplug-common.sh --- a/tools/examples/vtpm-hotplug-common.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -# -# Copyright (c) 2005 IBM Corporation -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -dir=$(dirname "$0") -. "$dir/xen-hotplug-common.sh" - -findCommand "$@" -if [ "$command" != "online" ] && - [ "$command" != "offline" ] && - [ "$command" != "add" ] && - [ "$command" != "remove" ] -then - log err "Invalid command: $command" - exit 1 -fi - - -XENBUS_PATH="${XENBUS_PATH:?}" - -. "$dir/vtpm-common.sh" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vtpm-impl --- a/tools/examples/vtpm-impl Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,208 +0,0 @@ -#!/bin/bash -# =================================================================== -# -# Copyright (c) 2005, Intel Corp. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -# OF THE POSSIBILITY OF SUCH DAMAGE. -# =================================================================== - -# | SRC | TAG | CMD SIZE | ORD |mtype|strt -TPM_CMD_OPEN=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x01 -TPM_CMD_RESM=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x02 -TPM_CMD_CLOS=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x02 -TPM_CMD_DELE=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x03 - -TPM_TYPE_PVM=\\x01 -TPM_TYPE_HVM=\\x02 - -TPM_SUCCESS=00000000 - -TX_VTPM_MANAGER=/var/vtpm/fifos/from_console.fifo -RX_VTPM_MANAGER=/var/vtpm/fifos/to_console.fifo - -VTPM_MIG=/usr/bin/vtpm_migrator - -# -------------------- Helpers for binary streams ----------- - -function str_to_hex32() { - printf "%0.8x" $1 -} - -function hex32_to_bin() { - local inst=$(str_to_hex32 $1); - - local n1=`echo $inst | sed 's/\(..\)....../\\\\x\1/'` - local n2=`echo $inst | sed 's/..\(..\)..../\\\\x\1/'` - local n3=`echo $inst | sed 's/....\(..\)../\\\\x\1/'` - local n4=`echo $inst | sed 's/......\(..\)/\\\\x\1/'` - - echo "$n1$n2$n3$n4" -} - -function vtpm_manager_cmd() { - local cmd=$1; - local inst=$2; - local inst_bin=$(hex32_to_bin $inst); - - claim_lock vtpm_mgr - - #send cmd to vtpm_manager - printf "$cmd$inst_bin" > $TX_VTPM_MANAGER - - #recv response - set +e - local resp_hex=`dd skip=10 bs=1 count=4 if=$RX_VTPM_MANAGER 2> /dev/null | xxd -ps` - set -e - - release_lock vtpm_mgr - - #return whether the command was successful - if [ $resp_hex -ne $TPM_SUCCESS ]; then - vtpm_fatal_error=1 - false - else - true - fi -} - -# Helper to get vm type to pass to vtpm_manager open/resume -function vtpm_get_type() { - local inst=$(xenstore_read $XENBUS_PATH/frontend-id) - local vm=$(xenstore_read /local/domain/$inst/vm) - if [ "$vm" != "" ]; then - local ostype=$(xenstore-read $vm/image/ostype) - if [ "$ostype" == "hvm" ]; then - echo $TPM_TYPE_HVM; - else - echo $TPM_TYPE_PVM; - fi - fi -} - -# ------------------ Command handlers ----------------- - -# Create new vtpm instance & set it up for use -function vtpm_create () { - # Creation is handled implicitly by the manager on first setup - # so just set it up for use - $(vtpm_start $1) -} - -# Setup vtpm instance for use. -function vtpm_start() { - local vmtype=$(vtpm_get_type); - $(vtpm_manager_cmd $TPM_CMD_OPEN$vmtype $1) -} - -function vtpm_resume() { - local vmtype=$(vtpm_get_type); - $(vtpm_manager_cmd $TPM_CMD_RESM$vmtype $1) -} - -# Reset the vtpm AKA clear PCRs -function vtpm_reset() { - #not used by current implemenation - true -} - -# Shutdown the vtpm while the vm is down -# This could be a suspend of shutdown -# we cannot distinquish, so save the state -# and decide on startup if we should keep is -function vtpm_suspend() { - $(vtpm_manager_cmd $TPM_CMD_CLOS $1) -} - - -function vtpm_delete() { - local inst=$1 - if $(vtpm_manager_cmd $TPM_CMD_DELE $inst); then - rm -f /var/vtpm/vtpm_dm_$1.data - true - else - vtpm_fatal_error=1 - false - fi -} - -# Perform a migration step. This function differentiates between migration -# to the local host or to a remote machine. -# Parameters: -# 1st: destination host to migrate to -# 2nd: name of the domain to migrate -# 3rd: the migration step to perform -function vtpm_migrate() { - local instance res - - instance=$(vtpmdb_find_instance $2) - if [ "$instance" == "" ]; then - log err "VTPM Migratoin failed. Unable to translation of domain name" - echo "Error: VTPM Migration failed while looking up instance number" - fi - - case "$3" in - 0) - #Incicate migration supported - echo "0" - ;; - - 1) - # Get Public Key from Destination - # Call vtpm_manager's migration part 1 - claim_lock vtpm_mgr - $VTPM_MIG $1 $2 $instance $3 - release_lock vtpm_mgr - ;; - - 2) - # Call manager's migration step 2 and send result to destination - # If successful remove from db - claim_lock vtpm_mgr - $VTPM_MIG $1 $2 $instance $3 - release_lock vtpm_mgr - ;; - - 3) - if `ps x | grep "$VTPM_MIG $1"`; then - log err "VTPM Migration failed to complete." - echo "Error: VTPM Migration failed to complete." - fi - ;; - esac - -} - - -function vtpm_migrate_recover() { - echo "Error: Recovery not supported yet" -} - -function vtpm_migrate_local() { - echo "Error: local vTPM migration not supported" -} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/vtpm-migration.sh --- a/tools/examples/vtpm-migration.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -# -# Copyright (c) 2005 IBM Corporation -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -dir=$(dirname "$0") -. "$dir/vtpm-common.sh" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/xen-backend.agent --- a/tools/examples/xen-backend.agent Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#! /bin/bash - -PATH=/etc/xen/scripts:$PATH - -. /etc/xen/scripts/locking.sh - -claim_lock xenbus_hotplug_global - -case "$XENBUS_TYPE" in - tap) - /etc/xen/scripts/blktap "$ACTION" - ;; - vbd) - /etc/xen/scripts/block "$ACTION" - ;; - vtpm) - /etc/xen/scripts/vtpm "$ACTION" - ;; - vif) - [ -n "$script" ] && $script "$ACTION" - ;; - vscsi) - /etc/xen/scripts/vscsi "$ACTION" - ;; -esac - -case "$ACTION" in - add) - ;; - remove) - /etc/xen/scripts/xen-hotplug-cleanup - ;; - online) - ;; - offline) - ;; -esac - -release_lock xenbus_hotplug_global diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/xen-backend.rules --- a/tools/examples/xen-backend.rules Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -SUBSYSTEM=="xen-backend", KERNEL=="tap*", RUN+="/etc/xen/scripts/blktap $env{ACTION}" -SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block $env{ACTION}" -SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}" -SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="online", RUN+="$env{script} online" -SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="offline", RUN+="$env{script} offline" -SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}" -SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup" -KERNEL=="evtchn", NAME="xen/%k" -KERNEL=="blktap[0-9]*", NAME="xen/%k" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/xen-hotplug-cleanup --- a/tools/examples/xen-hotplug-cleanup Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#! /bin/bash - -dir=$(dirname "$0") -. "$dir/xen-hotplug-common.sh" - -# Claim the lock protecting /etc/xen/scripts/block. This stops a race whereby -# paths in the store would disappear underneath that script as it attempted to -# read from the store checking for device sharing. -# Any other scripts that do similar things will have to have their lock -# claimed too. -# This is pretty horrible, but there's not really a nicer way of solving this. -claim_lock "block" - -# remove device frontend store entries -xenstore-rm -t \ - $(xenstore-read "$XENBUS_PATH/frontend" 2>/dev/null) 2>/dev/null || true - -# remove device backend store entries -xenstore-rm -t "$XENBUS_PATH" 2>/dev/null || true -xenstore-rm -t "error/$XENBUS_PATH" 2>/dev/null || true - -release_lock "block" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/xen-hotplug-common.sh --- a/tools/examples/xen-hotplug-common.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -# -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - - -dir=$(dirname "$0") -. "$dir/logging.sh" -. "$dir/xen-script-common.sh" -. "$dir/locking.sh" - -exec 2>>/var/log/xen/xen-hotplug.log - -export PATH="/sbin:/bin:/usr/bin:/usr/sbin:$PATH" -export LANG="POSIX" -unset $(set | grep ^LC_ | cut -d= -f1) - -fatal() { - xenstore_write "$XENBUS_PATH/hotplug-error" "$*" \ - "$XENBUS_PATH/hotplug-status" error - log err "$@" - exit 1 -} - -success() { - # Tell DevController that backend is "connected" - xenstore_write "$XENBUS_PATH/hotplug-status" connected -} - -do_or_die() { - "$@" || fatal "$@ failed" -} - -do_without_error() { - "$@" 2>/dev/null || log debug "$@ failed" -} - -sigerr() { - fatal "$0 failed; error detected." -} - -trap sigerr ERR - - -## -# xenstore_read + -# -# Read each of the given paths, returning each result on a separate line, or -# exit this script if any of the paths is missing. -# -xenstore_read() { - local v=$(xenstore-read "$@" || true) - [ "$v" != "" ] || fatal "xenstore-read $@ failed." - echo "$v" -} - - -## -# xenstore_read_default -# -# Read the given path, returning the value there or the given default if the -# path is not present. -# -xenstore_read_default() { - xenstore-read "$1" 2>/dev/null || echo "$2" -} - - -## -# xenstore_write ( )+ -# -# Write each of the key/value pairs to the store, and exit this script if any -# such writing fails. -# -xenstore_write() { - log debug "Writing $@ to xenstore." - xenstore-write "$@" || fatal "Writing $@ to xenstore failed." -} - - -log debug "$@" "XENBUS_PATH=$XENBUS_PATH" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/xen-network-common.sh --- a/tools/examples/xen-network-common.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,118 +0,0 @@ -# -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - - -# Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives. - -# Other platforms just use ifup / ifdown directly. - -## -# preiftransfer -# -# @param $1 The current name for the physical device, which is also the name -# that the virtual device will take once the physical device has -# been renamed. - -if ! which ifup >/dev/null 2>/dev/null -then - preiftransfer() - { - true - } - ifup() - { - false - } - ifdown() - { - false - } -else - preiftransfer() - { - true - } -fi - - -first_file() -{ - t="$1" - shift - for file in $@ - do - if [ "$t" "$file" ] - then - echo "$file" - return - fi - done -} - -find_dhcpd_conf_file() -{ - first_file -f /etc/dhcp3/dhcpd.conf /etc/dhcpd.conf -} - - -find_dhcpd_init_file() -{ - first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd} -} - -find_dhcpd_arg_file() -{ - first_file -f /etc/sysconfig/dhcpd /etc/defaults/dhcp /etc/default/dhcp3-server -} - -# configure interfaces which act as pure bridge ports: -setup_bridge_port() { - local dev="$1" - - # take interface down ... - ip link set ${dev} down - - # ... and configure it - ip addr flush ${dev} -} - -# Usage: create_bridge bridge -create_bridge () { - local bridge=$1 - - # Don't create the bridge if it already exists. - if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then - brctl addbr ${bridge} - brctl stp ${bridge} off - brctl setfd ${bridge} 0 - fi -} - -# Usage: add_to_bridge bridge dev -add_to_bridge () { - local bridge=$1 - local dev=$2 - - # Don't add $dev to $bridge if it's already on a bridge. - if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then - ip link set ${dev} up || true - return - fi - brctl addif ${bridge} ${dev} - ip link set ${dev} up -} - diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/examples/xen-script-common.sh --- a/tools/examples/xen-script-common.sh Tue Nov 04 11:46:00 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -# -# Copyright (c) 2005 XenSource Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - - -set -e - - -evalVariables() -{ - for arg in "$@" - do - if expr 'index' "$arg" '=' '>' '1' >/dev/null - then - eval "$arg" - fi - done -} - - -findCommand() -{ - for arg in "$@" - do - if ! expr 'index' "$arg" '=' >/dev/null - then - command="$arg" - return - fi - done -} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/Makefile Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,97 @@ +XEN_ROOT = ../../../ +include $(XEN_ROOT)/tools/Rules.mk + +# Init scripts. +XEND_INITD = init.d/xend +XENDOMAINS_INITD = init.d/xendomains +XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains + +# Xen configuration dir and configs to go there. +XEN_CONFIG_DIR = /etc/xen + +# Xen script dir and scripts to go there. +XEN_SCRIPT_DIR = /etc/xen/scripts +XEN_SCRIPTS = network-bridge vif-bridge +XEN_SCRIPTS += network-route vif-route +XEN_SCRIPTS += network-nat vif-nat +XEN_SCRIPTS += block +XEN_SCRIPTS += block-enbd block-nbd +XEN_SCRIPTS += blktap +XEN_SCRIPTS += vtpm vtpm-delete +XEN_SCRIPTS += xen-hotplug-cleanup +XEN_SCRIPTS += external-device-migrate +XEN_SCRIPTS += vscsi +XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh +XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh +XEN_SCRIPT_DATA += block-common.sh vtpm-common.sh vtpm-hotplug-common.sh +XEN_SCRIPT_DATA += vtpm-migration.sh vtpm-impl + +XEN_HOTPLUG_DIR = /etc/hotplug +XEN_HOTPLUG_SCRIPTS = xen-backend.agent + +UDEV_RULES_DIR = /etc/udev +UDEV_RULES = xen-backend.rules + +DI = $(if $(DISTDIR),$(shell readlink -f $(DISTDIR)),) +DE = $(if $(DESTDIR),$(shell readlink -f $(DESTDIR)),) +ifeq ($(findstring $(DI),$(DE)),$(DI)) +HOTPLUGS=install-hotplug install-udev +else +ifeq ($(shell [ -x /usr/bin/udevinfo ] && [ `/usr/bin/udevinfo -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/'` -ge 059 ] && echo 1),1) +HOTPLUGS=install-udev +else +HOTPLUGS=install-hotplug +endif +endif + +.PHONY: all +all: + +.PHONY: build +build: + +.PHONY: install +install: all install-initd install-scripts $(HOTPLUGS) + +.PHONY: install-initd +install-initd: + [ -d $(DESTDIR)/etc/init.d ] || $(INSTALL_DIR) $(DESTDIR)/etc/init.d + [ -d $(DESTDIR)/etc/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)/etc/sysconfig + $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)/etc/init.d + $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)/etc/init.d + $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)/etc/sysconfig/xendomains + +.PHONY: install-scripts +install-scripts: + [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \ + $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) + set -e; for i in $(XEN_SCRIPTS); \ + do \ + $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + done + set -e; for i in $(XEN_SCRIPT_DATA); \ + do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + done + +.PHONY: install-hotplug +install-hotplug: + [ -d $(DESTDIR)$(XEN_HOTPLUG_DIR) ] || \ + $(INSTALL_DIR) $(DESTDIR)$(XEN_HOTPLUG_DIR) + set -e; for i in $(XEN_HOTPLUG_SCRIPTS); \ + do \ + $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_HOTPLUG_DIR); \ + done + +.PHONY: install-udev +install-udev: + [ -d $(DESTDIR)$(UDEV_RULES_DIR) ] || \ + $(INSTALL_DIR) $(DESTDIR)$(UDEV_RULES_DIR)/rules.d + set -e; for i in $(UDEV_RULES); \ + do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(UDEV_RULES_DIR); \ + ln -sf ../$$i $(DESTDIR)$(UDEV_RULES_DIR)/rules.d; \ + done + +.PHONY: clean +clean: diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/blktap --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/blktap Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,93 @@ +#!/bin/bash + +# Copyright (c) 2005, XenSource Ltd. + +dir=$(dirname "$0") +. "$dir/xen-hotplug-common.sh" +. "$dir/block-common.sh" + +findCommand "$@" + +## +# check_blktap_sharing file mode +# +# Perform the sharing check for the given blktap and mode. +# +check_blktap_sharing() +{ + local file="$1" + local mode="$2" + + local base_path="$XENBUS_BASE_PATH/$XENBUS_TYPE" + for dom in $(xenstore-list "$base_path") + do + for dev in $(xenstore-list "$base_path/$dom") + do + params=$(xenstore_read "$base_path/$dom/$dev/params" | cut -d: -f2) + if [ "$file" = "$params" ] + then + + if [ "$mode" = 'w' ] + then + if ! same_vm "$dom" + then + echo 'guest' + return + fi + else + local m=$(xenstore_read "$base_path/$dom/$dev/mode") + m=$(canonicalise_mode "$m") + + if [ "$m" = 'w' ] + then + if ! same_vm "$dom" + then + echo 'guest' + return + fi + fi + fi + fi + done + done + + echo 'ok' +} + + +t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING') +if [ -n "$t" ] +then + p=$(xenstore_read "$XENBUS_PATH/params") + # if we have a ':', chew from head including : + if echo $p | grep -q \: + then + p=${p#*:} + fi +fi +# some versions of readlink cannot be passed a regular file +if [ -L "$p" ]; then + file=$(readlink -f "$p") || fatal "$p link does not exist." +else + file="$p" +fi + +if [ "$command" = 'add' ] +then + [ -e "$file" ] || { fatal $file does not exist; } + + FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") + FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm") + mode=$(xenstore_read "$XENBUS_PATH/mode") + mode=$(canonicalise_mode "$mode") + + if [ "$mode" != '!' ] + then + result=$(check_blktap_sharing "$file" "$mode") + [ "$result" = 'ok' ] || ebusy "$file already in use by other domain" + fi + + success +fi + +exit 0 diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/block --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/block Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,381 @@ +#!/bin/bash + +dir=$(dirname "$0") +. "$dir/block-common.sh" + +expand_dev() { + local dev + case $1 in + /*) + dev=$1 + ;; + *) + dev=/dev/$1 + ;; + esac + echo -n $dev +} + + +## +# check_sharing device mode +# +# Check whether the device requested is already in use. To use the device in +# read-only mode, it may be in use in read-only mode, but may not be in use in +# read-write anywhere at all. To use the device in read-write mode, it must +# not be in use anywhere at all. +# +# Prints one of +# +# 'local': the device may not be used because it is mounted in the current +# (i.e. the privileged domain) in a way incompatible with the +# requested mode; +# 'guest': the device may not be used because it already mounted by a guest +# in a way incompatible with the requested mode; or +# 'ok': the device may be used. +# +check_sharing() +{ + local dev="$1" + local mode="$2" + + local devmm=$(device_major_minor "$dev") + local file + + if [ "$mode" = 'w' ] + then + toskip="^$" + else + toskip="^[^ ]* [^ ]* [^ ]* ro[, ]" + fi + + for file in $(cat /proc/mounts | grep -v "$toskip" | cut -f 1 -d ' ') + do + if [ -e "$file" ] + then + local d=$(device_major_minor "$file") + + if [ "$d" = "$devmm" ] + then + echo 'local' + return + fi + fi + done + + local base_path="$XENBUS_BASE_PATH/$XENBUS_TYPE" + for dom in $(xenstore-list "$base_path") + do + for dev in $(xenstore-list "$base_path/$dom") + do + d=$(xenstore_read_default "$base_path/$dom/$dev/physical-device" "") + + if [ "$d" = "$devmm" ] + then + if [ "$mode" = 'w' ] + then + if ! same_vm $dom + then + echo 'guest' + return + fi + else + local m=$(xenstore_read "$base_path/$dom/$dev/mode") + m=$(canonicalise_mode "$m") + + if [ "$m" = 'w' ] + then + if ! same_vm $dom + then + echo 'guest' + return + fi + fi + fi + fi + done + done + + echo 'ok' +} + + +## +# check_device_sharing dev mode +# +# Perform the sharing check for the given physical device and mode. +# +check_device_sharing() +{ + local dev="$1" + local mode=$(canonicalise_mode "$2") + local result + + if [ "x$mode" = 'x!' ] + then + return 0 + fi + + result=$(check_sharing "$dev" "$mode") + + if [ "$result" != 'ok' ] + then + do_ebusy "Device $dev is mounted " "$mode" "$result" + fi +} + + +## +# check_device_sharing file dev mode +# +# Perform the sharing check for the given file mounted through the given +# loopback interface, in the given mode. +# +check_file_sharing() +{ + local file="$1" + local dev="$2" + local mode="$3" + + result=$(check_sharing "$dev" "$mode") + + if [ "$result" != 'ok' ] + then + do_ebusy "File $file is loopback-mounted through $dev, +which is mounted " "$mode" "$result" + fi +} + + +## +# do_ebusy prefix mode result +# +# Helper function for check_device_sharing check_file_sharing, calling ebusy +# with an error message constructed from the given prefix, mode, and result +# from a call to check_sharing. +# +do_ebusy() +{ + local prefix="$1" + local mode="$2" + local result="$3" + + if [ "$result" = 'guest' ] + then + dom='a guest ' + when='now' + else + dom='the privileged ' + when='by a guest' + fi + + if [ "$mode" = 'w' ] + then + m1='' + m2='' + else + m1='read-write ' + m2='read-only ' + fi + + release_lock "block" + ebusy \ +"${prefix}${m1}in ${dom}domain, +and so cannot be mounted ${m2}${when}." +} + + +t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING') + +case "$command" in + add) + phys=$(xenstore_read_default "$XENBUS_PATH/physical-device" 'MISSING') + if [ "$phys" != 'MISSING' ] + then + # Depending upon the hotplug configuration, it is possible for this + # script to be called twice, so just bail. + exit 0 + fi + + if [ -n "$t" ] + then + p=$(xenstore_read "$XENBUS_PATH/params") + mode=$(xenstore_read "$XENBUS_PATH/mode") + fi + + case $t in + phy) + dev=$(expand_dev $p) + FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") + FRONTEND_UUID=$(xenstore_read_default \ + "/local/domain/$FRONTEND_ID/vm" 'unknown') + + if [ -L "$dev" ] + then + dev=$(readlink -f "$dev") || fatal "$dev link does not exist." + fi + test -e "$dev" || fatal "$dev does not exist." + test -b "$dev" || fatal "$dev is not a block device." + + claim_lock "block" + check_device_sharing "$dev" "$mode" + write_dev "$dev" + release_lock "block" + exit 0 + ;; + + file) + # Canonicalise the file, for sharing check comparison, and the mode + # for ease of use here. + file=$(readlink -f "$p") || fatal "$p does not exist." + test -f "$file" || fatal "$file does not exist." + mode=$(canonicalise_mode "$mode") + + claim_lock "block" + + if [ "$mode" = 'w' ] && ! stat "$file" -c %A | grep -q w + then + release_lock "block" + ebusy \ +"File $file is read-only, and so I will not +mount it read-write in a guest domain." + fi + + loopdev='' + for dev in /dev/loop* + do + if [ ! -b "$dev" ] + then + continue + fi + + f=$(losetup "$dev" 2>/dev/null) || f='' + + if [ "$f" ] + then + # $dev is in use. Check sharing. + if [ "x$mode" = 'x!' ] + then + continue + fi + + f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g') + + # $f is the filename, as read from losetup, but the loopback + # driver truncates filenames at 64 characters, so we need to go + # trawling through the store if it's longer than that. Truncation + # is indicated by an asterisk at the end of the filename. + if expr index "$f" '*' >/dev/null + then + found="" + for dom in $(xenstore-list "$XENBUS_BASE_PATH") + do + for domdev in $(xenstore-list "$XENBUS_BASE_PATH/$dom") + do + d=$(xenstore_read_default \ + "$XENBUS_BASE_PATH/$dom/$domdev/node" "") + if [ "$d" = "$dev" ] + then + f=$(xenstore_read "$XENBUS_BASE_PATH/$dom/$domdev/params") + found=1 + break 2 + fi + done + done + + if [ ! "$found" ] + then + # This loopback device is in use by someone else, so skip it. + log debug "Loopback sharing check skips device $dev." + continue + fi + fi + + # Canonicalise the filename for the comparison. + + # I have seen this readlink fails because the filename given by + # losetup is only the basename. This cannot happen when the loop + # device is set up through this script, because file is + # canonicalised above, but it may happen when loop devices are set + # up some other way. This readlink may also conceivably fail if + # the file backing this loop device has been removed. + + # For maximum safety, in the case that $f does not resolve, we + # assume that $file and $f are in the same directory. + + # If you create a loopback filesystem, remove it and continue to + # run on it, and then create another file with the same name, then + # this check will block that -- don't do that. + + # If you create loop devices through some other mechanism, use + # relative filenames, and then use the same filename through this + # script, then this check will block that -- don't do that either. + + f=$(readlink -f "$f" || echo $(dirname "$file")/$(basename "$f")) + + + if [ "$f" = "$file" ] + then + check_file_sharing "$file" "$dev" "$mode" + fi + else + # $dev is not in use, so we'll remember it for use later; we want + # to finish the sharing check first. + + if [ "$loopdev" = '' ] + then + loopdev="$dev" + fi + fi + done + + if [ "$loopdev" = '' ] + then + release_lock "block" + fatal 'Failed to find an unused loop device' + fi + + if LANG=C losetup -h 2>&1 | grep read-only >/dev/null + then + roflag="-$mode"; roflag="${roflag#-w}"; roflag="${roflag#-!}" + else + roflag='' + fi + do_or_die losetup $roflag "$loopdev" "$file" + xenstore_write "$XENBUS_PATH/node" "$loopdev" + write_dev "$loopdev" + release_lock "block" + exit 0 + ;; + + "") + claim_lock "block" + success + release_lock "block" + ;; + esac + ;; + + remove) + case $t in + phy) + exit 0 + ;; + + file) + node=$(xenstore_read "$XENBUS_PATH/node") + losetup -d "$node" + exit 0 + ;; + + "") + exit 0 + ;; + esac + ;; + +esac + +# If we've reached here, $t is neither phy nor file, so fire a helper script. +[ -x /etc/xen/scripts/block-"$t" ] && \ + /etc/xen/scripts/block-"$t" "$command" $node diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/block-common.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/block-common.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,116 @@ +# +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + + +dir=$(dirname "$0") +. "$dir/xen-hotplug-common.sh" + +findCommand "$@" + +if [ "$command" != "add" ] && + [ "$command" != "remove" ] +then + log err "Invalid command: $command" + exit 1 +fi + + +XENBUS_PATH="${XENBUS_PATH:?}" + + +ebusy() +{ + xenstore_write "$XENBUS_PATH/hotplug-error" "$*" \ + "$XENBUS_PATH/hotplug-status" busy + log err "$@" + exit 1 +} + + +## +# Print the given device's major and minor numbers, written in hex and +# separated by a colon. +device_major_minor() +{ + stat -L -c %t:%T "$1" +} + + +## +# Write physical-device = MM,mm to the store, where MM and mm are the major +# and minor numbers of device respectively. +# +# @param device The device from which major and minor numbers are read, which +# will be written into the store. +# +write_dev() { + local mm + + mm=$(device_major_minor "$1") + + if [ -z $mm ] + then + fatal "Backend device does not exist" + fi + + xenstore_write "$XENBUS_PATH/physical-device" "$mm" + + success +} + + +## +# canonicalise_mode mode +# +# Takes the given mode, which may be r, w, ro, rw, w!, or rw!, or variations +# thereof, and canonicalises them to one of +# +# 'r': perform checks for a new read-only mount; +# 'w': perform checks for a read-write mount; or +# '!': perform no checks at all. +# +canonicalise_mode() +{ + local mode="$1" + + if ! expr index "$mode" 'w' >/dev/null + then + echo 'r' + elif ! expr index "$mode" '!' >/dev/null + then + echo 'w' + else + echo '!' + fi +} + + +same_vm() +{ + local otherdom="$1" + # Note that othervm can be MISSING here, because Xend will be racing with + # the hotplug scripts -- the entries in /local/domain can be removed by + # Xend before the hotplug scripts have removed the entry in + # /local/domain/0/backend/. In this case, we want to pretend that the + # VM is the same as FRONTEND_UUID, because that way the 'sharing' will be + # allowed. + local othervm=$(xenstore_read_default "/local/domain/$otherdom/vm" \ + "$FRONTEND_UUID") + + [ "$FRONTEND_UUID" = "$othervm" ] +} + diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/block-enbd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/block-enbd Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,27 @@ +#!/bin/bash + +# Usage: block-enbd [bind server ctl_port |unbind node] +# +# The node argument to unbind is the name of the device node we are to +# unbind. +# +# This assumes you're running a correctly configured server at the other end! + +dir=$(dirname "$0") +. "$dir/block-common.sh" + +case "$command" in + add) + for dev in /dev/nd*; do + if nbd-client $2:$3 $dev; then + write_dev $dev + exit 0 + fi + done + exit 1 + ;; + remove) + nbd-client -d $2 + exit 0 + ;; +esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/block-nbd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/block-nbd Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,27 @@ +#!/bin/bash + +# Usage: block-nbd [bind server ctl_port |unbind node] +# +# The node argument to unbind is the name of the device node we are to +# unbind. +# +# This assumes you're running a correctly configured server at the other end! + +dir=$(dirname "$0") +. "$dir/block-common.sh" + +case "$command" in + add) + for dev in /dev/nbd*; do + if nbd-client $2 $3 $dev; then + write_dev $dev + exit 0 + fi + done + exit 1 + ;; + remove) + nbd-client -d $2 + exit 0 + ;; +esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/external-device-migrate --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/external-device-migrate Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,98 @@ +#!/bin/bash + +# Copyright (c) 2005 IBM Corporation +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +set -x + +# This script is called by XenD for migration of external devices +# It does not handle the migration of those devices itself, but +# passes the requests on to further applications +# It handles the low-level command line parsing and some of the +# synchronization + +dir=$(dirname "$0") +. "$dir/logging.sh" + + +function ext_dev_migrate_usage() { +cat < : n-th migration step +-host : the destination host +-domname : name of the domain that is migrating +-type : the type of device that is migrating +-subtype : the subtype of the device +-recover : indicates recovery request; an error + occurred during migration +-help : display this help screen +EOF +} + +# Parse the command line paramters. The following parameters must be +# passed as the first ones in the sequence: +# -step [required] +# -host [required] +# -domname [required] +# -type [required] +# -subtype [optional] +# -recover [optional] +# The remaining ones will be passed to the called function. +function evaluate_params() +{ + local step host domname typ recover filename func stype + stype="" + while [ $# -ge 1 ]; do + case "$1" in + -step) step=$2; shift; shift;; + -host) host=$2; shift; shift;; + -domname) domname=$2; shift; shift;; + -type) typ=$2; shift; shift;; + -subtype) stype=$2; shift; shift;; + -recover) recover=1; shift;; + -help) ext_dev_migrate_usage; exit 0;; + *) break;; + esac + done + + if [ "$step" = "" -o \ + "$host" = "" -o \ + "$typ" = "" -o \ + "$domname" = "" ]; then + echo "Error: Parameter(s) missing (-step/-host/-type/-domname)" 1>&2 + echo "" 1>&2 + echo "$0 -help for usage." 1>&2 + exit 1 + fi + + filename="$dir/$typ$stype-migration.sh" + if [ ! -r $filename ]; then + echo "Error: Could not find script '$filename'" + return + fi + . "$filename" + + if [ "$recover" = "1" ]; then + func="$typ"_recover + eval $func $host $domname $step $* + else + func="$typ"_migration_step + eval $func $host $domname $step $* + fi +} + +evaluate_params "$@" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/init.d/sysconfig.xendomains --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/init.d/sysconfig.xendomains Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,137 @@ +## Path: System/xen +## Description: xen domain start/stop on boot +## Type: string +## Default: +# +# The xendomains script can send SysRq requests to domains on shutdown. +# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility +# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks +# of the domains ("s"). +# +XENDOMAINS_SYSRQ="" + +## Type: integer +## Default: 100000 +# +# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait +# (in microseconds) after each SysRq, so the domain has a chance to react. +# If you want to a quick'n'dirty shutdown via SysRq, you may want to set +# it to a relatively high value (1200000). +# +XENDOMAINS_USLEEP=100000 + +## Type: integer +## Default: 5000000 +# +# When creating a guest domain, it is sensible to allow a little time for it +# to get started before creating another domain or proceeding through the +# boot process. Without this, the booting guests will thrash the disk as they +# start up. This timeout (in microseconds) specifies the delay after guest +# domain creation. +# +XENDOMAINS_CREATE_USLEEP=5000000 + +## Type: string +## Default: "" +# +# Set this to a non-empty string if you want to migrate virtual machines +# on shutdown. The string will be passed to the xm migrate DOMID command +# as is: It should contain the target IP address of the physical machine +# to migrate to and optionally parameters like --live. Leave empty if +# you don't want to try virtual machine relocation on shutdown. +# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for +# that domain. +# +XENDOMAINS_MIGRATE="" + +## Type: string +## Default: /var/lib/xen/save +# +# Directory to save running domains to when the system (dom0) is +# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE +# is set (see below). Leave empty to disable domain saving on shutdown +# (e.g. because you rather shut domains down). +# If domain saving does succeed, SHUTDOWN will not be executed. +# +XENDOMAINS_SAVE=/var/lib/xen/save + +## Type: string +## Default: "--halt --wait" +# +# If neither MIGRATE nor SAVE were enabled or if they failed, you can +# try to shut down a domain by sending it a shutdown request. To do this, +# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting +# for the domain to be really down. Leave empty to skip domain shutdown. +# +XENDOMAINS_SHUTDOWN="--halt --wait" + +## Type: string +## Default: "--all --halt --wait" +# +# After we have gone over all virtual machines (resp. all automatically +# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq, +# migrated, saved and/or shutdown according to the settings above, we +# might want to shutdown the virtual machines that are still running +# for some reason or another. To do this, set this variable to +# "--all --halt --wait", it will be passed to xm shutdown. +# Leave it empty not to do anything special here. +# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY +# is set.) +# +XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait" + +## Type: boolean +## Default: true +# +# This variable determines whether saved domains from XENDOMAINS_SAVE +# will be restored on system startup. +# +XENDOMAINS_RESTORE=true + +## Type: string +## Default: /etc/xen/auto +# +# This variable sets the directory where domains configurations +# are stored that should be started on system startup automatically. +# Leave empty if you don't want to start domains automatically +# (or just don't place any xen domain config files in that dir). +# Note that the script tries to be clever if both RESTORE and AUTO are +# set: It will first restore saved domains and then only start domains +# in AUTO which are not running yet. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO=/etc/xen/auto + +## Type: boolean +## Default: false +# +# If this variable is set to "true", only the domains started via config +# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ, +# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise +# all running domains will be. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO_ONLY=false + +## Type: integer +## Default: 300 +# +# On xendomains stop, a number of xm commands (xm migrate, save, shutdown, +# shutdown --all) may be executed. In the worst case, these commands may +# stall forever, which will prevent a successful shutdown of the machine. +# If this variable is non-zero, the script will set up a watchdog timer +# for every of these xm commands and time it out after the number of seconds +# specified by this variable. +# Note that SHUTDOWN_ALL will not be called if no virtual machines or only +# zombies are still running, so you don't need to enable this timeout just +# for the zombie case. +# The setting should be large enough to make sure that migrate/save/shutdown +# can succeed. If you do live migrations, keep in mind that live migration +# of a 1GB machine over Gigabit ethernet may actually take something like +# 100s (assuming that live migration uses 10% of the network # bandwidth). +# Depending on the virtual machine, a shutdown may also require a significant +# amount of time. So better setup this variable to a huge number and hope the +# watchdog never fires. +# +XENDOMAINS_STOP_MAXWAIT=300 + diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/init.d/xend --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/init.d/xend Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,66 @@ +#!/bin/bash +# +# xend Script to start and stop the Xen control daemon. +# +# Author: Keir Fraser +# +# chkconfig: 2345 98 01 +# description: Starts and stops the Xen control daemon. +### BEGIN INIT INFO +# Provides: xend +# Required-Start: $syslog $remote_fs +# Should-Start: +# Required-Stop: $syslog $remote_fs +# Should-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Default-Enabled: yes +# Short-Description: Start/stop xend +# Description: Starts and stops the Xen control daemon. +### END INIT INFO + +if ! grep -q "control_d" /proc/xen/capabilities ; then + exit 0 +fi + +# Wait for Xend to be up +function await_daemons_up +{ + i=1 + rets=10 + xend status + while [ $? -ne 0 -a $i -lt $rets ]; do + sleep 1 + echo -n . + i=$(($i + 1)) + xend status + done +} + +case "$1" in + start) + xend start + await_daemons_up + ;; + stop) + xend stop + ;; + status) + xend status + ;; + reload) + xend reload + ;; + restart|force-reload) + xend restart + await_daemons_up + ;; + *) + # do not advertise unreasonable commands that there is no reason + # to use with this device + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 1 +esac + +exit $? + diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/init.d/xendomains --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/init.d/xendomains Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,531 @@ +#!/bin/bash +# +# /etc/init.d/xendomains +# Start / stop domains automatically when domain 0 boots / shuts down. +# +# chkconfig: 345 99 00 +# description: Start / stop Xen domains. +# +# This script offers fairly basic functionality. It should work on Redhat +# but also on LSB-compliant SuSE releases and on Debian with the LSB package +# installed. (LSB is the Linux Standard Base) +# +# Based on the example in the "Designing High Quality Integrated Linux +# Applications HOWTO" by Avi Alkalay +# +# +### BEGIN INIT INFO +# Provides: xendomains +# Required-Start: $syslog $remote_fs xend +# Should-Start: +# Required-Stop: $syslog $remote_fs xend +# Should-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Default-Enabled: yes +# Short-Description: Start/stop secondary xen domains +# Description: Start / stop domains automatically when domain 0 +# boots / shuts down. +### END INIT INFO + +# Correct exit code would probably be 5, but it's enough +# if xend complains if we're not running as privileged domain +if ! [ -e /proc/xen/privcmd ]; then + exit 0 +fi + +LOCKFILE=/var/lock/subsys/xendomains +XENDOM_CONFIG=/etc/sysconfig/xendomains + +test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing"; + if [ "$1" = "stop" ]; then exit 0; + else exit 6; fi; } + +. $XENDOM_CONFIG + +# Use the SUSE rc_ init script functions; +# emulate them on LSB, RH and other systems +if test -e /etc/rc.status; then + # SUSE rc script library + . /etc/rc.status +else + _cmd=$1 + declare -a _SMSG + if test "${_cmd}" = "status"; then + _SMSG=(running dead dead unused unknown) + _RC_UNUSED=3 + else + _SMSG=(done failed failed missed failed skipped unused failed failed) + _RC_UNUSED=6 + fi + if test -e /etc/init.d/functions; then + # REDHAT + . /etc/init.d/functions + echo_rc() + { + #echo -n " [${_SMSG[${_RC_RV}]}] " + if test ${_RC_RV} = 0; then + success " [${_SMSG[${_RC_RV}]}] " + else + failure " [${_SMSG[${_RC_RV}]}] " + fi + } + elif test -e /lib/lsb/init-functions; then + # LSB + . /lib/lsb/init-functions + if alias log_success_msg >/dev/null 2>/dev/null; then + echo_rc() + { + echo " [${_SMSG[${_RC_RV}]}] " + } + else + echo_rc() + { + if test ${_RC_RV} = 0; then + log_success_msg " [${_SMSG[${_RC_RV}]}] " + else + log_failure_msg " [${_SMSG[${_RC_RV}]}] " + fi + } + fi + else + # emulate it + echo_rc() + { + echo " [${_SMSG[${_RC_RV}]}] " + } + fi + rc_reset() { _RC_RV=0; } + rc_failed() + { + if test -z "$1"; then + _RC_RV=1; + elif test "$1" != "0"; then + _RC_RV=$1; + fi + return ${_RC_RV} + } + rc_check() + { + return rc_failed $? + } + rc_status() + { + rc_failed $? + if test "$1" = "-r"; then _RC_RV=0; shift; fi + if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi + if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi + if test "$1" = "-v"; then echo_rc; shift; fi + if test "$1" = "-r"; then _RC_RV=0; shift; fi + return ${_RC_RV} + } + rc_exit() { exit ${_RC_RV}; } + rc_active() + { + if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi + if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi + return 1 + } +fi + +if ! which usleep >&/dev/null +then + usleep() + { + if [ -n "$1" ] + then + sleep $(( $1 / 1000000 )) + fi + } +fi + +# Reset status of this service +rc_reset + +## +# Returns 0 (success) if the given parameter names a directory, and that +# directory is not empty. +# +contains_something() +{ + if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ] + then + return 0 + else + return 1 + fi +} + +# read name from xen config file +rdname() +{ + NM=$(xm create --quiet --dryrun --defconfig "$1" | + sed -n 's/^.*(name \(.*\))$/\1/p') +} + +rdnames() +{ + NAMES= + if ! contains_something "$XENDOMAINS_AUTO" + then + return + fi + for dom in $XENDOMAINS_AUTO/*; do + rdname $dom + if test -z $NAMES; then + NAMES=$NM; + else + NAMES="$NAMES|$NM" + fi + done +} + +parseln() +{ + if [[ "$1" =~ "\(domain" ]]; then + name=;id= + else if [[ "$1" =~ "\(name" ]]; then + name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/') + else if [[ "$1" =~ "\(domid" ]]; then + id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/') + fi; fi; fi + + [ -n "$name" -a -n "$id" ] && return 0 || return 1 +} + +is_running() +{ + rdname $1 + RC=1 + name=;id= + while read LN; do + parseln "$LN" || continue + if test $id = 0; then continue; fi + case $name in + ($NM) + RC=0 + ;; + esac + done < <(xm list -l | grep '(\(domain\|domid\|name\)') + return $RC +} + +start() +{ + if [ -f $LOCKFILE ]; then + echo -n "xendomains already running (lockfile exists)" + return; + fi + + saved_domains=" " + if [ "$XENDOMAINS_RESTORE" = "true" ] && + contains_something "$XENDOMAINS_SAVE" + then + mkdir -p $(dirname "$LOCKFILE") + touch $LOCKFILE + echo -n "Restoring Xen domains:" + saved_domains=`ls $XENDOMAINS_SAVE` + for dom in $XENDOMAINS_SAVE/*; do + if [ -f $dom ] ; then + HEADER=`head -c 16 $dom | head -n 1 2> /dev/null` + if [ $HEADER = "LinuxGuestRecord" ]; then + echo -n " ${dom##*/}" + xm restore $dom + if [ $? -ne 0 ]; then + rc_failed $? + echo -n '!' + else + # mv $dom ${dom%/*}/.${dom##*/} + rm $dom + fi + fi + fi + done + echo . + fi + + if contains_something "$XENDOMAINS_AUTO" + then + touch $LOCKFILE + echo -n "Starting auto Xen domains:" + # We expect config scripts for auto starting domains to be in + # XENDOMAINS_AUTO - they could just be symlinks to files elsewhere + + # Create all domains with config files in XENDOMAINS_AUTO. + # TODO: We should record which domain name belongs + # so we have the option to selectively shut down / migrate later + # If a domain statefile from $XENDOMAINS_SAVE matches a domain name + # in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't + # restore correctly it requires administrative attention. + for dom in $XENDOMAINS_AUTO/*; do + echo -n " ${dom##*/}" + shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p') + echo $saved_domains | grep -w $shortdom > /dev/null + if [ $? -eq 0 ] || is_running $dom; then + echo -n "(skip)" + else + xm create --quiet --defconfig $dom + if [ $? -ne 0 ]; then + rc_failed $? + echo -n '!' + else + usleep $XENDOMAINS_CREATE_USLEEP + fi + fi + done + fi +} + +all_zombies() +{ + name=;id= + while read LN; do + parseln "$LN" || continue + if test $id = 0; then continue; fi + if test "$state" != "-b---d" -a "$state" != "-----d"; then + return 1; + fi + done < <(xm list -l | grep '(\(domain\|domid\|name\)') + return 0 +} + +# Wait for max $XENDOMAINS_STOP_MAXWAIT for xm $1 to finish; +# if it has not exited by that time kill it, so the init script will +# succeed within a finite amount of time; if $2 is nonnull, it will +# kill the command as well as soon as no domain (except for zombies) +# are left (used for shutdown --all). +watchdog_xm() +{ + if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then + exit + fi + usleep 20000 + for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do + # exit if xm save/migrate/shutdown is finished + PSAX=`ps axlw | grep "xm $1" | grep -v grep` + if test -z "$PSAX"; then exit; fi + echo -n "."; sleep 1 + # go to kill immediately if there's only zombies left + if all_zombies && test -n "$2"; then break; fi + done + sleep 1 + read PSF PSUID PSPID PSPPID < <(echo "$PSAX") + # kill xm $1 + kill $PSPID >/dev/null 2>&1 +} + +stop() +{ + # Collect list of domains to shut down + if test "$XENDOMAINS_AUTO_ONLY" = "true"; then + rdnames + fi + echo -n "Shutting down Xen domains:" + name=;id= + while read LN; do + parseln "$LN" || continue + if test $id = 0; then continue; fi + echo -n " $name" + if test "$XENDOMAINS_AUTO_ONLY" = "true"; then + eval " + case \"\$name\" in + ($NAMES) + # nothing + ;; + (*) + echo -n '(skip)' + continue + ;; + esac + " + fi + # XENDOMAINS_SYSRQ chould be something like just "s" + # or "s e i u" or even "s e s i u o" + # for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so + if test -n "$XENDOMAINS_SYSRQ"; then + for sysrq in $XENDOMAINS_SYSRQ; do + echo -n "(SR-$sysrq)" + xm sysrq $id $sysrq + if test $? -ne 0; then + rc_failed $? + echo -n '!' + fi + # usleep just ignores empty arg + usleep $XENDOMAINS_USLEEP + done + fi + if test "$state" = "-b---d" -o "$state" = "-----d"; then + echo -n "(zomb)" + continue + fi + if test -n "$XENDOMAINS_MIGRATE"; then + echo -n "(migr)" + watchdog_xm migrate & + WDOG_PID=$! + xm migrate $id $XENDOMAINS_MIGRATE + if test $? -ne 0; then + rc_failed $? + echo -n '!' + kill $WDOG_PID >/dev/null 2>&1 + else + kill $WDOG_PID >/dev/null 2>&1 + continue + fi + fi + if test -n "$XENDOMAINS_SAVE"; then + echo -n "(save)" + watchdog_xm save & + WDOG_PID=$! + mkdir -p "$XENDOMAINS_SAVE" + xm save $id $XENDOMAINS_SAVE/$name + if test $? -ne 0; then + rc_failed $? + echo -n '!' + kill $WDOG_PID >/dev/null 2>&1 + else + kill $WDOG_PID >/dev/null 2>&1 + continue + fi + fi + if test -n "$XENDOMAINS_SHUTDOWN"; then + # XENDOMAINS_SHUTDOWN should be "--halt --wait" + echo -n "(shut)" + watchdog_xm shutdown & + WDOG_PID=$! + xm shutdown $id $XENDOMAINS_SHUTDOWN + if test $? -ne 0; then + rc_failed $? + echo -n '!' + fi + kill $WDOG_PID >/dev/null 2>&1 + fi + done < <(xm list -l | grep '(\(domain\|domid\|name\)') + + # NB. this shuts down ALL Xen domains (politely), not just the ones in + # AUTODIR/* + # This is because it's easier to do ;-) but arguably if this script is run + # on system shutdown then it's also the right thing to do. + if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then + # XENDOMAINS_SHUTDOWN_ALL should be "--all --halt --wait" + echo -n " SHUTDOWN_ALL " + watchdog_xm shutdown 1 & + WDOG_PID=$! + xm shutdown $XENDOMAINS_SHUTDOWN_ALL + if test $? -ne 0; then + rc_failed $? + echo -n '!' + fi + kill $WDOG_PID >/dev/null 2>&1 + fi + + # Unconditionally delete lock file + rm -f $LOCKFILE +} + +check_domain_up() +{ + name=;id= + while read LN; do + parseln "$LN" || continue + if test $id = 0; then continue; fi + case $name in + ($1) + return 0 + ;; + esac + done < <(xm list -l | grep '(\(domain\|domid\|name\)') + return 1 +} + +check_all_auto_domains_up() +{ + if ! contains_something "$XENDOMAINS_AUTO" + then + return 0 + fi + missing= + for nm in $XENDOMAINS_AUTO/*; do + rdname $nm + found=0 + if check_domain_up "$NM"; then + echo -n " $name" + else + missing="$missing $NM" + fi + done + if test -n "$missing"; then + echo -n " MISS AUTO:$missing" + return 1 + fi + return 0 +} + +check_all_saved_domains_up() +{ + if ! contains_something "$XENDOMAINS_SAVE" + then + return 0 + fi + missing=`/bin/ls $XENDOMAINS_SAVE` + echo -n " MISS SAVED: " $missing + return 1 +} + +# This does NOT necessarily restart all running domains: instead it +# stops all running domains and then boots all the domains specified in +# AUTODIR. If other domains have been started manually then they will +# not get restarted. +# Commented out to avoid confusion! + +restart() +{ + stop + start +} + +reload() +{ + restart +} + + +case "$1" in + start) + start + rc_status + if test -f $LOCKFILE; then rc_status -v; fi + ;; + + stop) + stop + rc_status -v + ;; + + restart) + restart + ;; + reload) + reload + ;; + + status) + echo -n "Checking for xendomains:" + if test ! -f $LOCKFILE; then + rc_failed 3 + else + check_all_auto_domains_up + rc_status + check_all_saved_domains_up + rc_status + fi + rc_status -v + ;; + + *) + echo "Usage: $0 {start|stop|restart|reload|status}" + rc_failed 3 + rc_status -v + ;; +esac + +rc_exit diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/locking.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/locking.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,98 @@ +# +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# +# Serialisation +# + +LOCK_SLEEPTIME=1 +LOCK_SPINNING_RETRIES=5 +LOCK_RETRIES=100 +LOCK_BASEDIR=/var/run/xen-hotplug + + +claim_lock() +{ + local lockdir="$LOCK_BASEDIR/$1" + mkdir -p "$LOCK_BASEDIR" + _claim_lock "$lockdir" +} + + +release_lock() +{ + _release_lock "$LOCK_BASEDIR/$1" +} + + +_claim_lock() +{ + local lockdir="$1" + local owner=$(_lock_owner "$lockdir") + local retries=0 + + while [ $retries -lt $LOCK_RETRIES ] + do + mkdir "$lockdir" 2>/dev/null && trap "release_lock $1; sigerr" ERR && + _update_lock_info "$lockdir" && return + + local new_owner=$(_lock_owner "$lockdir") + if [ "$new_owner" != "$owner" ] + then + owner="$new_owner" + retries=0 + fi + + if [ $retries -gt $LOCK_SPINNING_RETRIES ] + then + sleep $LOCK_SLEEPTIME + else + sleep 0 + fi + retries=$(($retries + 1)) + done + _steal_lock "$lockdir" +} + + +_release_lock() +{ + trap sigerr ERR + rm -rf "$1" 2>/dev/null || true +} + + +_steal_lock() +{ + local lockdir="$1" + local owner=$(cat "$lockdir/owner" 2>/dev/null || echo "unknown") + log err "Forced to steal lock on $lockdir from $owner!" + _release_lock "$lockdir" + _claim_lock "$lockdir" +} + + +_lock_owner() +{ + cat "$1/owner" 2>/dev/null || echo "unknown" +} + + +_update_lock_info() +{ + echo "$$: $0" >"$1/owner" +} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/logging.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/logging.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,22 @@ +# +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +log() { + local level="$1" + shift + logger -p "daemon.$level" -- "$0:" "$@" || echo "$0 $@" >&2 +} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/network-bridge --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/network-bridge Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,310 @@ +#!/bin/bash +#============================================================================ +# Default Xen network start/stop script. +# Xend calls a network script when it starts. +# The script name to use is defined in /etc/xen/xend-config.sxp +# in the network-script field. +# +# This script creates a bridge (default ${netdev}), adds a device +# (defaults to the device on the default gateway route) to it, copies +# the IP addresses from the device to the bridge and adjusts the routes +# accordingly. +# +# If all goes well, this should ensure that networking stays up. +# However, some configurations are upset by this, especially +# NFS roots. If the bridged setup does not meet your needs, +# configure a different script, for example using routing instead. +# +# Usage: +# +# network-bridge (start|stop|status) {VAR=VAL}* +# +# Vars: +# +# bridge The bridge to use (default ${netdev}). +# netdev The interface to add to the bridge (default gateway device). +# antispoof Whether to use iptables to prevent spoofing (default no). +# +# Internal Vars: +# pdev="p${netdev}" +# tdev=tmpbridge +# +# start: +# Creates the bridge as tdev +# Copies the IP and MAC addresses from pdev to bridge +# Renames netdev to be pdev +# Renames tdev to bridge +# Enslaves pdev to bridge +# +# stop: +# Removes pdev from the bridge +# Transfers addresses, routes from bridge to pdev +# Renames bridge to tdev +# Renames pdev to netdev +# Deletes tdev +# +# status: +# Print addresses, interfaces, routes +# +#============================================================================ + + +dir=$(dirname "$0") +. "$dir/xen-script-common.sh" +. "$dir/xen-network-common.sh" + +findCommand "$@" +evalVariables "$@" + +is_network_root () { + local rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' /etc/mtab) + local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab) + + [[ "$rootfs" =~ "^nfs" ]] || [[ "$rootopts" =~ "_netdev" ]] && has_nfsroot=1 || has_nfsroot=0 + if [ $has_nfsroot -eq 1 ]; then + local bparms=$(cat /proc/cmdline) + for p in $bparms; do + local ipaddr=$(echo $p | awk /nfsroot=/'{ print substr($1,9,index($1,":")-9) }') + if [ "$ipaddr" != "" ]; then + local nfsdev=$(ip route get $ipaddr | awk /$ipaddr/'{ print $3 }') + [[ "$nfsdev" == "$netdev" ]] && return 0 || return 1 + fi + done + fi + return 1 +} + +find_alt_device () { + local interf=$1 + local prefix=${interf%[[:digit:]]} + local ifs=$(ip link show | grep " $prefix" |\ + gawk '{ printf ("%s",substr($2,1,length($2)-1)) }' |\ + sed s/$interf//) + echo "$ifs" +} + +netdev=${netdev:-$(ip route list 0.0.0.0/0 | \ + sed 's/.*dev \([a-z]\+[0-9]\+\).*$/\1/')} +if is_network_root ; then + altdevs=$(find_alt_device $netdev) + for netdev in $altdevs; do break; done + if [ -z "$netdev" ]; then + [ -x /usr/bin/logger ] && /usr/bin/logger "network-bridge: bridging not supported on network root; not starting" + exit + fi +fi +netdev=${netdev:-eth0} +bridge=${bridge:-${netdev}} +antispoof=${antispoof:-no} + +pdev="p${netdev}" +tdev=tmpbridge + +get_ip_info() { + addr_pfx=`ip addr show dev $1 | egrep '^ *inet' | sed -e 's/ *inet //' -e 's/ .*//'` + gateway=`ip route show dev $1 | fgrep default | sed 's/default via //'` +} + +do_ifup() { + if ! ifup $1 ; then + if [ -n "$addr_pfx" ] ; then + # use the info from get_ip_info() + ip addr flush $1 + ip addr add ${addr_pfx} dev $1 + ip link set dev $1 up + [ -n "$gateway" ] && ip route add default via ${gateway} + fi + fi +} + +# Usage: transfer_addrs src dst +# Copy all IP addresses (including aliases) from device $src to device $dst. +transfer_addrs () { + local src=$1 + local dst=$2 + # Don't bother if $dst already has IP addresses. + if ip addr show dev ${dst} | egrep -q '^ *inet ' ; then + return + fi + # Address lines start with 'inet' and have the device in them. + # Replace 'inet' with 'ip addr add' and change the device name $src + # to 'dev $src'. + ip addr show dev ${src} | egrep '^ *inet ' | sed -e " +s/inet/ip addr add/ +s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@ +s/${src}/dev ${dst} label ${dst}/ +s/secondary// +" | sh -e + # Remove automatic routes on destination device + ip route list | sed -ne " +/dev ${dst}\( \|$\)/ { + s/^/ip route del / + p +}" | sh -e +} + +# Usage: transfer_routes src dst +# Get all IP routes to device $src, delete them, and +# add the same routes to device $dst. +# The original routes have to be deleted, otherwise adding them +# for $dst fails (duplicate routes). +transfer_routes () { + local src=$1 + local dst=$2 + # List all routes and grep the ones with $src in. + # Stick 'ip route del' on the front to delete. + # Change $src to $dst and use 'ip route add' to add. + ip route list | sed -ne " +/dev ${src}\( \|$\)/ { + h + s/^/ip route del / + P + g + s/${src}/${dst}/ + s/^/ip route add / + P + d +}" | sh -e +} + + +## +# link_exists interface +# +# Returns 0 if the interface named exists (whether up or down), 1 otherwise. +# +link_exists() +{ + if ip link show "$1" >/dev/null 2>/dev/null + then + return 0 + else + return 1 + fi +} + +# Set the default forwarding policy for $dev to drop. +# Allow forwarding to the bridge. +antispoofing () { + iptables -P FORWARD DROP + iptables -F FORWARD + iptables -A FORWARD -m physdev --physdev-in ${pdev} -j ACCEPT +} + +# Usage: show_status dev bridge +# Print ifconfig and routes. +show_status () { + local dev=$1 + local bridge=$2 + + echo '============================================================' + ip addr show ${dev} + ip addr show ${bridge} + echo ' ' + brctl show ${bridge} + echo ' ' + ip route list + echo ' ' + route -n + echo '============================================================' +} + +op_start () { + if [ "${bridge}" = "null" ] ; then + return + fi + + if link_exists "$pdev"; then + # The device is already up. + return + fi + + create_bridge ${tdev} + + preiftransfer ${netdev} + transfer_addrs ${netdev} ${tdev} + if ! ifdown ${netdev}; then + # If ifdown fails, remember the IP details. + get_ip_info ${netdev} + ip link set ${netdev} down + ip addr flush ${netdev} + fi + ip link set ${netdev} name ${pdev} + ip link set ${tdev} name ${bridge} + + setup_bridge_port ${pdev} + + add_to_bridge2 ${bridge} ${pdev} + do_ifup ${bridge} + + if [ ${antispoof} = 'yes' ] ; then + antispoofing + fi +} + +op_stop () { + if [ "${bridge}" = "null" ]; then + return + fi + if ! link_exists "$bridge"; then + return + fi + + transfer_addrs ${bridge} ${pdev} + if ! ifdown ${bridge}; then + get_ip_info ${bridge} + fi + ip link set ${pdev} down + ip addr flush ${bridge} + + brctl delif ${bridge} ${pdev} + ip link set ${bridge} down + + ip link set ${bridge} name ${tdev} + ip link set ${pdev} name ${netdev} + do_ifup ${netdev} + + brctl delbr ${tdev} +} + +# adds $dev to $bridge but waits for $dev to be in running state first +add_to_bridge2() { + local bridge=$1 + local dev=$2 + local maxtries=10 + + echo -n "Waiting for ${dev} to negotiate link." + ip link set ${dev} up + for i in `seq ${maxtries}` ; do + if ifconfig ${dev} | grep -q RUNNING ; then + break + else + echo -n '.' + sleep 1 + fi + done + + if [ ${i} -eq ${maxtries} ] ; then echo -n '(link isnt in running state)' ; fi + echo + + add_to_bridge ${bridge} ${dev} +} + +case "$command" in + start) + op_start + ;; + + stop) + op_stop + ;; + + status) + show_status ${netdev} ${bridge} + ;; + + *) + echo "Unknown command: $command" >&2 + echo 'Valid commands are: start, stop, status' >&2 + exit 1 +esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/network-nat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/network-nat Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,119 @@ +#!/bin/bash -x +#============================================================================ +# Default Xen network start/stop script when using NAT. +# Xend calls a network script when it starts. +# The script name to use is defined in /etc/xen/xend-config.sxp +# in the network-script field. +# +# Usage: +# +# network-nat (start|stop|status) {VAR=VAL}* +# +# Vars: +# +# netdev The gateway interface (default eth0). +# antispoof Whether to use iptables to prevent spoofing (default no). +# dhcp Whether to alter the local DHCP configuration (default no). +# +#============================================================================ + +dir=$(dirname "$0") +. "$dir/xen-script-common.sh" +. "$dir/xen-network-common.sh" + +findCommand "$@" +evalVariables "$@" + +netdev=${netdev:-eth0} +# antispoofing not yet implemented +antispoof=${antispoof:-no} + +# turn on dhcp feature by default if dhcpd is installed +if [ -f /etc/dhcpd.conf ] +then + dhcp=${dhcp:-yes} +else + dhcp=${dhcp:-no} +fi + + +if [ "$dhcp" != 'no' ] +then + dhcpd_conf_file=$(find_dhcpd_conf_file) + dhcpd_init_file=$(find_dhcpd_init_file) + if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ] + then + echo 'Failed to find dhcpd configuration or init file.' >&2 + exit 1 + fi +fi + + +function dhcp_start() +{ + if ! grep -q "subnet 10.0.0.0" "$dhcpd_conf_file" + then + echo >>"$dhcpd_conf_file" "subnet 10.0.0.0 netmask 255.255.0.0 {}" + fi + + "$dhcpd_init_file" restart +} + + +function dhcp_stop() +{ + local tmpfile=$(mktemp) + grep -v "subnet 10.0.0.0" "$dhcpd_conf_file" >"$tmpfile" + if diff "$tmpfile" "$dhcpd_conf_file" >&/dev/null + then + rm "$tmpfile" + else + mv "$tmpfile" "$dhcpd_conf_file" + fi + + "$dhcpd_init_file" restart +} + + +op_start() { + echo 1 >/proc/sys/net/ipv4/ip_forward + iptables -t nat -A POSTROUTING -o ${netdev} -j MASQUERADE + [ "$dhcp" != 'no' ] && dhcp_start +} + + +op_stop() { + [ "$dhcp" != 'no' ] && dhcp_stop + iptables -t nat -D POSTROUTING -o ${netdev} -j MASQUERADE +} + + +show_status() { + echo '============================================================' + ifconfig + echo ' ' + ip route list + echo ' ' + route -n + echo '============================================================' + +} + +case "$command" in + start) + op_start + ;; + + stop) + op_stop + ;; + + status) + show_status + ;; + + *) + echo "Unknown command: $command" >&2 + echo 'Valid commands are: start, stop, status' >&2 + exit 1 +esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/network-route --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/network-route Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,27 @@ +#!/bin/bash +#============================================================================ +# Default Xen network start/stop script. +# Xend calls a network script when it starts. +# The script name to use is defined in /etc/xen/xend-config.sxp +# in the network-script field. +# +# Usage: +# +# network-route (start|stop|status) {VAR=VAL}* +# +# Vars: +# +# netdev The gateway interface (default eth0). +# antispoof Whether to use iptables to prevent spoofing (default yes). +# +#============================================================================ + +dir=$(dirname "$0") +. "$dir/xen-script-common.sh" + +evalVariables "$@" + +netdev=${netdev:-eth${vifnum}} + +echo 1 >/proc/sys/net/ipv4/ip_forward +echo 1 >/proc/sys/net/ipv4/conf/${netdev}/proxy_arp diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vif-bridge --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vif-bridge Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,100 @@ +#!/bin/bash +#============================================================================ +# /etc/xen/vif-bridge +# +# Script for configuring a vif in bridged mode. +# The hotplugging system will call this script if it is specified either in +# the device configuration given to Xend, or the default Xend configuration +# in /etc/xen/xend-config.sxp. If the script is specified in neither of those +# places, then this script is the default. +# +# Usage: +# vif-bridge (add|remove|online|offline) +# +# Environment vars: +# vif vif interface name (required). +# XENBUS_PATH path to this device's details in the XenStore (required). +# +# Read from the store: +# bridge bridge to add the vif to (optional). Defaults to searching for the +# bridge itself. +# ip list of IP networks for the vif, space-separated (optional). +# +# up: +# Enslaves the vif interface to the bridge and adds iptables rules +# for its ip addresses (if any). +# +# down: +# Removes the vif interface from the bridge and removes the iptables +# rules for its ip addresses (if any). +#============================================================================ + +dir=$(dirname "$0") +. "$dir/vif-common.sh" + +bridge=${bridge:-} +bridge=$(xenstore_read_default "$XENBUS_PATH/bridge" "$bridge") + +if [ -z "$bridge" ] +then + bridge=$(brctl show | cut -d " +" -f 2 | cut -f 1) + + if [ -z "$bridge" ] + then + fatal "Could not find bridge, and none was specified" + fi +else + # + # Old style bridge setup with netloop, used to have a bridge name + # of xenbrX, enslaving pethX and vif0.X, and then configuring + # eth0. + # + # New style bridge setup does not use netloop, so the bridge name + # is ethX and the physical device is enslaved pethX + # + # So if... + # + # - User asks for xenbrX + # - AND xenbrX doesn't exist + # - AND there is a ethX device which is a bridge + # + # ..then we translate xenbrX to ethX + # + # This lets old config files work without modification + # + if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ] + then + if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ] + then + bridge="eth${bridge#xenbr}" + fi + fi +fi + +RET=0 +ip link show $bridge 1>/dev/null 2>&1 || RET=1 +if [ "$RET" -eq 1 ] +then + fatal "Could not find bridge device $bridge" +fi + +case "$command" in + online) + setup_bridge_port "$vif" + add_to_bridge "$bridge" "$vif" + ;; + + offline) + do_without_error brctl delif "$bridge" "$vif" + do_without_error ifconfig "$vif" down + ;; +esac + +handle_iptable + +log debug "Successful vif-bridge $command for $vif, bridge $bridge." +if [ "$command" == "online" ] +then + success +fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vif-common.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vif-common.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,151 @@ +# +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + + +dir=$(dirname "$0") +. "$dir/xen-hotplug-common.sh" +. "$dir/xen-network-common.sh" + +findCommand "$@" + +if [ "$command" != "online" ] && + [ "$command" != "offline" ] && + [ "$command" != "add" ] && + [ "$command" != "remove" ] +then + log err "Invalid command: $command" + exit 1 +fi + +case "$command" in + add | remove) + exit 0 + ;; +esac + + +# Parameters may be read from the environment, the command line arguments, and +# the store, with overriding in that order. The environment is given by the +# driver, the command line is given by the Xend global configuration, and +# store details are given by the per-domain or per-device configuration. + +evalVariables "$@" + +ip=${ip:-} +ip=$(xenstore_read_default "$XENBUS_PATH/ip" "$ip") + +# Check presence of compulsory args. +XENBUS_PATH="${XENBUS_PATH:?}" +vif="${vif:?}" + + +vifname=$(xenstore_read_default "$XENBUS_PATH/vifname" "") +if [ "$vifname" ] +then + if [ "$command" == "online" ] && ! ip link show "$vifname" >&/dev/null + then + do_or_die ip link set "$vif" name "$vifname" + fi + vif="$vifname" +fi + + +frob_iptable() +{ + if [ "$command" == "online" ] + then + local c="-A" + else + local c="-D" + fi + + iptables "$c" FORWARD -m physdev --physdev-in "$vif" "$@" -j ACCEPT \ + 2>/dev/null || + [ "$c" == "-D" ] || + log err \ + "iptables $c FORWARD -m physdev --physdev-in $vif $@ -j ACCEPT failed. +If you are using iptables, this may affect networking for guest domains." +} + + +## +# Add or remove the appropriate entries in the iptables. With antispoofing +# turned on, we have to explicitly allow packets to the interface, regardless +# of the ip setting. If ip is set, then we additionally restrict the packets +# to those coming from the specified networks, though we allow DHCP requests +# as well. +# +handle_iptable() +{ + # Check for a working iptables installation. Checking for the iptables + # binary is not sufficient, because the user may not have the appropriate + # modules installed. If iptables is not working, then there's no need to do + # anything with it, so we can just return. + if ! iptables -L -n >&/dev/null + then + return + fi + + if [ "$ip" != "" ] + then + local addr + for addr in $ip + do + frob_iptable -s "$addr" + done + + # Always allow the domain to talk to a DHCP server. + frob_iptable -p udp --sport 68 --dport 67 + else + # No IP addresses have been specified, so allow anything. + frob_iptable + fi +} + + +## +# ip_of interface +# +# Print the IP address currently in use at the given interface, or nothing if +# the interface is not up. +# +ip_of() +{ + ip addr show "$1" | awk "/^.*inet.*$1\$/{print \$2}" | sed -n '1 s,/.*,,p' +} + + +## +# dom0_ip +# +# Print the IP address of the interface in dom0 through which we are routing. +# This is the IP address on the interface specified as "netdev" as a parameter +# to these scripts, or eth0 by default. This function will call fatal if no +# such interface could be found. +# +dom0_ip() +{ + local nd=${netdev:-eth0} + local result=$(ip_of "$nd") + if [ -z "$result" ] + then + fatal +"$netdev is not up. Bring it up or specify another interface with " \ +"netdev= as a parameter to $0." + fi + echo "$result" +} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vif-nat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vif-nat Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,192 @@ +#!/bin/bash +#============================================================================ +# /etc/xen/vif-nat +# +# Script for configuring a vif in routed-nat mode. +# The hotplugging system will call this script if it is specified either in +# the device configuration given to Xend, or the default Xend configuration +# in /etc/xen/xend-config.sxp. If the script is specified in neither of those +# places, then vif-bridge is the default. +# +# Usage: +# vif-nat (add|remove|online|offline) +# +# Environment vars: +# vif vif interface name (required). +# XENBUS_PATH path to this device's details in the XenStore (required). +# +# Parameters: +# dhcp Whether to alter the local DHCP configuration to include this +# new host (default no). +# +# Read from the store: +# ip list of IP networks for the vif, space-separated (default given in +# this script). +#============================================================================ + + +dir=$(dirname "$0") +. "$dir/vif-common.sh" + +# turn on dhcp feature by default if dhcpd is installed +if [ -f /etc/dhcpd.conf ] +then + dhcp=${dhcp:-yes} +else + dhcp=${dhcp:-no} +fi + +if [ "$dhcp" != 'no' ] +then + dhcpd_conf_file=$(find_dhcpd_conf_file) + dhcpd_init_file=$(find_dhcpd_init_file) + dhcpd_arg_file=$(find_dhcpd_arg_file) + if [ -z "$dhcpd_conf_file" ] || [ -z "$dhcpd_init_file" ] || [ -z "$dhcpd_arg_file" ] + then + echo 'Failed to find dhcpd configuration or init or args file.' >&2 + exit 1 + fi +fi + + +domid=$(xenstore_read "$XENBUS_PATH/frontend-id") +vifid=$(xenstore_read "$XENBUS_PATH/handle") +vifid=$(( $vifid + 1 )) + + +ip_from_dom() +{ + local domid1=$(( $domid / 256 )) + local domid2=$(( $domid % 256 )) + + echo "10.$domid1.$domid2.$vifid/16" +} + + +routing_ip() +{ + echo $(echo $1 | awk -F. '{print $1"."$2"."$3"."$4 + 127}') +} + + +dotted_quad() +{ + echo\ + $(( ($1 & 0xFF000000) >> 24))\ +.$(( ($1 & 0x00FF0000) >> 16))\ +.$(( ($1 & 0x0000FF00) >> 8 ))\ +.$(( $1 & 0x000000FF )) +} + + +if [ "$ip" = "" ] +then + ip=$(ip_from_dom) +fi + +router_ip=$(routing_ip "$ip") + +# Split the given IP/bits pair. +vif_ip=`echo ${ip} | awk -F/ '{print $1}'` + +hostname=$(xenstore_read "$XENBUS_PATH/domain" | tr -- '_.:/+' '-----') +if [ "$vifid" != "1" ] +then + hostname="$hostname-$vifid" +fi + +dhcparg_remove_entry() +{ + local tmpfile=$(mktemp) + sed -e "s/$vif //" "$dhcpd_arg_file" >"$tmpfile" + if diff "$tmpfile" "$dhcpd_arg_file" >/dev/null + then + rm "$tmpfile" + else + mv "$tmpfile" "$dhcpd_arg_file" + fi +} + +dhcparg_add_entry() +{ + dhcparg_remove_entry + local tmpfile=$(mktemp) + # handle Red Hat, SUSE, and Debian styles, with or without quotes + sed -e 's/^DHCPDARGS="*\([^"]*\)"*/DHCPDARGS="\1'"$vif "'"/' \ + "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file" + sed -e 's/^DHCPD_INTERFACE="*\([^"]*\)"*/DHCPD_INTERFACE="\1'"$vif "'"/' \ + "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file" + sed -e 's/^INTERFACES="*\([^"]*\)"*/INTERFACES="\1'"$vif "'"/' \ + "$dhcpd_arg_file" >"$tmpfile" && mv "$tmpfile" "$dhcpd_arg_file" + rm -f "$tmpfile" +} + +dhcp_remove_entry() +{ + local tmpfile=$(mktemp) + grep -v "host $hostname" "$dhcpd_conf_file" >"$tmpfile" + if diff "$tmpfile" "$dhcpd_conf_file" >/dev/null + then + rm "$tmpfile" + else + mv "$tmpfile" "$dhcpd_conf_file" + fi + dhcparg_remove_entry +} + + +dhcp_up() +{ + claim_lock "vif-nat-dhcp" + dhcp_remove_entry + mac=$(xenstore_read "$XENBUS_PATH/mac") + echo >>"$dhcpd_conf_file" \ +"host $hostname { hardware ethernet $mac; fixed-address $vif_ip; option routers $router_ip; option host-name \"$hostname\"; }" + dhcparg_add_entry + release_lock "vif-nat-dhcp" + "$dhcpd_init_file" restart || true +} + + +dhcp_down() +{ + claim_lock "vif-nat-dhcp" + dhcp_remove_entry + release_lock "vif-nat-dhcp" + "$dhcpd_init_file" restart || true # We need to ignore failure because + # ISC dhcpd 3 borks if there is nothing + # for it to do, which is the case if + # the outgoing interface is not + # configured to offer leases and there + # are no vifs. +} + + +case "$command" in + online) + if ip route | grep -q "dev $vif" + then + log debug "$vif already up" + exit 0 + fi + + do_or_die ip link set "$vif" up arp on + do_or_die ip addr add "$router_ip" dev "$vif" + do_or_die ip route add "$vif_ip" dev "$vif" src "$router_ip" + echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp + [ "$dhcp" != 'no' ] && dhcp_up + ;; + offline) + [ "$dhcp" != 'no' ] && dhcp_down + do_without_error ifconfig "$vif" down + ;; +esac + + +handle_iptable + +log debug "Successful vif-nat $command for $vif." +if [ "$command" = "online" ] +then + success +fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vif-route --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vif-route Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,56 @@ +#!/bin/bash +#============================================================================ +# /etc/xen/vif-route +# +# Script for configuring a vif in routed mode. +# The hotplugging system will call this script if it is specified either in +# the device configuration given to Xend, or the default Xend configuration +# in /etc/xen/xend-config.sxp. If the script is specified in neither of those +# places, then vif-bridge is the default. +# +# Usage: +# vif-route (add|remove|online|offline) +# +# Environment vars: +# vif vif interface name (required). +# XENBUS_PATH path to this device's details in the XenStore (required). +# +# Read from the store: +# ip list of IP networks for the vif, space-separated (default given in +# this script). +#============================================================================ + +dir=$(dirname "$0") +. "$dir/vif-common.sh" + +main_ip=$(dom0_ip) + +case "$command" in + online) + ifconfig ${vif} ${main_ip} netmask 255.255.255.255 up + echo 1 >/proc/sys/net/ipv4/conf/${vif}/proxy_arp + ipcmd='add' + cmdprefix='' + ;; + offline) + do_without_error ifdown ${vif} + ipcmd='del' + cmdprefix='do_without_error' + ;; +esac + +if [ "${ip}" ] ; then + # If we've been given a list of IP addresses, then add routes from dom0 to + # the guest using those addresses. + for addr in ${ip} ; do + ${cmdprefix} ip route ${ipcmd} ${addr} dev ${vif} src ${main_ip} + done +fi + +handle_iptable + +log debug "Successful vif-route $command for $vif." +if [ "$command" = "online" ] +then + success +fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vscsi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vscsi Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (c) 2007, FUJITSU Limited +# Based on the block scripts code. +# + +dir=$(dirname "$0") +. "$dir/xen-hotplug-common.sh" + +findCommand "$@" + +case "$command" in + add) + success + ;; + remove) + # TODO + exit 0 + ;; +esac + +exit 0 diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vtpm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vtpm Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,22 @@ +#!/bin/bash + +dir=$(dirname "$0") +. "$dir/vtpm-hotplug-common.sh" + +vtpm_fatal_error=0 + +case "$command" in + add) + vtpm_create_instance + ;; + remove) + vtpm_remove_instance + ;; +esac + +if [ $vtpm_fatal_error -eq 0 ]; then + log debug "Successful vTPM operation '$command'." + success +else + fatal "Error while executing vTPM operation '$command'." +fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vtpm-common.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vtpm-common.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,448 @@ +# +# Copyright (c) 2005 IBM Corporation +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +dir=$(dirname "$0") +. "$dir/logging.sh" +. "$dir/locking.sh" + +VTPMDB="/var/vtpm/vtpm.db" + +#In the vtpm-impl file some commands should be defined: +# vtpm_create, vtpm_setup, vtpm_start, etc. (see below) +if [ -r "$dir/vtpm-impl.alt" ]; then + . "$dir/vtpm-impl.alt" +elif [ -r "$dir/vtpm-impl" ]; then + . "$dir/vtpm-impl" +else + function vtpm_create () { + true + } + function vtpm_setup() { + true + } + function vtpm_start() { + true + } + function vtpm_suspend() { + true + } + function vtpm_resume() { + true + } + function vtpm_delete() { + true + } + function vtpm_migrate() { + echo "Error: vTPM migration accross machines not implemented." + } + function vtpm_migrate_local() { + echo "Error: local vTPM migration not supported" + } + function vtpm_migrate_recover() { + true + } +fi + + +#Find the instance number for the vtpm given the name of the domain +# Parameters +# - vmname : the name of the vm +# Return value +# Returns '0' if instance number could not be found, otherwise +# it returns the instance number in the variable 'instance' +function vtpmdb_find_instance () { + local vmname ret instance + vmname=$1 + ret=0 + + instance=$(cat $VTPMDB | \ + awk -vvmname=$vmname \ + '{ \ + if ( 1 != index($1,"#")) { \ + if ( $1 == vmname ) { \ + print $2; \ + exit; \ + } \ + } \ + }') + if [ "$instance" != "" ]; then + ret=$instance + fi + echo "$ret" +} + + +# Check whether a particular instance number is still available +# returns "0" if it is not available, "1" otherwise. +function vtpmdb_is_free_instancenum () { + local instance instances avail i + instance=$1 + avail=1 + #Allowed instance number range: 1-255 + if [ $instance -eq 0 -o $instance -gt 255 ]; then + avail=0 + else + instances=$(cat $VTPMDB | \ + gawk \ + '{ \ + if (1 != index($1,"#")) { \ + printf("%s ",$2); \ + } \ + }') + for i in $instances; do + if [ $i -eq $instance ]; then + avail=0 + break + fi + done + fi + echo "$avail" +} + + +# Get an available instance number given the database +# Returns an unused instance number +function vtpmdb_get_free_instancenum () { + local ctr instances don found + instances=$(cat $VTPMDB | \ + gawk \ + '{ \ + if (1 != index($1,"#")) { \ + printf("%s ",$2); \ + } \ + }') + ctr=1 + don=0 + while [ $don -eq 0 ]; do + found=0 + for i in $instances; do + if [ $i -eq $ctr ]; then + found=1; + break; + fi + done + + if [ $found -eq 0 ]; then + don=1 + break + fi + let ctr=ctr+1 + done + echo "$ctr" +} + + +# Add a domain name and instance number to the DB file +function vtpmdb_add_instance () { + local res vmname inst + vmname=$1 + inst=$2 + + if [ ! -f $VTPMDB ]; then + echo "#Database for VM to vTPM association" > $VTPMDB + echo "#1st column: domain name" >> $VTPMDB + echo "#2nd column: TPM instance number" >> $VTPMDB + fi + res=$(vtpmdb_validate_entry $vmname $inst) + if [ $res -eq 0 ]; then + echo "$vmname $inst" >> $VTPMDB + fi +} + + +#Validate whether an entry is the same as passed to this +#function +function vtpmdb_validate_entry () { + local res rc vmname inst + rc=0 + vmname=$1 + inst=$2 + + res=$(cat $VTPMDB | \ + gawk -vvmname=$vmname \ + -vinst=$inst \ + '{ \ + if ( 1 == index($1,"#")) {\ + } else \ + if ( $1 == vmname && \ + $2 == inst) { \ + printf("1"); \ + exit; \ + } else \ + if ( $1 == vmname || \ + $2 == inst) { \ + printf("2"); \ + exit; \ + } \ + }') + + if [ "$res" == "1" ]; then + rc=1 + elif [ "$res" == "2" ]; then + rc=2 + fi + echo "$rc" +} + + +#Remove an entry from the vTPM database given its domain name +#and instance number +function vtpmdb_remove_entry () { + local vmname instance VTPMDB_TMP + vmname=$1 + instance=$2 + VTPMDB_TMP="$VTPMDB".tmp + + $(cat $VTPMDB | \ + gawk -vvmname=$vmname \ + '{ \ + if ( $1 != vmname ) { \ + print $0; \ + } \ + '} > $VTPMDB_TMP) + if [ -e $VTPMDB_TMP ]; then + mv -f $VTPMDB_TMP $VTPMDB + vtpm_delete $instance + else + log err "Error creating temporary file '$VTPMDB_TMP'." + fi +} + + +# Find the reason for the creation of this device: +# Returns 'resume' or 'create' +function vtpm_get_create_reason () { + local resume + resume=$(xenstore_read $XENBUS_PATH/resume) + if [ "$resume" == "True" ]; then + echo "resume" + else + echo "create" + fi +} + + +#Create a vTPM instance +# If no entry in the TPM database is found, the instance is +# created and an entry added to the database. +function vtpm_create_instance () { + local res instance domname reason uuid + uuid=$(xenstore_read "$XENBUS_PATH"/uuid) + reason=$(vtpm_get_create_reason) + + claim_lock vtpmdb + + instance="0" + + if [ "$uuid" != "" ]; then + instance=$(vtpmdb_find_instance $uuid) + fi + if [ "$instance" == "0" ]; then + domname=$(xenstore_read "$XENBUS_PATH"/domain) + instance=$(vtpmdb_find_instance $domname) + fi + + if [ "$instance" == "0" -a "$reason" != "create" ]; then + release_lock vtpmdb + return + fi + + if [ "$instance" == "0" ]; then + #Try to give the preferred instance to the domain + instance=$(xenstore_read "$XENBUS_PATH"/pref_instance) + if [ "$instance" != "" ]; then + res=$(vtpmdb_is_free_instancenum $instance) + if [ $res -eq 0 ]; then + instance=$(vtpmdb_get_free_instancenum) + fi + else + instance=$(vtpmdb_get_free_instancenum) + fi + + vtpm_create $instance + + if [ $vtpm_fatal_error -eq 0 ]; then + if [ "$uuid" != "" ]; then + vtpmdb_add_instance $uuid $instance + else + vtpmdb_add_instance $domname $instance + fi + fi + else + if [ "$reason" == "resume" ]; then + vtpm_resume $instance + else + vtpm_start $instance + fi + fi + + release_lock vtpmdb + + xenstore_write $XENBUS_PATH/instance $instance +} + + +#Remove an instance when a VM is terminating or suspending. +#Since it is assumed that the VM will appear again, the +#entry is kept in the VTPMDB file. +function vtpm_remove_instance () { + local instance reason domname uuid + #Stop script execution quietly if path does not exist (anymore) + xenstore-exists "$XENBUS_PATH"/domain + uuid=$(xenstore_read "$XENBUS_PATH"/uuid) + + claim_lock vtpmdb + + instance="0" + + if [ "$uuid" != "" ]; then + instance=$(vtpmdb_find_instance $uuid) + fi + + if [ "$instance" == "0" ]; then + domname=$(xenstore_read "$XENBUS_PATH"/domain) + instance=$(vtpmdb_find_instance $domname) + fi + + if [ "$instance" != "0" ]; then + vtpm_suspend $instance + fi + + release_lock vtpmdb +} + + +#Remove an entry in the VTPMDB file given the domain's name +#1st parameter: The name of the domain +function vtpm_delete_instance () { + local instance + + claim_lock vtpmdb + + instance=$(vtpmdb_find_instance $1) + if [ "$instance" != "0" ]; then + vtpmdb_remove_entry $1 $instance + fi + + release_lock vtpmdb +} + +# Determine whether the given address is local to this machine +# Return values: +# "-1" : the given machine name is invalid +# "0" : this is not an address of this machine +# "1" : this is an address local to this machine +function vtpm_isLocalAddress() { + local addr res + addr=$(ping $1 -c 1 | \ + gawk '{ print substr($3,2,length($3)-2); exit }') + if [ "$addr" == "" ]; then + echo "-1" + return + fi + res=$(ifconfig | grep "inet addr" | \ + gawk -vaddr=$addr \ + '{ \ + if ( addr == substr($2, 6)) {\ + print "1"; \ + } \ + }' \ + ) + if [ "$res" == "" ]; then + echo "0" + return + fi + echo "1" +} + +# Perform a migration step. This function differentiates between migration +# to the local host or to a remote machine. +# Parameters: +# 1st: destination host to migrate to +# 2nd: name of the domain to migrate +# 3rd: the migration step to perform +function vtpm_migration_step() { + local res=$(vtpm_isLocalAddress $1) + if [ "$res" == "0" ]; then + vtpm_migrate $1 $2 $3 + else + vtpm_migrate_local + fi +} + +# Recover from migration due to an error. This function differentiates +# between migration to the local host or to a remote machine. +# Parameters: +# 1st: destination host the migration was going to +# 2nd: name of the domain that was to be migrated +# 3rd: the last successful migration step that was done +function vtpm_recover() { + local res + res=$(vtpm_isLocalAddress $1) + if [ "$res" == "0" ]; then + vtpm_migrate_recover $1 $2 $3 + fi +} + + +#Determine the domain id given a domain's name. +#1st parameter: name of the domain +#return value: domain id or -1 if domain id could not be determined +function vtpm_domid_from_name () { + local id name ids + ids=$(xenstore-list /local/domain) + for id in $ids; do + name=$(xenstore-read /local/domain/$id/name) + if [ "$name" == "$1" ]; then + echo "$id" + return + fi + done + echo "-1" +} + +#Determine the virtual TPM's instance number using the domain ID. +#1st parm: domain ID +function vtpm_uuid_by_domid() { + echo $(xenstore-read /local/domain/0/backend/vtpm/$1/0/uuid) +} + + +# Determine the vTPM's UUID by the name of the VM +function vtpm_uuid_from_vmname() { + local domid=$(vtpm_domid_from_name $1) + if [ "$domid" != "-1" ]; then + echo $(vtpm_uuid_by_domid $domid) + return + fi + echo "" +} + +#Add a virtual TPM instance number and its associated domain name +#to the VTPMDB file and activate usage of this virtual TPM instance +#by writing the instance number into the xenstore +#1st parm: name of virtual machine +#2nd parm: instance of associated virtual TPM +function vtpm_add_and_activate() { + local domid=$(vtpm_domid_from_name $1) + local vtpm_uuid=$(vtpm_uuid_from_vmname $1) + if [ "$vtpm_uuid" != "" -a "$domid" != "-1" ]; then + vtpmdb_add_instance $vtpm_uuid $2 + xenstore-write backend/vtpm/$domid/0/instance $2 + fi +} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vtpm-delete --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vtpm-delete Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,18 @@ +#!/bin/bash + +# This scripts must be called the following way: +# vtpm-delete +# or +# vtpm-delete --vmname + +dir=$(dirname "$0") +. "$dir/vtpm-common.sh" + +if [ "$1" == "--vmname" ]; then + vtpm_uuid=$(vtpm_uuid_from_vmname $2) + if [ "$vtpm_uuid" != "" ];then + vtpm_delete_instance $vtpm_uuid + fi +else + vtpm_delete_instance $1 +fi diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vtpm-hotplug-common.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vtpm-hotplug-common.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,35 @@ +# +# Copyright (c) 2005 IBM Corporation +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +dir=$(dirname "$0") +. "$dir/xen-hotplug-common.sh" + +findCommand "$@" +if [ "$command" != "online" ] && + [ "$command" != "offline" ] && + [ "$command" != "add" ] && + [ "$command" != "remove" ] +then + log err "Invalid command: $command" + exit 1 +fi + + +XENBUS_PATH="${XENBUS_PATH:?}" + +. "$dir/vtpm-common.sh" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vtpm-impl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vtpm-impl Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,208 @@ +#!/bin/bash +# =================================================================== +# +# Copyright (c) 2005, Intel Corp. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +# =================================================================== + +# | SRC | TAG | CMD SIZE | ORD |mtype|strt +TPM_CMD_OPEN=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x01 +TPM_CMD_RESM=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x11\\x01\\x00\\x00\\x01\\x01\\x02 +TPM_CMD_CLOS=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x02 +TPM_CMD_DELE=\\x00\\x00\\x00\\x00\\x01\\xc1\\x00\\x00\\x00\\x0e\\x01\\x00\\x00\\x03 + +TPM_TYPE_PVM=\\x01 +TPM_TYPE_HVM=\\x02 + +TPM_SUCCESS=00000000 + +TX_VTPM_MANAGER=/var/vtpm/fifos/from_console.fifo +RX_VTPM_MANAGER=/var/vtpm/fifos/to_console.fifo + +VTPM_MIG=/usr/bin/vtpm_migrator + +# -------------------- Helpers for binary streams ----------- + +function str_to_hex32() { + printf "%0.8x" $1 +} + +function hex32_to_bin() { + local inst=$(str_to_hex32 $1); + + local n1=`echo $inst | sed 's/\(..\)....../\\\\x\1/'` + local n2=`echo $inst | sed 's/..\(..\)..../\\\\x\1/'` + local n3=`echo $inst | sed 's/....\(..\)../\\\\x\1/'` + local n4=`echo $inst | sed 's/......\(..\)/\\\\x\1/'` + + echo "$n1$n2$n3$n4" +} + +function vtpm_manager_cmd() { + local cmd=$1; + local inst=$2; + local inst_bin=$(hex32_to_bin $inst); + + claim_lock vtpm_mgr + + #send cmd to vtpm_manager + printf "$cmd$inst_bin" > $TX_VTPM_MANAGER + + #recv response + set +e + local resp_hex=`dd skip=10 bs=1 count=4 if=$RX_VTPM_MANAGER 2> /dev/null | xxd -ps` + set -e + + release_lock vtpm_mgr + + #return whether the command was successful + if [ $resp_hex -ne $TPM_SUCCESS ]; then + vtpm_fatal_error=1 + false + else + true + fi +} + +# Helper to get vm type to pass to vtpm_manager open/resume +function vtpm_get_type() { + local inst=$(xenstore_read $XENBUS_PATH/frontend-id) + local vm=$(xenstore_read /local/domain/$inst/vm) + if [ "$vm" != "" ]; then + local ostype=$(xenstore-read $vm/image/ostype) + if [ "$ostype" == "hvm" ]; then + echo $TPM_TYPE_HVM; + else + echo $TPM_TYPE_PVM; + fi + fi +} + +# ------------------ Command handlers ----------------- + +# Create new vtpm instance & set it up for use +function vtpm_create () { + # Creation is handled implicitly by the manager on first setup + # so just set it up for use + $(vtpm_start $1) +} + +# Setup vtpm instance for use. +function vtpm_start() { + local vmtype=$(vtpm_get_type); + $(vtpm_manager_cmd $TPM_CMD_OPEN$vmtype $1) +} + +function vtpm_resume() { + local vmtype=$(vtpm_get_type); + $(vtpm_manager_cmd $TPM_CMD_RESM$vmtype $1) +} + +# Reset the vtpm AKA clear PCRs +function vtpm_reset() { + #not used by current implemenation + true +} + +# Shutdown the vtpm while the vm is down +# This could be a suspend of shutdown +# we cannot distinquish, so save the state +# and decide on startup if we should keep is +function vtpm_suspend() { + $(vtpm_manager_cmd $TPM_CMD_CLOS $1) +} + + +function vtpm_delete() { + local inst=$1 + if $(vtpm_manager_cmd $TPM_CMD_DELE $inst); then + rm -f /var/vtpm/vtpm_dm_$1.data + true + else + vtpm_fatal_error=1 + false + fi +} + +# Perform a migration step. This function differentiates between migration +# to the local host or to a remote machine. +# Parameters: +# 1st: destination host to migrate to +# 2nd: name of the domain to migrate +# 3rd: the migration step to perform +function vtpm_migrate() { + local instance res + + instance=$(vtpmdb_find_instance $2) + if [ "$instance" == "" ]; then + log err "VTPM Migratoin failed. Unable to translation of domain name" + echo "Error: VTPM Migration failed while looking up instance number" + fi + + case "$3" in + 0) + #Incicate migration supported + echo "0" + ;; + + 1) + # Get Public Key from Destination + # Call vtpm_manager's migration part 1 + claim_lock vtpm_mgr + $VTPM_MIG $1 $2 $instance $3 + release_lock vtpm_mgr + ;; + + 2) + # Call manager's migration step 2 and send result to destination + # If successful remove from db + claim_lock vtpm_mgr + $VTPM_MIG $1 $2 $instance $3 + release_lock vtpm_mgr + ;; + + 3) + if `ps x | grep "$VTPM_MIG $1"`; then + log err "VTPM Migration failed to complete." + echo "Error: VTPM Migration failed to complete." + fi + ;; + esac + +} + + +function vtpm_migrate_recover() { + echo "Error: Recovery not supported yet" +} + +function vtpm_migrate_local() { + echo "Error: local vTPM migration not supported" +} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/vtpm-migration.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/vtpm-migration.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,19 @@ +# +# Copyright (c) 2005 IBM Corporation +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +dir=$(dirname "$0") +. "$dir/vtpm-common.sh" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/xen-backend.agent --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/xen-backend.agent Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,39 @@ +#! /bin/bash + +PATH=/etc/xen/scripts:$PATH + +. /etc/xen/scripts/locking.sh + +claim_lock xenbus_hotplug_global + +case "$XENBUS_TYPE" in + tap) + /etc/xen/scripts/blktap "$ACTION" + ;; + vbd) + /etc/xen/scripts/block "$ACTION" + ;; + vtpm) + /etc/xen/scripts/vtpm "$ACTION" + ;; + vif) + [ -n "$script" ] && $script "$ACTION" + ;; + vscsi) + /etc/xen/scripts/vscsi "$ACTION" + ;; +esac + +case "$ACTION" in + add) + ;; + remove) + /etc/xen/scripts/xen-hotplug-cleanup + ;; + online) + ;; + offline) + ;; +esac + +release_lock xenbus_hotplug_global diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/xen-backend.rules --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/xen-backend.rules Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,9 @@ +SUBSYSTEM=="xen-backend", KERNEL=="tap*", RUN+="/etc/xen/scripts/blktap $env{ACTION}" +SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block $env{ACTION}" +SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}" +SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="online", RUN+="$env{script} online" +SUBSYSTEM=="xen-backend", KERNEL=="vif*", ACTION=="offline", RUN+="$env{script} offline" +SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}" +SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup" +KERNEL=="evtchn", NAME="xen/%k" +KERNEL=="blktap[0-9]*", NAME="xen/%k" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/xen-hotplug-cleanup --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/xen-hotplug-cleanup Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,22 @@ +#! /bin/bash + +dir=$(dirname "$0") +. "$dir/xen-hotplug-common.sh" + +# Claim the lock protecting /etc/xen/scripts/block. This stops a race whereby +# paths in the store would disappear underneath that script as it attempted to +# read from the store checking for device sharing. +# Any other scripts that do similar things will have to have their lock +# claimed too. +# This is pretty horrible, but there's not really a nicer way of solving this. +claim_lock "block" + +# remove device frontend store entries +xenstore-rm -t \ + $(xenstore-read "$XENBUS_PATH/frontend" 2>/dev/null) 2>/dev/null || true + +# remove device backend store entries +xenstore-rm -t "$XENBUS_PATH" 2>/dev/null || true +xenstore-rm -t "error/$XENBUS_PATH" 2>/dev/null || true + +release_lock "block" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/xen-hotplug-common.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/xen-hotplug-common.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,93 @@ +# +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + + +dir=$(dirname "$0") +. "$dir/logging.sh" +. "$dir/xen-script-common.sh" +. "$dir/locking.sh" + +exec 2>>/var/log/xen/xen-hotplug.log + +export PATH="/sbin:/bin:/usr/bin:/usr/sbin:$PATH" +export LANG="POSIX" +unset $(set | grep ^LC_ | cut -d= -f1) + +fatal() { + xenstore_write "$XENBUS_PATH/hotplug-error" "$*" \ + "$XENBUS_PATH/hotplug-status" error + log err "$@" + exit 1 +} + +success() { + # Tell DevController that backend is "connected" + xenstore_write "$XENBUS_PATH/hotplug-status" connected +} + +do_or_die() { + "$@" || fatal "$@ failed" +} + +do_without_error() { + "$@" 2>/dev/null || log debug "$@ failed" +} + +sigerr() { + fatal "$0 failed; error detected." +} + +trap sigerr ERR + + +## +# xenstore_read + +# +# Read each of the given paths, returning each result on a separate line, or +# exit this script if any of the paths is missing. +# +xenstore_read() { + local v=$(xenstore-read "$@" || true) + [ "$v" != "" ] || fatal "xenstore-read $@ failed." + echo "$v" +} + + +## +# xenstore_read_default +# +# Read the given path, returning the value there or the given default if the +# path is not present. +# +xenstore_read_default() { + xenstore-read "$1" 2>/dev/null || echo "$2" +} + + +## +# xenstore_write ( )+ +# +# Write each of the key/value pairs to the store, and exit this script if any +# such writing fails. +# +xenstore_write() { + log debug "Writing $@ to xenstore." + xenstore-write "$@" || fatal "Writing $@ to xenstore failed." +} + + +log debug "$@" "XENBUS_PATH=$XENBUS_PATH" diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/xen-network-common.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/xen-network-common.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,118 @@ +# +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + + +# Gentoo doesn't have ifup/ifdown, so we define appropriate alternatives. + +# Other platforms just use ifup / ifdown directly. + +## +# preiftransfer +# +# @param $1 The current name for the physical device, which is also the name +# that the virtual device will take once the physical device has +# been renamed. + +if ! which ifup >/dev/null 2>/dev/null +then + preiftransfer() + { + true + } + ifup() + { + false + } + ifdown() + { + false + } +else + preiftransfer() + { + true + } +fi + + +first_file() +{ + t="$1" + shift + for file in $@ + do + if [ "$t" "$file" ] + then + echo "$file" + return + fi + done +} + +find_dhcpd_conf_file() +{ + first_file -f /etc/dhcp3/dhcpd.conf /etc/dhcpd.conf +} + + +find_dhcpd_init_file() +{ + first_file -x /etc/init.d/{dhcp3-server,dhcp,dhcpd} +} + +find_dhcpd_arg_file() +{ + first_file -f /etc/sysconfig/dhcpd /etc/defaults/dhcp /etc/default/dhcp3-server +} + +# configure interfaces which act as pure bridge ports: +setup_bridge_port() { + local dev="$1" + + # take interface down ... + ip link set ${dev} down + + # ... and configure it + ip addr flush ${dev} +} + +# Usage: create_bridge bridge +create_bridge () { + local bridge=$1 + + # Don't create the bridge if it already exists. + if [ ! -e "/sys/class/net/${bridge}/bridge" ]; then + brctl addbr ${bridge} + brctl stp ${bridge} off + brctl setfd ${bridge} 0 + fi +} + +# Usage: add_to_bridge bridge dev +add_to_bridge () { + local bridge=$1 + local dev=$2 + + # Don't add $dev to $bridge if it's already on a bridge. + if [ -e "/sys/class/net/${bridge}/brif/${dev}" ]; then + ip link set ${dev} up || true + return + fi + brctl addif ${bridge} ${dev} + ip link set ${dev} up +} + diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Linux/xen-script-common.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Linux/xen-script-common.sh Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,44 @@ +# +# Copyright (c) 2005 XenSource Ltd. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + + +set -e + + +evalVariables() +{ + for arg in "$@" + do + if expr 'index' "$arg" '=' '>' '1' >/dev/null + then + eval "$arg" + fi + done +} + + +findCommand() +{ + for arg in "$@" + do + if ! expr 'index' "$arg" '=' >/dev/null + then + command="$arg" + return + fi + done +} diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/Makefile Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,9 @@ +XEN_ROOT = ../../ +include $(XEN_ROOT)/tools/Rules.mk + +SUBDIRS-y := common +SUBDIRS-$(CONFIG_NetBSD) += NetBSD +SUBDIRS-$(CONFIG_Linux) += Linux + +.PHONY: all clean install +all clean install: %: subdirs-% diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/NetBSD/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/NetBSD/Makefile Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,41 @@ +XEN_ROOT = ../../../ +include $(XEN_ROOT)/tools/Rules.mk + +# Xen configuration dir and configs to go there. +XEN_CONFIG_DIR = $(PREFIX)/etc/xen + +# Xen script dir and scripts to go there. +XEN_SCRIPT_DIR = $(PREFIX)/etc/xen/scripts +XEN_SCRIPTS = +XEN_SCRIPTS += block-nbsd +XEN_SCRIPTS += hvm-nbsd +XEN_SCRIPTS += netbsd1-nbsd +XEN_SCRIPTS += qemu-ifup-nbsd +XEN_SCRIPTS += vif-bridge-nbsd +XEN_SCRIPTS += vif-ip-nbsd + +XEN_SCRIPT_DATA = + +.PHONY: all +all: + +.PHONY: build +build: + +.PHONY: install +install: all install-scripts + +.PHONY: install-scripts +install-scripts: + $(INSTALL_DATA_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) + set -e; for i in $(XEN_SCRIPTS); \ + do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + done + set -e; for i in $(XEN_SCRIPT_DATA); \ + do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + done + +.PHONY: clean +clean: diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/NetBSD/block-nbsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/NetBSD/block-nbsd Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,88 @@ +#!/bin/sh -e + +# $NetBSD: block-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $ +# Called by xenbackendd +# Usage: block xsdir_backend_path state + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +export PATH + +error() { + echo "$@" >&2 + xenstore_write $xpath/hotplug-status error + exit 1 +} + + +xpath=$1 +xstatus=$2 +xtype=$(xenstore-read "$xpath/type") +xparams=$(xenstore-read "$xpath/params") + +case $xstatus in +6) + # device removed + case $xtype in + file) + vnd=$(xenstore-read "$xpath/vnd" || echo none) + if [ $vnd != none ]; then + vnconfig -u $vnd + fi + ;; + phy) + ;; + *) + echo "unknown type $xtype" >&2 + ;; + esac + xenstore-rm $xpath + exit 0 + ;; +2) + case $xtype in + file) + # Store the list of available vnd(4) devices in + #``available_disks'', and mark them as ``free''. + list=`ls -1 /dev/vnd[0-9]*d | sed "s,/dev/vnd,,;s,d,," | sort -n` + for i in $list; do + disk="vnd$i" + available_disks="$available_disks $disk" + eval $disk=free + done + # Mark the used vnd(4) devices as ``used''. + for disk in `sysctl hw.disknames`; do + case $disk in + vnd[0-9]*) eval $disk=used ;; + esac + done + # Configure the first free vnd(4) device. + for disk in $available_disks; do + eval status=\$$disk + if [ "$status" = "free" ] && \ + vnconfig /dev/${disk}d $xparams >/dev/null; then + device=/dev/${disk}d + echo vnconfig /dev/${disk}d $xparams + break + fi + done + if [ x$device = x ] ; then + error "no available vnd device" + fi + echo xenstore-write $xpath/vnd $device + xenstore-write $xpath/vnd $device + ;; + phy) + device=$xparams + ;; + esac + physical_device=$(stat -f '%r' "$device") + echo xenstore-write $xpath/physical-device $physical_device + xenstore-write $xpath/physical-device $physical_device + echo xenstore-write $xpath/hotplug-status connected + xenstore-write $xpath/hotplug-status connected + exit 0 + ;; +*) + exit 0 + ;; +esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/NetBSD/qemu-ifup-nbsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/NetBSD/qemu-ifup-nbsd Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,3 @@ +#!/bin/sh +ifconfig $1 up +exec /sbin/brconfig $2 add $1 diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/NetBSD/vif-bridge-nbsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/NetBSD/vif-bridge-nbsd Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,35 @@ +#!/bin/sh -e + +# $NetBSD: vif-bridge-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $ +# Called by xenbackendd +# Usage: vif-bridge xsdir_backend_path state + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +export PATH + +xpath=$1 +xstatus=$2 + +case $xstatus in +6) + # device removed + xenstore-rm $xpath + exit 0 + ;; +2) + xbridge=$(xenstore-read "$xpath/bridge") + xfid=$(xenstore-read "$xpath/frontend-id") + xhandle=$(xenstore-read "$xpath/handle") + iface=xvif$xfid.$xhandle + echo ifconfig $iface up + ifconfig $iface up + brconfig $xbridge add $iface + echo brconfig $xbridge add $iface + xenstore-write $xpath/hotplug-status connected + echo xenstore-write $xpath/hotplug-status connected + exit 0 + ;; +*) + exit 0 + ;; +esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/NetBSD/vif-ip-nbsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/NetBSD/vif-ip-nbsd Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,33 @@ +#!/bin/sh -e + +# $NetBSD: vif-ip-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $ +# Called by xenbackendd +# Usage: vif-ip xsdir_backend_path state + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +export PATH + +xpath=$1 +xstatus=$2 + +case $xstatus in +6) + # device removed + xenstore-rm $xpath + exit 0 + ;; +2) + xip=$(xenstore-read "$xpath/ip") + xfid=$(xenstore-read "$xpath/frontend-id") + xhandle=$(xenstore-read "$xpath/handle") + iface=xvif$xfid.$xhandle + echo ifconfig $iface $xip up + ifconfig $iface $xip up + xenstore-write $xpath/hotplug-status connected + echo xenstore-write $xpath/hotplug-status connected + exit 0 + ;; +*) + exit 0 + ;; +esac diff -r 6bd021d987d7 -r 4bfc67b09e9c tools/hotplug/common/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/hotplug/common/Makefile Tue Nov 04 12:13:42 2008 +0000 @@ -0,0 +1,37 @@ +XEN_ROOT = ../../../ +include $(XEN_ROOT)/tools/Rules.mk + +# OS-independent hotplug scripts go in this directory + +# Xen configuration dir and configs to go there. +XEN_CONFIG_DIR = /etc/xen + +# Xen script dir and scripts to go there. +XEN_SCRIPT_DIR = /etc/xen/scripts +XEN_SCRIPTS = +XEN_SCRIPT_DATA = + +.PHONY: all +all: + +.PHONY: build +build: + +.PHONY: install +install: all install-scripts + +.PHONY: install-scripts +install-scripts: + [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \ + $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) + set -e; for i in $(XEN_SCRIPTS); \ + do \ + $(INSTALL_PROG) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + done + set -e; for i in $(XEN_SCRIPT_DATA); \ + do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(XEN_SCRIPT_DIR); \ + done + +.PHONY: clean +clean: _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:47 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:47 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjw6-0003cG-PV; Wed, 05 Nov 2008 07:04:46 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsF-0001Ds-Rv for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:47 -0800 X-ASG-Debug-ID: 1225897244-688100030001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 565A2DCA8D for ; Wed, 5 Nov 2008 07:00:45 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id UM4e8q4iUcPd653s for ; Wed, 05 Nov 2008 07:00:45 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563430 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563430" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:44 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0itj004539 for ; Wed, 5 Nov 2008 07:00:44 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F17x9016428 for ; Wed, 5 Nov 2008 07:01:07 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F17d5016427 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:07 -0800 Message-Id: <200811051501.mA5F17d5016427@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:01:07 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] linux: prevent invalid or unsupportable PIRQs from being used X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897246 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] linux: prevent invalid or unsupportable PIRQs from being used X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225896334 0 # Node ID 509d67fe5120bf8ff19e1b2df21a4c5472292db2 # Parent be9555ea5512d801a50f075037806a37ce17c209 linux: prevent invalid or unsupportable PIRQs from being used By keeping the respective irq_desc[] entries pointing to no_irq_type, setup_irq() (and thus request_irq()) will fail for such IRQs. This matches native behavior, which also only installs ioapic_*_type out of ioapic_register_intr(). At the same time, make assign_irq_vector() fail not only when Xen doesn't support the PIRQ, but also if the IRQ requested doesn't fall in the kernel's PIRQ space. Signed-off-by: Jan Beulich --- arch/i386/kernel/io_apic-xen.c | 3 arch/x86_64/kernel/io_apic-xen.c | 3 drivers/xen/core/evtchn.c | 583 +++++++++++++++++++-------------------- 3 files changed, 296 insertions(+), 293 deletions(-) diff -r be9555ea5512 -r 509d67fe5120 arch/i386/kernel/io_apic-xen.c --- a/arch/i386/kernel/io_apic-xen.c Wed Nov 05 14:08:37 2008 +0000 +++ b/arch/i386/kernel/io_apic-xen.c Wed Nov 05 14:45:34 2008 +0000 @@ -1216,6 +1216,9 @@ int assign_irq_vector(int irq) BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); + if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS) + return -EINVAL; + spin_lock_irqsave(&vector_lock, flags); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { diff -r be9555ea5512 -r 509d67fe5120 arch/x86_64/kernel/io_apic-xen.c --- a/arch/x86_64/kernel/io_apic-xen.c Wed Nov 05 14:08:37 2008 +0000 +++ b/arch/x86_64/kernel/io_apic-xen.c Wed Nov 05 14:45:34 2008 +0000 @@ -895,6 +895,9 @@ int assign_irq_vector(int irq) BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); + if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS) + return -EINVAL; + spin_lock_irqsave(&vector_lock, flags); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { diff -r be9555ea5512 -r 509d67fe5120 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Wed Nov 05 14:08:37 2008 +0000 +++ b/drivers/xen/core/evtchn.c Wed Nov 05 14:45:34 2008 +0000 @@ -756,18 +756,281 @@ static struct hw_interrupt_type dynirq_t .retrigger = resend_irq_on_evtchn, }; -void evtchn_register_pirq(int irq) -{ - struct irq_desc *desc; - unsigned long flags; - - irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0); - - /* Cannot call set_irq_probe(), as that's marked __init. */ - desc = irq_desc + irq; - spin_lock_irqsave(&desc->lock, flags); - desc->status &= ~IRQ_NOPROBE; - spin_unlock_irqrestore(&desc->lock, flags); +static inline void pirq_unmask_notify(int irq) +{ + struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; + if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) + VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); +} + +static inline void pirq_query_unmask(int irq) +{ + struct physdev_irq_status_query irq_status; + irq_status.irq = evtchn_get_xen_pirq(irq); + if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) + irq_status.flags = 0; + clear_bit(irq - PIRQ_BASE, pirq_needs_eoi); + if (irq_status.flags & XENIRQSTAT_needs_eoi) + set_bit(irq - PIRQ_BASE, pirq_needs_eoi); +} + +/* + * On startup, if there is no action associated with the IRQ then we are + * probing. In this case we should not share with others as it will confuse us. + */ +#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL) + +static unsigned int startup_pirq(unsigned int irq) +{ + struct evtchn_bind_pirq bind_pirq; + int evtchn = evtchn_from_irq(irq); + + if (VALID_EVTCHN(evtchn)) + goto out; + + bind_pirq.pirq = evtchn_get_xen_pirq(irq); + /* NB. We are happy to share unless we are probing. */ + bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { + if (!probing_irq(irq)) + printk(KERN_INFO "Failed to obtain physical IRQ %d\n", + irq); + return 0; + } + evtchn = bind_pirq.port; + + pirq_query_unmask(irq); + + evtchn_to_irq[evtchn] = irq; + bind_evtchn_to_cpu(evtchn, 0); + irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); + + out: + unmask_evtchn(evtchn); + pirq_unmask_notify(irq); + + return 0; +} + +static void shutdown_pirq(unsigned int irq) +{ + struct evtchn_close close; + int evtchn = evtchn_from_irq(irq); + + if (!VALID_EVTCHN(evtchn)) + return; + + mask_evtchn(evtchn); + + close.port = evtchn; + if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) + BUG(); + + bind_evtchn_to_cpu(evtchn, 0); + evtchn_to_irq[evtchn] = -1; + irq_info[irq] = mk_irq_info(IRQT_PIRQ, index_from_irq(irq), 0); +} + +static void enable_pirq(unsigned int irq) +{ + startup_pirq(irq); +} + +static void disable_pirq(unsigned int irq) +{ +} + +static void ack_pirq(unsigned int irq) +{ + int evtchn = evtchn_from_irq(irq); + + move_native_irq(irq); + + if (VALID_EVTCHN(evtchn)) { + mask_evtchn(evtchn); + clear_evtchn(evtchn); + } +} + +static void end_pirq(unsigned int irq) +{ + int evtchn = evtchn_from_irq(irq); + + if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == + (IRQ_DISABLED|IRQ_PENDING)) { + shutdown_pirq(irq); + } else if (VALID_EVTCHN(evtchn)) { + unmask_evtchn(evtchn); + pirq_unmask_notify(irq); + } +} + +static struct hw_interrupt_type pirq_type = { + .typename = "Phys-irq", + .startup = startup_pirq, + .shutdown = shutdown_pirq, + .enable = enable_pirq, + .disable = disable_pirq, + .ack = ack_pirq, + .end = end_pirq, +#ifdef CONFIG_SMP + .set_affinity = set_affinity_irq, +#endif + .retrigger = resend_irq_on_evtchn, +}; + +int irq_ignore_unhandled(unsigned int irq) +{ + struct physdev_irq_status_query irq_status = { .irq = irq }; + + if (!is_running_on_xen()) + return 0; + + if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) + return 0; + return !!(irq_status.flags & XENIRQSTAT_shared); +} + +void notify_remote_via_irq(int irq) +{ + int evtchn = evtchn_from_irq(irq); + + if (VALID_EVTCHN(evtchn)) + notify_remote_via_evtchn(evtchn); +} +EXPORT_SYMBOL_GPL(notify_remote_via_irq); + +int irq_to_evtchn_port(int irq) +{ + return evtchn_from_irq(irq); +} +EXPORT_SYMBOL_GPL(irq_to_evtchn_port); + +void mask_evtchn(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + synch_set_bit(port, s->evtchn_mask); +} +EXPORT_SYMBOL_GPL(mask_evtchn); + +void unmask_evtchn(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + unsigned int cpu = smp_processor_id(); + vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; + + BUG_ON(!irqs_disabled()); + + /* Slow path (hypercall) if this is a non-local port. */ + if (unlikely(cpu != cpu_from_evtchn(port))) { + struct evtchn_unmask unmask = { .port = port }; + VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask)); + return; + } + + synch_clear_bit(port, s->evtchn_mask); + + /* Did we miss an interrupt 'edge'? Re-fire if so. */ + if (synch_test_bit(port, s->evtchn_pending) && + !synch_test_and_set_bit(port / BITS_PER_LONG, + &vcpu_info->evtchn_pending_sel)) + vcpu_info->evtchn_upcall_pending = 1; +} +EXPORT_SYMBOL_GPL(unmask_evtchn); + +void disable_all_local_evtchn(void) +{ + unsigned i, cpu = smp_processor_id(); + shared_info_t *s = HYPERVISOR_shared_info; + + for (i = 0; i < NR_EVENT_CHANNELS; ++i) + if (cpu_from_evtchn(i) == cpu) + synch_set_bit(i, &s->evtchn_mask[0]); +} + +static void restore_cpu_virqs(unsigned int cpu) +{ + struct evtchn_bind_virq bind_virq; + int virq, irq, evtchn; + + for (virq = 0; virq < NR_VIRQS; virq++) { + if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) + continue; + + BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0)); + + /* Get a new binding from Xen. */ + bind_virq.virq = virq; + bind_virq.vcpu = cpu; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, + &bind_virq) != 0) + BUG(); + evtchn = bind_virq.port; + + /* Record the new mapping. */ + evtchn_to_irq[evtchn] = irq; + irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn); + bind_evtchn_to_cpu(evtchn, cpu); + + /* Ready for use. */ + unmask_evtchn(evtchn); + } +} + +static void restore_cpu_ipis(unsigned int cpu) +{ + struct evtchn_bind_ipi bind_ipi; + int ipi, irq, evtchn; + + for (ipi = 0; ipi < NR_IPIS; ipi++) { + if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) + continue; + + BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0)); + + /* Get a new binding from Xen. */ + bind_ipi.vcpu = cpu; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, + &bind_ipi) != 0) + BUG(); + evtchn = bind_ipi.port; + + /* Record the new mapping. */ + evtchn_to_irq[evtchn] = irq; + irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn); + bind_evtchn_to_cpu(evtchn, cpu); + + /* Ready for use. */ + unmask_evtchn(evtchn); + + } +} + +void irq_resume(void) +{ + unsigned int cpu, irq, evtchn; + + init_evtchn_cpu_bindings(); + + /* New event-channel space is not 'live' yet. */ + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) + mask_evtchn(evtchn); + + /* Check that no PIRQs are still bound. */ + for (irq = PIRQ_BASE; irq < (PIRQ_BASE + NR_PIRQS); irq++) + BUG_ON(irq_info[irq] != IRQ_UNBOUND); + + /* No IRQ <-> event-channel mappings. */ + for (irq = 0; irq < NR_IRQS; irq++) + irq_info[irq] &= ~((1U << _EVTCHN_BITS) - 1); + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) + evtchn_to_irq[evtchn] = -1; + + for_each_possible_cpu(cpu) { + restore_cpu_virqs(cpu); + restore_cpu_ipis(cpu); + } + } #if defined(CONFIG_X86_IO_APIC) @@ -777,6 +1040,15 @@ void evtchn_register_pirq(int irq) #else #define identity_mapped_irq(irq) (1) #endif + +void evtchn_register_pirq(int irq) +{ + BUG_ON(irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS); + if (identity_mapped_irq(irq)) + return; + irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0); + set_irq_chip_and_handler_name(irq, &pirq_chip, handle_level_irq, "level"); +} int evtchn_map_pirq(int irq, int xen_pirq) { @@ -798,9 +1070,11 @@ int evtchn_map_pirq(int irq, int xen_pir spin_unlock(&irq_alloc_lock); if (irq < PIRQ_BASE) return -ENOSPC; + irq_desc[irq].chip = &pirq_type; } else if (!xen_pirq) { if (unlikely(type_from_irq(irq) != IRQT_PIRQ)) return -EINVAL; + irq_desc[irq].chip = &no_irq_type; irq_info[irq] = IRQ_UNBOUND; return 0; } else if (type_from_irq(irq) != IRQT_PIRQ @@ -821,283 +1095,6 @@ int evtchn_get_xen_pirq(int irq) return index_from_irq(irq); } -static inline void pirq_unmask_notify(int irq) -{ - struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; - if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) - VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); -} - -static inline void pirq_query_unmask(int irq) -{ - struct physdev_irq_status_query irq_status; - irq_status.irq = evtchn_get_xen_pirq(irq); - if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) - irq_status.flags = 0; - clear_bit(irq - PIRQ_BASE, pirq_needs_eoi); - if (irq_status.flags & XENIRQSTAT_needs_eoi) - set_bit(irq - PIRQ_BASE, pirq_needs_eoi); -} - -/* - * On startup, if there is no action associated with the IRQ then we are - * probing. In this case we should not share with others as it will confuse us. - */ -#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL) - -static unsigned int startup_pirq(unsigned int irq) -{ - struct evtchn_bind_pirq bind_pirq; - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn)) - goto out; - - bind_pirq.pirq = evtchn_get_xen_pirq(irq); - /* NB. We are happy to share unless we are probing. */ - bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { - if (!probing_irq(irq)) - printk(KERN_INFO "Failed to obtain physical IRQ %d\n", - irq); - return 0; - } - evtchn = bind_pirq.port; - - pirq_query_unmask(irq); - - evtchn_to_irq[evtchn] = irq; - bind_evtchn_to_cpu(evtchn, 0); - irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); - - out: - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - - return 0; -} - -static void shutdown_pirq(unsigned int irq) -{ - struct evtchn_close close; - int evtchn = evtchn_from_irq(irq); - - if (!VALID_EVTCHN(evtchn)) - return; - - mask_evtchn(evtchn); - - close.port = evtchn; - if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) - BUG(); - - bind_evtchn_to_cpu(evtchn, 0); - evtchn_to_irq[evtchn] = -1; - irq_info[irq] = mk_irq_info(IRQT_PIRQ, index_from_irq(irq), 0); -} - -static void enable_pirq(unsigned int irq) -{ - startup_pirq(irq); -} - -static void disable_pirq(unsigned int irq) -{ -} - -static void ack_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - move_native_irq(irq); - - if (VALID_EVTCHN(evtchn)) { - mask_evtchn(evtchn); - clear_evtchn(evtchn); - } -} - -static void end_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == - (IRQ_DISABLED|IRQ_PENDING)) { - shutdown_pirq(irq); - } else if (VALID_EVTCHN(evtchn)) { - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - } -} - -static struct hw_interrupt_type pirq_type = { - .typename = "Phys-irq", - .startup = startup_pirq, - .shutdown = shutdown_pirq, - .enable = enable_pirq, - .disable = disable_pirq, - .ack = ack_pirq, - .end = end_pirq, -#ifdef CONFIG_SMP - .set_affinity = set_affinity_irq, -#endif - .retrigger = resend_irq_on_evtchn, -}; - -int irq_ignore_unhandled(unsigned int irq) -{ - struct physdev_irq_status_query irq_status = { .irq = irq }; - - if (!is_running_on_xen()) - return 0; - - if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) - return 0; - return !!(irq_status.flags & XENIRQSTAT_shared); -} - -void notify_remote_via_irq(int irq) -{ - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn)) - notify_remote_via_evtchn(evtchn); -} -EXPORT_SYMBOL_GPL(notify_remote_via_irq); - -int irq_to_evtchn_port(int irq) -{ - return evtchn_from_irq(irq); -} -EXPORT_SYMBOL_GPL(irq_to_evtchn_port); - -void mask_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - synch_set_bit(port, s->evtchn_mask); -} -EXPORT_SYMBOL_GPL(mask_evtchn); - -void unmask_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - unsigned int cpu = smp_processor_id(); - vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; - - BUG_ON(!irqs_disabled()); - - /* Slow path (hypercall) if this is a non-local port. */ - if (unlikely(cpu != cpu_from_evtchn(port))) { - struct evtchn_unmask unmask = { .port = port }; - VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask)); - return; - } - - synch_clear_bit(port, s->evtchn_mask); - - /* Did we miss an interrupt 'edge'? Re-fire if so. */ - if (synch_test_bit(port, s->evtchn_pending) && - !synch_test_and_set_bit(port / BITS_PER_LONG, - &vcpu_info->evtchn_pending_sel)) - vcpu_info->evtchn_upcall_pending = 1; -} -EXPORT_SYMBOL_GPL(unmask_evtchn); - -void disable_all_local_evtchn(void) -{ - unsigned i, cpu = smp_processor_id(); - shared_info_t *s = HYPERVISOR_shared_info; - - for (i = 0; i < NR_EVENT_CHANNELS; ++i) - if (cpu_from_evtchn(i) == cpu) - synch_set_bit(i, &s->evtchn_mask[0]); -} - -static void restore_cpu_virqs(unsigned int cpu) -{ - struct evtchn_bind_virq bind_virq; - int virq, irq, evtchn; - - for (virq = 0; virq < NR_VIRQS; virq++) { - if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) - continue; - - BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0)); - - /* Get a new binding from Xen. */ - bind_virq.virq = virq; - bind_virq.vcpu = cpu; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, - &bind_virq) != 0) - BUG(); - evtchn = bind_virq.port; - - /* Record the new mapping. */ - evtchn_to_irq[evtchn] = irq; - irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn); - bind_evtchn_to_cpu(evtchn, cpu); - - /* Ready for use. */ - unmask_evtchn(evtchn); - } -} - -static void restore_cpu_ipis(unsigned int cpu) -{ - struct evtchn_bind_ipi bind_ipi; - int ipi, irq, evtchn; - - for (ipi = 0; ipi < NR_IPIS; ipi++) { - if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) - continue; - - BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0)); - - /* Get a new binding from Xen. */ - bind_ipi.vcpu = cpu; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, - &bind_ipi) != 0) - BUG(); - evtchn = bind_ipi.port; - - /* Record the new mapping. */ - evtchn_to_irq[evtchn] = irq; - irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn); - bind_evtchn_to_cpu(evtchn, cpu); - - /* Ready for use. */ - unmask_evtchn(evtchn); - - } -} - -void irq_resume(void) -{ - unsigned int cpu, irq, evtchn; - - init_evtchn_cpu_bindings(); - - /* New event-channel space is not 'live' yet. */ - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) - mask_evtchn(evtchn); - - /* Check that no PIRQs are still bound. */ - for (irq = PIRQ_BASE; irq < (PIRQ_BASE + NR_PIRQS); irq++) - BUG_ON(irq_info[irq] != IRQ_UNBOUND); - - /* No IRQ <-> event-channel mappings. */ - for (irq = 0; irq < NR_IRQS; irq++) - irq_info[irq] &= ~((1U << _EVTCHN_BITS) - 1); - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) - evtchn_to_irq[evtchn] = -1; - - for_each_possible_cpu(cpu) { - restore_cpu_virqs(cpu); - restore_cpu_ipis(cpu); - } - -} - void __init xen_init_IRQ(void) { unsigned int i; @@ -1126,16 +1123,16 @@ void __init xen_init_IRQ(void) for (i = PIRQ_BASE; i < (PIRQ_BASE + NR_PIRQS); i++) { irq_bindcount[i] = 1; + if (!identity_mapped_irq(i)) + continue; + #ifdef RTC_IRQ /* If not domain 0, force our RTC driver to fail its probe. */ - if (identity_mapped_irq(i) && ((i - PIRQ_BASE) == RTC_IRQ) - && !is_initial_xendomain()) + if (i - PIRQ_BASE == RTC_IRQ && !is_initial_xendomain()) continue; #endif irq_desc[i].status = IRQ_DISABLED; - if (!identity_mapped_irq(i)) - irq_desc[i].status |= IRQ_NOPROBE; irq_desc[i].action = NULL; irq_desc[i].depth = 1; irq_desc[i].chip = &pirq_type; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:04:53 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:04:53 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjwD-0003gK-9V; Wed, 05 Nov 2008 07:04:53 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjsG-0001EB-C4 for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:00:48 -0800 X-ASG-Debug-ID: 1225897244-688100030002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 1FB43DCA91 for ; Wed, 5 Nov 2008 07:00:46 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id PdPuuLnZEmggULjG for ; Wed, 05 Nov 2008 07:00:46 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563431 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563431" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:45 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0jJu004542 for ; Wed, 5 Nov 2008 07:00:45 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F182C016463 for ; Wed, 5 Nov 2008 07:01:08 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F18L0016445 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:01:08 -0800 Message-Id: <200811051501.mA5F18L0016445@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:01:07 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] Revert 720:509d67fe5120b. Breaks the build. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897247 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] Revert 720:509d67fe5120b. Breaks the build. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225896694 0 # Node ID 65ef40020d28e74177a0c21023509007097726a2 # Parent 509d67fe5120bf8ff19e1b2df21a4c5472292db2 Revert 720:509d67fe5120b. Breaks the build. --- arch/i386/kernel/io_apic-xen.c | 3 arch/x86_64/kernel/io_apic-xen.c | 3 drivers/xen/core/evtchn.c | 583 +++++++++++++++++++-------------------- 3 files changed, 293 insertions(+), 296 deletions(-) diff -r 509d67fe5120 -r 65ef40020d28 arch/i386/kernel/io_apic-xen.c --- a/arch/i386/kernel/io_apic-xen.c Wed Nov 05 14:45:34 2008 +0000 +++ b/arch/i386/kernel/io_apic-xen.c Wed Nov 05 14:51:34 2008 +0000 @@ -1216,9 +1216,6 @@ int assign_irq_vector(int irq) BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); - if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS) - return -EINVAL; - spin_lock_irqsave(&vector_lock, flags); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { diff -r 509d67fe5120 -r 65ef40020d28 arch/x86_64/kernel/io_apic-xen.c --- a/arch/x86_64/kernel/io_apic-xen.c Wed Nov 05 14:45:34 2008 +0000 +++ b/arch/x86_64/kernel/io_apic-xen.c Wed Nov 05 14:51:34 2008 +0000 @@ -895,9 +895,6 @@ int assign_irq_vector(int irq) BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); - if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS) - return -EINVAL; - spin_lock_irqsave(&vector_lock, flags); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { diff -r 509d67fe5120 -r 65ef40020d28 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Wed Nov 05 14:45:34 2008 +0000 +++ b/drivers/xen/core/evtchn.c Wed Nov 05 14:51:34 2008 +0000 @@ -756,281 +756,18 @@ static struct hw_interrupt_type dynirq_t .retrigger = resend_irq_on_evtchn, }; -static inline void pirq_unmask_notify(int irq) -{ - struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; - if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) - VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); -} - -static inline void pirq_query_unmask(int irq) -{ - struct physdev_irq_status_query irq_status; - irq_status.irq = evtchn_get_xen_pirq(irq); - if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) - irq_status.flags = 0; - clear_bit(irq - PIRQ_BASE, pirq_needs_eoi); - if (irq_status.flags & XENIRQSTAT_needs_eoi) - set_bit(irq - PIRQ_BASE, pirq_needs_eoi); -} - -/* - * On startup, if there is no action associated with the IRQ then we are - * probing. In this case we should not share with others as it will confuse us. - */ -#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL) - -static unsigned int startup_pirq(unsigned int irq) -{ - struct evtchn_bind_pirq bind_pirq; - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn)) - goto out; - - bind_pirq.pirq = evtchn_get_xen_pirq(irq); - /* NB. We are happy to share unless we are probing. */ - bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { - if (!probing_irq(irq)) - printk(KERN_INFO "Failed to obtain physical IRQ %d\n", - irq); - return 0; - } - evtchn = bind_pirq.port; - - pirq_query_unmask(irq); - - evtchn_to_irq[evtchn] = irq; - bind_evtchn_to_cpu(evtchn, 0); - irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); - - out: - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - - return 0; -} - -static void shutdown_pirq(unsigned int irq) -{ - struct evtchn_close close; - int evtchn = evtchn_from_irq(irq); - - if (!VALID_EVTCHN(evtchn)) - return; - - mask_evtchn(evtchn); - - close.port = evtchn; - if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) - BUG(); - - bind_evtchn_to_cpu(evtchn, 0); - evtchn_to_irq[evtchn] = -1; - irq_info[irq] = mk_irq_info(IRQT_PIRQ, index_from_irq(irq), 0); -} - -static void enable_pirq(unsigned int irq) -{ - startup_pirq(irq); -} - -static void disable_pirq(unsigned int irq) -{ -} - -static void ack_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - move_native_irq(irq); - - if (VALID_EVTCHN(evtchn)) { - mask_evtchn(evtchn); - clear_evtchn(evtchn); - } -} - -static void end_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == - (IRQ_DISABLED|IRQ_PENDING)) { - shutdown_pirq(irq); - } else if (VALID_EVTCHN(evtchn)) { - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - } -} - -static struct hw_interrupt_type pirq_type = { - .typename = "Phys-irq", - .startup = startup_pirq, - .shutdown = shutdown_pirq, - .enable = enable_pirq, - .disable = disable_pirq, - .ack = ack_pirq, - .end = end_pirq, -#ifdef CONFIG_SMP - .set_affinity = set_affinity_irq, -#endif - .retrigger = resend_irq_on_evtchn, -}; - -int irq_ignore_unhandled(unsigned int irq) -{ - struct physdev_irq_status_query irq_status = { .irq = irq }; - - if (!is_running_on_xen()) - return 0; - - if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) - return 0; - return !!(irq_status.flags & XENIRQSTAT_shared); -} - -void notify_remote_via_irq(int irq) -{ - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn)) - notify_remote_via_evtchn(evtchn); -} -EXPORT_SYMBOL_GPL(notify_remote_via_irq); - -int irq_to_evtchn_port(int irq) -{ - return evtchn_from_irq(irq); -} -EXPORT_SYMBOL_GPL(irq_to_evtchn_port); - -void mask_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - synch_set_bit(port, s->evtchn_mask); -} -EXPORT_SYMBOL_GPL(mask_evtchn); - -void unmask_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - unsigned int cpu = smp_processor_id(); - vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; - - BUG_ON(!irqs_disabled()); - - /* Slow path (hypercall) if this is a non-local port. */ - if (unlikely(cpu != cpu_from_evtchn(port))) { - struct evtchn_unmask unmask = { .port = port }; - VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask)); - return; - } - - synch_clear_bit(port, s->evtchn_mask); - - /* Did we miss an interrupt 'edge'? Re-fire if so. */ - if (synch_test_bit(port, s->evtchn_pending) && - !synch_test_and_set_bit(port / BITS_PER_LONG, - &vcpu_info->evtchn_pending_sel)) - vcpu_info->evtchn_upcall_pending = 1; -} -EXPORT_SYMBOL_GPL(unmask_evtchn); - -void disable_all_local_evtchn(void) -{ - unsigned i, cpu = smp_processor_id(); - shared_info_t *s = HYPERVISOR_shared_info; - - for (i = 0; i < NR_EVENT_CHANNELS; ++i) - if (cpu_from_evtchn(i) == cpu) - synch_set_bit(i, &s->evtchn_mask[0]); -} - -static void restore_cpu_virqs(unsigned int cpu) -{ - struct evtchn_bind_virq bind_virq; - int virq, irq, evtchn; - - for (virq = 0; virq < NR_VIRQS; virq++) { - if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) - continue; - - BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0)); - - /* Get a new binding from Xen. */ - bind_virq.virq = virq; - bind_virq.vcpu = cpu; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, - &bind_virq) != 0) - BUG(); - evtchn = bind_virq.port; - - /* Record the new mapping. */ - evtchn_to_irq[evtchn] = irq; - irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn); - bind_evtchn_to_cpu(evtchn, cpu); - - /* Ready for use. */ - unmask_evtchn(evtchn); - } -} - -static void restore_cpu_ipis(unsigned int cpu) -{ - struct evtchn_bind_ipi bind_ipi; - int ipi, irq, evtchn; - - for (ipi = 0; ipi < NR_IPIS; ipi++) { - if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) - continue; - - BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0)); - - /* Get a new binding from Xen. */ - bind_ipi.vcpu = cpu; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, - &bind_ipi) != 0) - BUG(); - evtchn = bind_ipi.port; - - /* Record the new mapping. */ - evtchn_to_irq[evtchn] = irq; - irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn); - bind_evtchn_to_cpu(evtchn, cpu); - - /* Ready for use. */ - unmask_evtchn(evtchn); - - } -} - -void irq_resume(void) -{ - unsigned int cpu, irq, evtchn; - - init_evtchn_cpu_bindings(); - - /* New event-channel space is not 'live' yet. */ - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) - mask_evtchn(evtchn); - - /* Check that no PIRQs are still bound. */ - for (irq = PIRQ_BASE; irq < (PIRQ_BASE + NR_PIRQS); irq++) - BUG_ON(irq_info[irq] != IRQ_UNBOUND); - - /* No IRQ <-> event-channel mappings. */ - for (irq = 0; irq < NR_IRQS; irq++) - irq_info[irq] &= ~((1U << _EVTCHN_BITS) - 1); - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) - evtchn_to_irq[evtchn] = -1; - - for_each_possible_cpu(cpu) { - restore_cpu_virqs(cpu); - restore_cpu_ipis(cpu); - } - +void evtchn_register_pirq(int irq) +{ + struct irq_desc *desc; + unsigned long flags; + + irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0); + + /* Cannot call set_irq_probe(), as that's marked __init. */ + desc = irq_desc + irq; + spin_lock_irqsave(&desc->lock, flags); + desc->status &= ~IRQ_NOPROBE; + spin_unlock_irqrestore(&desc->lock, flags); } #if defined(CONFIG_X86_IO_APIC) @@ -1040,15 +777,6 @@ void irq_resume(void) #else #define identity_mapped_irq(irq) (1) #endif - -void evtchn_register_pirq(int irq) -{ - BUG_ON(irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS); - if (identity_mapped_irq(irq)) - return; - irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0); - set_irq_chip_and_handler_name(irq, &pirq_chip, handle_level_irq, "level"); -} int evtchn_map_pirq(int irq, int xen_pirq) { @@ -1070,11 +798,9 @@ int evtchn_map_pirq(int irq, int xen_pir spin_unlock(&irq_alloc_lock); if (irq < PIRQ_BASE) return -ENOSPC; - irq_desc[irq].chip = &pirq_type; } else if (!xen_pirq) { if (unlikely(type_from_irq(irq) != IRQT_PIRQ)) return -EINVAL; - irq_desc[irq].chip = &no_irq_type; irq_info[irq] = IRQ_UNBOUND; return 0; } else if (type_from_irq(irq) != IRQT_PIRQ @@ -1095,6 +821,283 @@ int evtchn_get_xen_pirq(int irq) return index_from_irq(irq); } +static inline void pirq_unmask_notify(int irq) +{ + struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; + if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) + VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); +} + +static inline void pirq_query_unmask(int irq) +{ + struct physdev_irq_status_query irq_status; + irq_status.irq = evtchn_get_xen_pirq(irq); + if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) + irq_status.flags = 0; + clear_bit(irq - PIRQ_BASE, pirq_needs_eoi); + if (irq_status.flags & XENIRQSTAT_needs_eoi) + set_bit(irq - PIRQ_BASE, pirq_needs_eoi); +} + +/* + * On startup, if there is no action associated with the IRQ then we are + * probing. In this case we should not share with others as it will confuse us. + */ +#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL) + +static unsigned int startup_pirq(unsigned int irq) +{ + struct evtchn_bind_pirq bind_pirq; + int evtchn = evtchn_from_irq(irq); + + if (VALID_EVTCHN(evtchn)) + goto out; + + bind_pirq.pirq = evtchn_get_xen_pirq(irq); + /* NB. We are happy to share unless we are probing. */ + bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { + if (!probing_irq(irq)) + printk(KERN_INFO "Failed to obtain physical IRQ %d\n", + irq); + return 0; + } + evtchn = bind_pirq.port; + + pirq_query_unmask(irq); + + evtchn_to_irq[evtchn] = irq; + bind_evtchn_to_cpu(evtchn, 0); + irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); + + out: + unmask_evtchn(evtchn); + pirq_unmask_notify(irq); + + return 0; +} + +static void shutdown_pirq(unsigned int irq) +{ + struct evtchn_close close; + int evtchn = evtchn_from_irq(irq); + + if (!VALID_EVTCHN(evtchn)) + return; + + mask_evtchn(evtchn); + + close.port = evtchn; + if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) + BUG(); + + bind_evtchn_to_cpu(evtchn, 0); + evtchn_to_irq[evtchn] = -1; + irq_info[irq] = mk_irq_info(IRQT_PIRQ, index_from_irq(irq), 0); +} + +static void enable_pirq(unsigned int irq) +{ + startup_pirq(irq); +} + +static void disable_pirq(unsigned int irq) +{ +} + +static void ack_pirq(unsigned int irq) +{ + int evtchn = evtchn_from_irq(irq); + + move_native_irq(irq); + + if (VALID_EVTCHN(evtchn)) { + mask_evtchn(evtchn); + clear_evtchn(evtchn); + } +} + +static void end_pirq(unsigned int irq) +{ + int evtchn = evtchn_from_irq(irq); + + if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == + (IRQ_DISABLED|IRQ_PENDING)) { + shutdown_pirq(irq); + } else if (VALID_EVTCHN(evtchn)) { + unmask_evtchn(evtchn); + pirq_unmask_notify(irq); + } +} + +static struct hw_interrupt_type pirq_type = { + .typename = "Phys-irq", + .startup = startup_pirq, + .shutdown = shutdown_pirq, + .enable = enable_pirq, + .disable = disable_pirq, + .ack = ack_pirq, + .end = end_pirq, +#ifdef CONFIG_SMP + .set_affinity = set_affinity_irq, +#endif + .retrigger = resend_irq_on_evtchn, +}; + +int irq_ignore_unhandled(unsigned int irq) +{ + struct physdev_irq_status_query irq_status = { .irq = irq }; + + if (!is_running_on_xen()) + return 0; + + if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) + return 0; + return !!(irq_status.flags & XENIRQSTAT_shared); +} + +void notify_remote_via_irq(int irq) +{ + int evtchn = evtchn_from_irq(irq); + + if (VALID_EVTCHN(evtchn)) + notify_remote_via_evtchn(evtchn); +} +EXPORT_SYMBOL_GPL(notify_remote_via_irq); + +int irq_to_evtchn_port(int irq) +{ + return evtchn_from_irq(irq); +} +EXPORT_SYMBOL_GPL(irq_to_evtchn_port); + +void mask_evtchn(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + synch_set_bit(port, s->evtchn_mask); +} +EXPORT_SYMBOL_GPL(mask_evtchn); + +void unmask_evtchn(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + unsigned int cpu = smp_processor_id(); + vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; + + BUG_ON(!irqs_disabled()); + + /* Slow path (hypercall) if this is a non-local port. */ + if (unlikely(cpu != cpu_from_evtchn(port))) { + struct evtchn_unmask unmask = { .port = port }; + VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask)); + return; + } + + synch_clear_bit(port, s->evtchn_mask); + + /* Did we miss an interrupt 'edge'? Re-fire if so. */ + if (synch_test_bit(port, s->evtchn_pending) && + !synch_test_and_set_bit(port / BITS_PER_LONG, + &vcpu_info->evtchn_pending_sel)) + vcpu_info->evtchn_upcall_pending = 1; +} +EXPORT_SYMBOL_GPL(unmask_evtchn); + +void disable_all_local_evtchn(void) +{ + unsigned i, cpu = smp_processor_id(); + shared_info_t *s = HYPERVISOR_shared_info; + + for (i = 0; i < NR_EVENT_CHANNELS; ++i) + if (cpu_from_evtchn(i) == cpu) + synch_set_bit(i, &s->evtchn_mask[0]); +} + +static void restore_cpu_virqs(unsigned int cpu) +{ + struct evtchn_bind_virq bind_virq; + int virq, irq, evtchn; + + for (virq = 0; virq < NR_VIRQS; virq++) { + if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) + continue; + + BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0)); + + /* Get a new binding from Xen. */ + bind_virq.virq = virq; + bind_virq.vcpu = cpu; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, + &bind_virq) != 0) + BUG(); + evtchn = bind_virq.port; + + /* Record the new mapping. */ + evtchn_to_irq[evtchn] = irq; + irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn); + bind_evtchn_to_cpu(evtchn, cpu); + + /* Ready for use. */ + unmask_evtchn(evtchn); + } +} + +static void restore_cpu_ipis(unsigned int cpu) +{ + struct evtchn_bind_ipi bind_ipi; + int ipi, irq, evtchn; + + for (ipi = 0; ipi < NR_IPIS; ipi++) { + if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) + continue; + + BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0)); + + /* Get a new binding from Xen. */ + bind_ipi.vcpu = cpu; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, + &bind_ipi) != 0) + BUG(); + evtchn = bind_ipi.port; + + /* Record the new mapping. */ + evtchn_to_irq[evtchn] = irq; + irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn); + bind_evtchn_to_cpu(evtchn, cpu); + + /* Ready for use. */ + unmask_evtchn(evtchn); + + } +} + +void irq_resume(void) +{ + unsigned int cpu, irq, evtchn; + + init_evtchn_cpu_bindings(); + + /* New event-channel space is not 'live' yet. */ + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) + mask_evtchn(evtchn); + + /* Check that no PIRQs are still bound. */ + for (irq = PIRQ_BASE; irq < (PIRQ_BASE + NR_PIRQS); irq++) + BUG_ON(irq_info[irq] != IRQ_UNBOUND); + + /* No IRQ <-> event-channel mappings. */ + for (irq = 0; irq < NR_IRQS; irq++) + irq_info[irq] &= ~((1U << _EVTCHN_BITS) - 1); + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) + evtchn_to_irq[evtchn] = -1; + + for_each_possible_cpu(cpu) { + restore_cpu_virqs(cpu); + restore_cpu_ipis(cpu); + } + +} + void __init xen_init_IRQ(void) { unsigned int i; @@ -1123,16 +1126,16 @@ void __init xen_init_IRQ(void) for (i = PIRQ_BASE; i < (PIRQ_BASE + NR_PIRQS); i++) { irq_bindcount[i] = 1; - if (!identity_mapped_irq(i)) - continue; - #ifdef RTC_IRQ /* If not domain 0, force our RTC driver to fail its probe. */ - if (i - PIRQ_BASE == RTC_IRQ && !is_initial_xendomain()) + if (identity_mapped_irq(i) && ((i - PIRQ_BASE) == RTC_IRQ) + && !is_initial_xendomain()) continue; #endif irq_desc[i].status = IRQ_DISABLED; + if (!identity_mapped_irq(i)) + irq_desc[i].status |= IRQ_NOPROBE; irq_desc[i].action = NULL; irq_desc[i].depth = 1; irq_desc[i].chip = &pirq_type; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:05:01 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:05:01 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjwL-0003km-0C; Wed, 05 Nov 2008 07:05:01 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjsg-0001V7-Qm for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:01:14 -0800 X-ASG-Debug-ID: 1225897273-5d5c00150000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 5D700DCAA1 for ; Wed, 5 Nov 2008 07:01:14 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 9HWE631fho5bpcJE for ; Wed, 05 Nov 2008 07:01:14 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563389 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563389" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:11 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0AM5004446 for ; Wed, 5 Nov 2008 07:00:10 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0XEw015768 for ; Wed, 5 Nov 2008 07:00:33 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0Xcx015767 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:33 -0800 Message-Id: <200811051500.mA5F0Xcx015767@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:32 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] minios: do not expose #define current to applications X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897274 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE_7582B X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE_7582B Custom Rule 7582B Subject: [Xen-changelog] [xen-unstable] minios: do not expose #define current to applications X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225133512 0 # Node ID 8d41996e6897c52bbcfacda68e6911c7459eb2b8 # Parent 324b9b1dd71dbbfc7f2af7bee0f4e704e59ba7d5 minios: do not expose #define current to applications Currently the minios headers do this: #define current get_current() Obviously when porting general code to this environment, this can cause problems ! The attached patch arranges for this only to be done if #define __MINIOS__ is declared, which is set up by the makefile in extras/mini-os. Suppressing the namespace pollution is necessary to get recent upstream qemu's to compile, since they (quite properly) use `current' as an ordinary identifier. Signed-off-by: Ian Jackson --- extras/mini-os/Makefile | 3 +++ extras/mini-os/include/sched.h | 3 ++- extras/mini-os/include/wait.h | 10 +++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff -r 324b9b1dd71d -r 8d41996e6897 extras/mini-os/Makefile --- a/extras/mini-os/Makefile Mon Oct 27 14:59:01 2008 +0000 +++ b/extras/mini-os/Makefile Mon Oct 27 18:51:52 2008 +0000 @@ -17,6 +17,9 @@ include minios.mk # Set tester flags # CFLAGS += -DBLKTEST_WRITE + +# Make the headers define our internal stuff +CFLAGS += -D__MINIOS__ # Define some default flags for linking. LDLIBS := diff -r 324b9b1dd71d -r 8d41996e6897 extras/mini-os/include/sched.h --- a/extras/mini-os/include/sched.h Mon Oct 27 14:59:01 2008 +0000 +++ b/extras/mini-os/include/sched.h Mon Oct 27 18:51:52 2008 +0000 @@ -48,8 +48,9 @@ void exit_thread(void) __attribute__((no void exit_thread(void) __attribute__((noreturn)); void schedule(void); +#ifdef __MINIOS__ #define current get_current() - +#endif void wake(struct thread *thread); void block(struct thread *thread); diff -r 324b9b1dd71d -r 8d41996e6897 extras/mini-os/include/wait.h --- a/extras/mini-os/include/wait.h Mon Oct 27 14:59:01 2008 +0000 +++ b/extras/mini-os/include/wait.h Mon Oct 27 18:51:52 2008 +0000 @@ -7,7 +7,7 @@ #define DEFINE_WAIT(name) \ struct wait_queue name = { \ - .thread = current, \ + .thread = get_current(), \ .thread_list = MINIOS_LIST_HEAD_INIT((name).thread_list), \ } @@ -53,7 +53,7 @@ static inline void wake_up(struct wait_q unsigned long flags; \ local_irq_save(flags); \ add_wait_queue(&wq, &w); \ - block(current); \ + block(get_current()); \ local_irq_restore(flags); \ } while (0) @@ -74,8 +74,8 @@ static inline void wake_up(struct wait_q /* protect the list */ \ local_irq_save(flags); \ add_wait_queue(&wq, &__wait); \ - current->wakeup_time = deadline; \ - clear_runnable(current); \ + get_current()->wakeup_time = deadline; \ + clear_runnable(get_current()); \ local_irq_restore(flags); \ if((condition) || (deadline && NOW() >= deadline)) \ break; \ @@ -83,7 +83,7 @@ static inline void wake_up(struct wait_q } \ local_irq_save(flags); \ /* need to wake up */ \ - wake(current); \ + wake(get_current()); \ remove_wait_queue(&__wait); \ local_irq_restore(flags); \ } while(0) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 05 07:05:07 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 05 Nov 2008 07:05:07 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KxjwR-0003pB-LU; Wed, 05 Nov 2008 07:05:07 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Kxjsx-0001fv-UM for xen-changelog@lists.xensource.com; Wed, 05 Nov 2008 07:01:31 -0800 X-ASG-Debug-ID: 1225897290-686600040000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 6CF5BDCAAD for ; Wed, 5 Nov 2008 07:01:31 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id rq94zQeTmLPKiVtA for ; Wed, 05 Nov 2008 07:01:31 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2563414 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,550,1220241600"; d="scan'208";a="2563414" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 Nov 2008 10:00:28 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0RBt004494 for ; Wed, 5 Nov 2008 07:00:27 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA5F0o7P016089 for ; Wed, 5 Nov 2008 07:00:50 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA5F0oKR016088 for xen-changelog@lists.xensource.com; Wed, 5 Nov 2008 07:00:50 -0800 Message-Id: <200811051500.mA5F0oKR016088@xenbits.xensource.com> Date: Wed, 05 Nov 2008 07:00:50 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Use the right error code when testing for spurious pagefaults X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225897291 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9537 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Use the right error code when testing for spurious pagefaults X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225379067 0 # Node ID 85ba96069dfb3edf180656991aafa6cc8e368773 # Parent ed30f4efb728980ba84c34fc7fdc7be5f5a4a78e x86: Use the right error code when testing for spurious pagefaults Shadowed PV domains may take pagefaults with PFEC_reserved_bit bit set, which are then turned into page-not-present faults by the shadow code. Since that changes the error code in the regs structure, we need to remember the old error code when we later check for spurious page faults or we'll get false positives. Signed-off-by: Tim Deegan --- xen/arch/x86/traps.c | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) diff -r ed30f4efb728 -r 85ba96069dfb xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Thu Oct 30 14:53:24 2008 +0000 +++ b/xen/arch/x86/traps.c Thu Oct 30 15:04:27 2008 +0000 @@ -1030,7 +1030,7 @@ static int handle_gdt_ldt_mapping_fault( #endif static int __spurious_page_fault( - unsigned long addr, struct cpu_user_regs *regs) + unsigned long addr, unsigned int error_code) { unsigned long mfn, cr3 = read_cr3(); #if CONFIG_PAGING_LEVELS >= 4 @@ -1052,17 +1052,17 @@ static int __spurious_page_fault( return 0; /* Reserved bit violations are never spurious faults. */ - if ( regs->error_code & PFEC_reserved_bit ) + if ( error_code & PFEC_reserved_bit ) return 0; required_flags = _PAGE_PRESENT; - if ( regs->error_code & PFEC_write_access ) + if ( error_code & PFEC_write_access ) required_flags |= _PAGE_RW; - if ( regs->error_code & PFEC_user_mode ) + if ( error_code & PFEC_user_mode ) required_flags |= _PAGE_USER; disallowed_flags = 0; - if ( regs->error_code & PFEC_insn_fetch ) + if ( error_code & PFEC_insn_fetch ) disallowed_flags |= _PAGE_NX; mfn = cr3 >> PAGE_SHIFT; @@ -1120,7 +1120,7 @@ static int __spurious_page_fault( dprintk(XENLOG_WARNING, "Spurious fault in domain %u:%u " "at addr %lx, e/c %04x\n", current->domain->domain_id, current->vcpu_id, - addr, regs->error_code); + addr, error_code); #if CONFIG_PAGING_LEVELS >= 4 dprintk(XENLOG_WARNING, " l4e = %"PRIpte"\n", l4e_get_intpte(l4e)); #endif @@ -1129,14 +1129,11 @@ static int __spurious_page_fault( #endif dprintk(XENLOG_WARNING, " l2e = %"PRIpte"\n", l2e_get_intpte(l2e)); dprintk(XENLOG_WARNING, " l1e = %"PRIpte"\n", l1e_get_intpte(l1e)); -#ifndef NDEBUG - show_registers(regs); -#endif return 1; } static int spurious_page_fault( - unsigned long addr, struct cpu_user_regs *regs) + unsigned long addr, unsigned int error_code) { unsigned long flags; int is_spurious; @@ -1146,7 +1143,7 @@ static int spurious_page_fault( * page tables from becoming invalid under our feet during the walk. */ local_irq_save(flags); - is_spurious = __spurious_page_fault(addr, regs); + is_spurious = __spurious_page_fault(addr, error_code); local_irq_restore(flags); return is_spurious; @@ -1208,8 +1205,12 @@ asmlinkage void do_page_fault(struct cpu asmlinkage void do_page_fault(struct cpu_user_regs *regs) { unsigned long addr, fixup; + unsigned int error_code; addr = read_cr2(); + + /* fixup_page_fault() might change regs->error_code, so cache it here. */ + error_code = regs->error_code; DEBUGGER_trap_entry(TRAP_page_fault, regs); @@ -1220,7 +1221,7 @@ asmlinkage void do_page_fault(struct cpu if ( unlikely(!guest_mode(regs)) ) { - if ( spurious_page_fault(addr, regs) ) + if ( spurious_page_fault(addr, error_code) ) return; if ( likely((fixup = search_exception_table(regs->eip)) != 0) ) @@ -1239,11 +1240,11 @@ asmlinkage void do_page_fault(struct cpu panic("FATAL PAGE FAULT\n" "[error_code=%04x]\n" "Faulting linear address: %p\n", - regs->error_code, _p(addr)); + error_code, _p(addr)); } if ( unlikely(current->domain->arch.suppress_spurious_page_faults - && spurious_page_fault(addr, regs)) ) + && spurious_page_fault(addr, error_code)) ) return; propagate_page_fault(addr, regs->error_code); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu Nov 06 07:39:52 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Thu, 06 Nov 2008 07:39:52 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Ky6xc-0005yG-EW; Thu, 06 Nov 2008 07:39:52 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Ky6xa-0005xl-0O for xen-changelog@lists.xensource.com; Thu, 06 Nov 2008 07:39:50 -0800 X-ASG-Debug-ID: 1225985988-02bd00000001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 46079DDC48 for ; Thu, 6 Nov 2008 07:39:49 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 8lmObDtrxy21ION6 for ; Thu, 06 Nov 2008 07:39:49 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2577556 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,558,1220241600"; d="scan'208";a="2577556" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 Nov 2008 10:39:47 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA6Fdluv007358 for ; Thu, 6 Nov 2008 07:39:47 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA6FeA69004207 for ; Thu, 6 Nov 2008 07:40:10 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA6FeAI4004206 for xen-changelog@lists.xensource.com; Thu, 6 Nov 2008 07:40:10 -0800 Message-Id: <200811061540.mA6FeAI4004206@xenbits.xensource.com> Date: Thu, 06 Nov 2008 07:40:10 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] blkback: Do not queue up bio structs before submitting them. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225985989 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9617 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] blkback: Do not queue up bio structs before submitting them. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225967340 0 # Node ID 61ab98b5cc0ebf20dd766ec67a84319f058ef6f0 # Parent 0729cb8b1292c9168db0b8e3f2251fd0a9d531b8 blkback: Do not queue up bio structs before submitting them. Signed-off-by: Keir Fraser --- drivers/xen/blkback/blkback.c | 44 +++++++++++++++++++++++++----------------- 1 files changed, 27 insertions(+), 17 deletions(-) diff -r 0729cb8b1292 -r 61ab98b5cc0e drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Wed Nov 05 15:43:55 2008 +0000 +++ b/drivers/xen/blkback/blkback.c Thu Nov 06 10:29:00 2008 +0000 @@ -151,9 +151,9 @@ static void unplug_queue(blkif_t *blkif) blkif->plug = NULL; } -static void plug_queue(blkif_t *blkif, struct bio *bio) -{ - request_queue_t *q = bdev_get_queue(bio->bi_bdev); +static void plug_queue(blkif_t *blkif, struct block_device *bdev) +{ + request_queue_t *q = bdev_get_queue(bdev); if (q == blkif->plug) return; @@ -389,8 +389,8 @@ static void dispatch_rw_block_io(blkif_t unsigned long buf; unsigned int nsec; } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; unsigned int nseg; - struct bio *bio = NULL, *biolist[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - int ret, i, nbio = 0; + struct bio *bio = NULL; + int ret, i; int operation; switch (req->operation) { @@ -477,6 +477,10 @@ static void dispatch_rw_block_io(blkif_t goto fail_flush; } + plug_queue(blkif, preq.bdev); + atomic_set(&pending_req->pendcnt, 1); + blkif_get(blkif); + for (i = 0; i < nseg; i++) { if (((int)preq.sector_number|(int)seg[i].nsec) & ((bdev_hardsect_size(preq.bdev) >> 9) - 1)) { @@ -490,7 +494,12 @@ static void dispatch_rw_block_io(blkif_t virt_to_page(vaddr(pending_req, i)), seg[i].nsec << 9, seg[i].buf & ~PAGE_MASK) == 0)) { - bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, nseg-i); + if (bio) { + atomic_inc(&pending_req->pendcnt); + submit_bio(operation, bio); + } + + bio = bio_alloc(GFP_KERNEL, nseg-i); if (unlikely(bio == NULL)) goto fail_put_bio; @@ -505,7 +514,7 @@ static void dispatch_rw_block_io(blkif_t if (!bio) { BUG_ON(operation != WRITE_BARRIER); - bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, 0); + bio = bio_alloc(GFP_KERNEL, 0); if (unlikely(bio == NULL)) goto fail_put_bio; @@ -515,12 +524,7 @@ static void dispatch_rw_block_io(blkif_t bio->bi_sector = -1; } - plug_queue(blkif, bio); - atomic_set(&pending_req->pendcnt, nbio); - blkif_get(blkif); - - for (i = 0; i < nbio; i++) - submit_bio(operation, biolist[i]); + submit_bio(operation, bio); if (operation == READ) blkif->st_rd_sect += preq.nr_sects; @@ -529,16 +533,22 @@ static void dispatch_rw_block_io(blkif_t return; - fail_put_bio: - for (i = 0; i < (nbio-1); i++) - bio_put(biolist[i]); fail_flush: fast_flush_area(pending_req); fail_response: make_response(blkif, req->id, req->operation, BLKIF_RSP_ERROR); free_req(pending_req); msleep(1); /* back off a bit */ -} + return; + + fail_put_bio: + __end_block_io_op(pending_req, -EINVAL); + if (bio) + bio_put(bio); + unplug_queue(blkif); + msleep(1); /* back off a bit */ + return; +} _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu Nov 06 07:39:57 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Thu, 06 Nov 2008 07:39:57 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Ky6xh-000620-MK; Thu, 06 Nov 2008 07:39:57 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1Ky6xa-0005xq-9g for xen-changelog@lists.xensource.com; Thu, 06 Nov 2008 07:39:50 -0800 X-ASG-Debug-ID: 1225985988-02bd00000000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id DDEB6DDC46 for ; Thu, 6 Nov 2008 07:39:48 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id dpxABofuJZXSyHx0 for ; Thu, 06 Nov 2008 07:39:48 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2577555 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,558,1220241600"; d="scan'208";a="2577555" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 Nov 2008 10:39:47 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA6FdkCJ007355 for ; Thu, 6 Nov 2008 07:39:46 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA6Fe9jZ004190 for ; Thu, 6 Nov 2008 07:40:09 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA6Fe9HU004189 for xen-changelog@lists.xensource.com; Thu, 6 Nov 2008 07:40:09 -0800 Message-Id: <200811061540.mA6Fe9HU004189@xenbits.xensource.com> Date: Thu, 06 Nov 2008 07:40:08 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] prevent invalid or unsupportable PIRQs from being used (v2) X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1225985988 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9617 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] prevent invalid or unsupportable PIRQs from being used (v2) X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225899835 0 # Node ID 0729cb8b1292c9168db0b8e3f2251fd0a9d531b8 # Parent 65ef40020d28e74177a0c21023509007097726a2 prevent invalid or unsupportable PIRQs from being used (v2) By keeping the respective irq_desc[] entries pointing to no_irq_type, setup_irq() (and thus request_irq()) will fail for such IRQs. This matches native behavior, which also only installs ioapic_*_type out of ioapic_register_intr(). At the same time, make assign_irq_vector() fail not only when Xen doesn't support the PIRQ, but also if the IRQ requested doesn't fall in the kernel's PIRQ space. Signed-off-by: Jan Beulich --- arch/i386/kernel/io_apic-xen.c | 3 arch/x86_64/kernel/io_apic-xen.c | 3 drivers/xen/core/evtchn.c | 583 +++++++++++++++++++-------------------- 3 files changed, 296 insertions(+), 293 deletions(-) diff -r 65ef40020d28 -r 0729cb8b1292 arch/i386/kernel/io_apic-xen.c --- a/arch/i386/kernel/io_apic-xen.c Wed Nov 05 14:51:34 2008 +0000 +++ b/arch/i386/kernel/io_apic-xen.c Wed Nov 05 15:43:55 2008 +0000 @@ -1216,6 +1216,9 @@ int assign_irq_vector(int irq) BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); + if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS) + return -EINVAL; + spin_lock_irqsave(&vector_lock, flags); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { diff -r 65ef40020d28 -r 0729cb8b1292 arch/x86_64/kernel/io_apic-xen.c --- a/arch/x86_64/kernel/io_apic-xen.c Wed Nov 05 14:51:34 2008 +0000 +++ b/arch/x86_64/kernel/io_apic-xen.c Wed Nov 05 15:43:55 2008 +0000 @@ -895,6 +895,9 @@ int assign_irq_vector(int irq) BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); + if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS) + return -EINVAL; + spin_lock_irqsave(&vector_lock, flags); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { diff -r 65ef40020d28 -r 0729cb8b1292 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Wed Nov 05 14:51:34 2008 +0000 +++ b/drivers/xen/core/evtchn.c Wed Nov 05 15:43:55 2008 +0000 @@ -756,18 +756,281 @@ static struct hw_interrupt_type dynirq_t .retrigger = resend_irq_on_evtchn, }; -void evtchn_register_pirq(int irq) -{ - struct irq_desc *desc; - unsigned long flags; - - irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0); - - /* Cannot call set_irq_probe(), as that's marked __init. */ - desc = irq_desc + irq; - spin_lock_irqsave(&desc->lock, flags); - desc->status &= ~IRQ_NOPROBE; - spin_unlock_irqrestore(&desc->lock, flags); +static inline void pirq_unmask_notify(int irq) +{ + struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; + if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) + VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); +} + +static inline void pirq_query_unmask(int irq) +{ + struct physdev_irq_status_query irq_status; + irq_status.irq = evtchn_get_xen_pirq(irq); + if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) + irq_status.flags = 0; + clear_bit(irq - PIRQ_BASE, pirq_needs_eoi); + if (irq_status.flags & XENIRQSTAT_needs_eoi) + set_bit(irq - PIRQ_BASE, pirq_needs_eoi); +} + +/* + * On startup, if there is no action associated with the IRQ then we are + * probing. In this case we should not share with others as it will confuse us. + */ +#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL) + +static unsigned int startup_pirq(unsigned int irq) +{ + struct evtchn_bind_pirq bind_pirq; + int evtchn = evtchn_from_irq(irq); + + if (VALID_EVTCHN(evtchn)) + goto out; + + bind_pirq.pirq = evtchn_get_xen_pirq(irq); + /* NB. We are happy to share unless we are probing. */ + bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { + if (!probing_irq(irq)) + printk(KERN_INFO "Failed to obtain physical IRQ %d\n", + irq); + return 0; + } + evtchn = bind_pirq.port; + + pirq_query_unmask(irq); + + evtchn_to_irq[evtchn] = irq; + bind_evtchn_to_cpu(evtchn, 0); + irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); + + out: + unmask_evtchn(evtchn); + pirq_unmask_notify(irq); + + return 0; +} + +static void shutdown_pirq(unsigned int irq) +{ + struct evtchn_close close; + int evtchn = evtchn_from_irq(irq); + + if (!VALID_EVTCHN(evtchn)) + return; + + mask_evtchn(evtchn); + + close.port = evtchn; + if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) + BUG(); + + bind_evtchn_to_cpu(evtchn, 0); + evtchn_to_irq[evtchn] = -1; + irq_info[irq] = mk_irq_info(IRQT_PIRQ, index_from_irq(irq), 0); +} + +static void enable_pirq(unsigned int irq) +{ + startup_pirq(irq); +} + +static void disable_pirq(unsigned int irq) +{ +} + +static void ack_pirq(unsigned int irq) +{ + int evtchn = evtchn_from_irq(irq); + + move_native_irq(irq); + + if (VALID_EVTCHN(evtchn)) { + mask_evtchn(evtchn); + clear_evtchn(evtchn); + } +} + +static void end_pirq(unsigned int irq) +{ + int evtchn = evtchn_from_irq(irq); + + if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == + (IRQ_DISABLED|IRQ_PENDING)) { + shutdown_pirq(irq); + } else if (VALID_EVTCHN(evtchn)) { + unmask_evtchn(evtchn); + pirq_unmask_notify(irq); + } +} + +static struct hw_interrupt_type pirq_type = { + .typename = "Phys-irq", + .startup = startup_pirq, + .shutdown = shutdown_pirq, + .enable = enable_pirq, + .disable = disable_pirq, + .ack = ack_pirq, + .end = end_pirq, +#ifdef CONFIG_SMP + .set_affinity = set_affinity_irq, +#endif + .retrigger = resend_irq_on_evtchn, +}; + +int irq_ignore_unhandled(unsigned int irq) +{ + struct physdev_irq_status_query irq_status = { .irq = irq }; + + if (!is_running_on_xen()) + return 0; + + if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) + return 0; + return !!(irq_status.flags & XENIRQSTAT_shared); +} + +void notify_remote_via_irq(int irq) +{ + int evtchn = evtchn_from_irq(irq); + + if (VALID_EVTCHN(evtchn)) + notify_remote_via_evtchn(evtchn); +} +EXPORT_SYMBOL_GPL(notify_remote_via_irq); + +int irq_to_evtchn_port(int irq) +{ + return evtchn_from_irq(irq); +} +EXPORT_SYMBOL_GPL(irq_to_evtchn_port); + +void mask_evtchn(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + synch_set_bit(port, s->evtchn_mask); +} +EXPORT_SYMBOL_GPL(mask_evtchn); + +void unmask_evtchn(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + unsigned int cpu = smp_processor_id(); + vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; + + BUG_ON(!irqs_disabled()); + + /* Slow path (hypercall) if this is a non-local port. */ + if (unlikely(cpu != cpu_from_evtchn(port))) { + struct evtchn_unmask unmask = { .port = port }; + VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask)); + return; + } + + synch_clear_bit(port, s->evtchn_mask); + + /* Did we miss an interrupt 'edge'? Re-fire if so. */ + if (synch_test_bit(port, s->evtchn_pending) && + !synch_test_and_set_bit(port / BITS_PER_LONG, + &vcpu_info->evtchn_pending_sel)) + vcpu_info->evtchn_upcall_pending = 1; +} +EXPORT_SYMBOL_GPL(unmask_evtchn); + +void disable_all_local_evtchn(void) +{ + unsigned i, cpu = smp_processor_id(); + shared_info_t *s = HYPERVISOR_shared_info; + + for (i = 0; i < NR_EVENT_CHANNELS; ++i) + if (cpu_from_evtchn(i) == cpu) + synch_set_bit(i, &s->evtchn_mask[0]); +} + +static void restore_cpu_virqs(unsigned int cpu) +{ + struct evtchn_bind_virq bind_virq; + int virq, irq, evtchn; + + for (virq = 0; virq < NR_VIRQS; virq++) { + if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) + continue; + + BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0)); + + /* Get a new binding from Xen. */ + bind_virq.virq = virq; + bind_virq.vcpu = cpu; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, + &bind_virq) != 0) + BUG(); + evtchn = bind_virq.port; + + /* Record the new mapping. */ + evtchn_to_irq[evtchn] = irq; + irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn); + bind_evtchn_to_cpu(evtchn, cpu); + + /* Ready for use. */ + unmask_evtchn(evtchn); + } +} + +static void restore_cpu_ipis(unsigned int cpu) +{ + struct evtchn_bind_ipi bind_ipi; + int ipi, irq, evtchn; + + for (ipi = 0; ipi < NR_IPIS; ipi++) { + if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) + continue; + + BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0)); + + /* Get a new binding from Xen. */ + bind_ipi.vcpu = cpu; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, + &bind_ipi) != 0) + BUG(); + evtchn = bind_ipi.port; + + /* Record the new mapping. */ + evtchn_to_irq[evtchn] = irq; + irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn); + bind_evtchn_to_cpu(evtchn, cpu); + + /* Ready for use. */ + unmask_evtchn(evtchn); + + } +} + +void irq_resume(void) +{ + unsigned int cpu, irq, evtchn; + + init_evtchn_cpu_bindings(); + + /* New event-channel space is not 'live' yet. */ + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) + mask_evtchn(evtchn); + + /* Check that no PIRQs are still bound. */ + for (irq = PIRQ_BASE; irq < (PIRQ_BASE + NR_PIRQS); irq++) + BUG_ON(irq_info[irq] != IRQ_UNBOUND); + + /* No IRQ <-> event-channel mappings. */ + for (irq = 0; irq < NR_IRQS; irq++) + irq_info[irq] &= ~((1U << _EVTCHN_BITS) - 1); + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) + evtchn_to_irq[evtchn] = -1; + + for_each_possible_cpu(cpu) { + restore_cpu_virqs(cpu); + restore_cpu_ipis(cpu); + } + } #if defined(CONFIG_X86_IO_APIC) @@ -777,6 +1040,15 @@ void evtchn_register_pirq(int irq) #else #define identity_mapped_irq(irq) (1) #endif + +void evtchn_register_pirq(int irq) +{ + BUG_ON(irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS); + if (identity_mapped_irq(irq)) + return; + irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0); + irq_desc[irq].chip = &pirq_type; +} int evtchn_map_pirq(int irq, int xen_pirq) { @@ -798,9 +1070,11 @@ int evtchn_map_pirq(int irq, int xen_pir spin_unlock(&irq_alloc_lock); if (irq < PIRQ_BASE) return -ENOSPC; + irq_desc[irq].chip = &pirq_type; } else if (!xen_pirq) { if (unlikely(type_from_irq(irq) != IRQT_PIRQ)) return -EINVAL; + irq_desc[irq].chip = &no_irq_type; irq_info[irq] = IRQ_UNBOUND; return 0; } else if (type_from_irq(irq) != IRQT_PIRQ @@ -821,283 +1095,6 @@ int evtchn_get_xen_pirq(int irq) return index_from_irq(irq); } -static inline void pirq_unmask_notify(int irq) -{ - struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; - if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) - VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); -} - -static inline void pirq_query_unmask(int irq) -{ - struct physdev_irq_status_query irq_status; - irq_status.irq = evtchn_get_xen_pirq(irq); - if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) - irq_status.flags = 0; - clear_bit(irq - PIRQ_BASE, pirq_needs_eoi); - if (irq_status.flags & XENIRQSTAT_needs_eoi) - set_bit(irq - PIRQ_BASE, pirq_needs_eoi); -} - -/* - * On startup, if there is no action associated with the IRQ then we are - * probing. In this case we should not share with others as it will confuse us. - */ -#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL) - -static unsigned int startup_pirq(unsigned int irq) -{ - struct evtchn_bind_pirq bind_pirq; - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn)) - goto out; - - bind_pirq.pirq = evtchn_get_xen_pirq(irq); - /* NB. We are happy to share unless we are probing. */ - bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { - if (!probing_irq(irq)) - printk(KERN_INFO "Failed to obtain physical IRQ %d\n", - irq); - return 0; - } - evtchn = bind_pirq.port; - - pirq_query_unmask(irq); - - evtchn_to_irq[evtchn] = irq; - bind_evtchn_to_cpu(evtchn, 0); - irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); - - out: - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - - return 0; -} - -static void shutdown_pirq(unsigned int irq) -{ - struct evtchn_close close; - int evtchn = evtchn_from_irq(irq); - - if (!VALID_EVTCHN(evtchn)) - return; - - mask_evtchn(evtchn); - - close.port = evtchn; - if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) - BUG(); - - bind_evtchn_to_cpu(evtchn, 0); - evtchn_to_irq[evtchn] = -1; - irq_info[irq] = mk_irq_info(IRQT_PIRQ, index_from_irq(irq), 0); -} - -static void enable_pirq(unsigned int irq) -{ - startup_pirq(irq); -} - -static void disable_pirq(unsigned int irq) -{ -} - -static void ack_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - move_native_irq(irq); - - if (VALID_EVTCHN(evtchn)) { - mask_evtchn(evtchn); - clear_evtchn(evtchn); - } -} - -static void end_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == - (IRQ_DISABLED|IRQ_PENDING)) { - shutdown_pirq(irq); - } else if (VALID_EVTCHN(evtchn)) { - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - } -} - -static struct hw_interrupt_type pirq_type = { - .typename = "Phys-irq", - .startup = startup_pirq, - .shutdown = shutdown_pirq, - .enable = enable_pirq, - .disable = disable_pirq, - .ack = ack_pirq, - .end = end_pirq, -#ifdef CONFIG_SMP - .set_affinity = set_affinity_irq, -#endif - .retrigger = resend_irq_on_evtchn, -}; - -int irq_ignore_unhandled(unsigned int irq) -{ - struct physdev_irq_status_query irq_status = { .irq = irq }; - - if (!is_running_on_xen()) - return 0; - - if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) - return 0; - return !!(irq_status.flags & XENIRQSTAT_shared); -} - -void notify_remote_via_irq(int irq) -{ - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn)) - notify_remote_via_evtchn(evtchn); -} -EXPORT_SYMBOL_GPL(notify_remote_via_irq); - -int irq_to_evtchn_port(int irq) -{ - return evtchn_from_irq(irq); -} -EXPORT_SYMBOL_GPL(irq_to_evtchn_port); - -void mask_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - synch_set_bit(port, s->evtchn_mask); -} -EXPORT_SYMBOL_GPL(mask_evtchn); - -void unmask_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - unsigned int cpu = smp_processor_id(); - vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; - - BUG_ON(!irqs_disabled()); - - /* Slow path (hypercall) if this is a non-local port. */ - if (unlikely(cpu != cpu_from_evtchn(port))) { - struct evtchn_unmask unmask = { .port = port }; - VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask)); - return; - } - - synch_clear_bit(port, s->evtchn_mask); - - /* Did we miss an interrupt 'edge'? Re-fire if so. */ - if (synch_test_bit(port, s->evtchn_pending) && - !synch_test_and_set_bit(port / BITS_PER_LONG, - &vcpu_info->evtchn_pending_sel)) - vcpu_info->evtchn_upcall_pending = 1; -} -EXPORT_SYMBOL_GPL(unmask_evtchn); - -void disable_all_local_evtchn(void) -{ - unsigned i, cpu = smp_processor_id(); - shared_info_t *s = HYPERVISOR_shared_info; - - for (i = 0; i < NR_EVENT_CHANNELS; ++i) - if (cpu_from_evtchn(i) == cpu) - synch_set_bit(i, &s->evtchn_mask[0]); -} - -static void restore_cpu_virqs(unsigned int cpu) -{ - struct evtchn_bind_virq bind_virq; - int virq, irq, evtchn; - - for (virq = 0; virq < NR_VIRQS; virq++) { - if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) - continue; - - BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0)); - - /* Get a new binding from Xen. */ - bind_virq.virq = virq; - bind_virq.vcpu = cpu; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, - &bind_virq) != 0) - BUG(); - evtchn = bind_virq.port; - - /* Record the new mapping. */ - evtchn_to_irq[evtchn] = irq; - irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn); - bind_evtchn_to_cpu(evtchn, cpu); - - /* Ready for use. */ - unmask_evtchn(evtchn); - } -} - -static void restore_cpu_ipis(unsigned int cpu) -{ - struct evtchn_bind_ipi bind_ipi; - int ipi, irq, evtchn; - - for (ipi = 0; ipi < NR_IPIS; ipi++) { - if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) - continue; - - BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0)); - - /* Get a new binding from Xen. */ - bind_ipi.vcpu = cpu; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, - &bind_ipi) != 0) - BUG(); - evtchn = bind_ipi.port; - - /* Record the new mapping. */ - evtchn_to_irq[evtchn] = irq; - irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn); - bind_evtchn_to_cpu(evtchn, cpu); - - /* Ready for use. */ - unmask_evtchn(evtchn); - - } -} - -void irq_resume(void) -{ - unsigned int cpu, irq, evtchn; - - init_evtchn_cpu_bindings(); - - /* New event-channel space is not 'live' yet. */ - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) - mask_evtchn(evtchn); - - /* Check that no PIRQs are still bound. */ - for (irq = PIRQ_BASE; irq < (PIRQ_BASE + NR_PIRQS); irq++) - BUG_ON(irq_info[irq] != IRQ_UNBOUND); - - /* No IRQ <-> event-channel mappings. */ - for (irq = 0; irq < NR_IRQS; irq++) - irq_info[irq] &= ~((1U << _EVTCHN_BITS) - 1); - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) - evtchn_to_irq[evtchn] = -1; - - for_each_possible_cpu(cpu) { - restore_cpu_virqs(cpu); - restore_cpu_ipis(cpu); - } - -} - void __init xen_init_IRQ(void) { unsigned int i; @@ -1126,16 +1123,16 @@ void __init xen_init_IRQ(void) for (i = PIRQ_BASE; i < (PIRQ_BASE + NR_PIRQS); i++) { irq_bindcount[i] = 1; + if (!identity_mapped_irq(i)) + continue; + #ifdef RTC_IRQ /* If not domain 0, force our RTC driver to fail its probe. */ - if (identity_mapped_irq(i) && ((i - PIRQ_BASE) == RTC_IRQ) - && !is_initial_xendomain()) + if (i - PIRQ_BASE == RTC_IRQ && !is_initial_xendomain()) continue; #endif irq_desc[i].status = IRQ_DISABLED; - if (!identity_mapped_irq(i)) - irq_desc[i].status |= IRQ_NOPROBE; irq_desc[i].action = NULL; irq_desc[i].depth = 1; irq_desc[i].chip = &pirq_type; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu Nov 06 12:20:14 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Thu, 06 Nov 2008 12:20:14 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KyBKw-00082y-2F; Thu, 06 Nov 2008 12:20:14 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KyBKt-00082Y-WC for xen-changelog@lists.xensource.com; Thu, 06 Nov 2008 12:20:12 -0800 X-ASG-Debug-ID: 1226002810-2be200060000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 5FF0EDD2D3 for ; Thu, 6 Nov 2008 12:20:11 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 9oH3LCuaqIdmuGWX for ; Thu, 06 Nov 2008 12:20:11 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2581101 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,559,1220241600"; d="scan'208";a="2581101" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 Nov 2008 15:20:10 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA6KK9Ds007574 for ; Thu, 6 Nov 2008 12:20:09 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA6KKWFJ021101 for ; Thu, 6 Nov 2008 12:20:33 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA6KKW79021100 for xen-changelog@lists.xensource.com; Thu, 6 Nov 2008 12:20:32 -0800 Message-Id: <200811062020.mA6KKW79021100@xenbits.xensource.com> Date: Thu, 06 Nov 2008 12:20:30 -0800 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-3.2-testing] x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1226002811 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9630 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-3.2-testing] x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225804463 0 # Node ID 5de7bd81da986100cfbc9244563580f928d997b5 # Parent 31ee8af9b515bfe85c20f74804c0198277aa648e x86: relax restrictions on reserved bits in L3 for 32on64 x86 guests A 32on64 guest cannot copy an existing pinned L3 entry to use as a new L3 because COMPAT_L3_DISALLOW_MASK contains bits which are added to L3 entries by adjust_guest_l3e (U/S & R/W) or by the hardware (A & D). Signed-off-by: Ian Campbell xen-unstable changeset: 18714:3ff349c7aeb77a0a66a53dd409751e3574a4742b xen-unstable date: Mon Oct 27 10:08:48 2008 +0000 --- xen/include/asm-x86/x86_64/page.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 31ee8af9b515 -r 5de7bd81da98 xen/include/asm-x86/x86_64/page.h --- a/xen/include/asm-x86/x86_64/page.h Tue Oct 21 12:10:34 2008 +0100 +++ b/xen/include/asm-x86/x86_64/page.h Tue Nov 04 13:14:23 2008 +0000 @@ -119,7 +119,7 @@ typedef l4_pgentry_t root_pgentry_t; #define L3_DISALLOW_MASK (BASE_DISALLOW_MASK) #define L4_DISALLOW_MASK (BASE_DISALLOW_MASK) -#define COMPAT_L3_DISALLOW_MASK 0xFFFFF1FEU +#define COMPAT_L3_DISALLOW_MASK 0xFFFFF198U #define PAGE_HYPERVISOR (__PAGE_HYPERVISOR | _PAGE_GLOBAL) #define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu Nov 06 12:20:19 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Thu, 06 Nov 2008 12:20:19 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KyBL1-00086l-BY; Thu, 06 Nov 2008 12:20:19 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KyBKu-00082d-N2 for xen-changelog@lists.xensource.com; Thu, 06 Nov 2008 12:20:12 -0800 X-ASG-Debug-ID: 1226002810-2be200060001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 59AE8DD2D3 for ; Thu, 6 Nov 2008 12:20:12 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id OQXsqBzvYp2216Wi for ; Thu, 06 Nov 2008 12:20:12 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2581103 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,559,1220241600"; d="scan'208";a="2581103" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 Nov 2008 15:20:11 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA6KKBJH007577 for ; Thu, 6 Nov 2008 12:20:11 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA6KKYNd021122 for ; Thu, 6 Nov 2008 12:20:34 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA6KKY1i021120 for xen-changelog@lists.xensource.com; Thu, 6 Nov 2008 12:20:34 -0800 Message-Id: <200811062020.mA6KKY1i021120@xenbits.xensource.com> Date: Thu, 06 Nov 2008 12:20:33 -0800 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-3.2-testing] serial: Fix IRQ enable/disable in tx interrupt handler. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1226002812 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9630 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-3.2-testing] serial: Fix IRQ enable/disable in tx interrupt handler. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225804485 0 # Node ID 9f8ba7a4c8afc21f3ba2978040cdb6537d02bfb3 # Parent 5de7bd81da986100cfbc9244563580f928d997b5 serial: Fix IRQ enable/disable in tx interrupt handler. Signed-off-by: Keir Fraser xen-unstable changeset: 18717:9e47e72fd03ec78378b46aa30633ced686838c6f xen-unstable date: Mon Oct 27 11:27:31 2008 +0000 --- xen/drivers/char/serial.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff -r 5de7bd81da98 -r 9f8ba7a4c8af xen/drivers/char/serial.c --- a/xen/drivers/char/serial.c Tue Nov 04 13:14:23 2008 +0000 +++ b/xen/drivers/char/serial.c Tue Nov 04 13:14:45 2008 +0000 @@ -61,7 +61,7 @@ void serial_tx_interrupt(struct serial_p while ( !spin_trylock(&port->tx_lock) ) { if ( !port->driver->tx_empty(port) ) - return; + goto out; cpu_relax(); } @@ -76,7 +76,10 @@ void serial_tx_interrupt(struct serial_p } } - spin_unlock_irqrestore(&port->tx_lock, flags); + spin_unlock(&port->tx_lock); + + out: + local_irq_restore(flags); } static void __serial_putc(struct serial_port *port, char c) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu Nov 06 12:20:26 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Thu, 06 Nov 2008 12:20:26 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KyBL8-0008B1-96; Thu, 06 Nov 2008 12:20:26 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KyBKw-00083V-Jp for xen-changelog@lists.xensource.com; Thu, 06 Nov 2008 12:20:14 -0800 X-ASG-Debug-ID: 1226002810-2be200060002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 2E0E8DDF61 for ; Thu, 6 Nov 2008 12:20:13 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id myjlpoqLSrsOjBuX for ; Thu, 06 Nov 2008 12:20:13 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2581104 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,559,1220241600"; d="scan'208";a="2581104" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 Nov 2008 15:20:13 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA6KKDrl007580 for ; Thu, 6 Nov 2008 12:20:13 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA6KKaXm021140 for ; Thu, 6 Nov 2008 12:20:36 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA6KKZAl021139 for xen-changelog@lists.xensource.com; Thu, 6 Nov 2008 12:20:35 -0800 Message-Id: <200811062020.mA6KKZAl021139@xenbits.xensource.com> Date: Thu, 06 Nov 2008 12:20:34 -0800 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-3.2-testing] x86: Fix GRANT_PTE_FLAGS. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1226002814 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9630 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-3.2-testing] x86: Fix GRANT_PTE_FLAGS. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225804511 0 # Node ID 2d5d030ea5501e797848d5269cb8801a927bcdc4 # Parent 9f8ba7a4c8afc21f3ba2978040cdb6537d02bfb3 x86: Fix GRANT_PTE_FLAGS. Since page table entries created through e.g. GNTTABOP_map_grant_ref are being passed through adjust_guest_l1e(), they must not generally get _PAGE_USER set - this will be taken care of by adjust_guest_l1e(), and it will ensure that these don't get _PAGE_GLOBAL set inadvertently. Due to the implied security aspect here (_PAGE_GLOBAL getting set on kernel pages for x86-64), I'd like to ask that this also be applied to older maintained branches. At the same time, set _PAGE_NX for pte-s created for grants (as long as hardware supports it), since it should be only data pages that remote domains are being given access to. Signed-off-by: Jan Beulich xen-unstable changeset: 18748:4ec25db9326a7e7f64a8471cbfd7b5852484757c xen-unstable date: Mon Nov 03 10:32:54 2008 +0000 --- xen/include/asm-x86/page.h | 3 +++ xen/include/asm-x86/x86_32/page.h | 3 --- xen/include/asm-x86/x86_64/page.h | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff -r 9f8ba7a4c8af -r 2d5d030ea550 xen/include/asm-x86/page.h --- a/xen/include/asm-x86/page.h Tue Nov 04 13:14:45 2008 +0000 +++ b/xen/include/asm-x86/page.h Tue Nov 04 13:15:11 2008 +0000 @@ -327,6 +327,9 @@ void setup_idle_pagetable(void); #define __PAGE_HYPERVISOR_NOCACHE \ (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED) +#define GRANT_PTE_FLAGS \ + (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_NX | _PAGE_GNTTAB) + #ifndef __ASSEMBLY__ static inline int get_order_from_bytes(paddr_t size) diff -r 9f8ba7a4c8af -r 2d5d030ea550 xen/include/asm-x86/x86_32/page.h --- a/xen/include/asm-x86/x86_32/page.h Tue Nov 04 13:14:45 2008 +0000 +++ b/xen/include/asm-x86/x86_32/page.h Tue Nov 04 13:15:11 2008 +0000 @@ -29,9 +29,6 @@ extern unsigned int PAGE_HYPERVISOR_NOCA extern unsigned int PAGE_HYPERVISOR_NOCACHE; #endif -#define GRANT_PTE_FLAGS \ - (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_GNTTAB) - /* * Disallow unused flag bits plus PAT/PSE, PCD, PWT and GLOBAL. * Permit the NX bit if the hardware supports it. diff -r 9f8ba7a4c8af -r 2d5d030ea550 xen/include/asm-x86/x86_64/page.h --- a/xen/include/asm-x86/x86_64/page.h Tue Nov 04 13:14:45 2008 +0000 +++ b/xen/include/asm-x86/x86_64/page.h Tue Nov 04 13:15:11 2008 +0000 @@ -124,9 +124,6 @@ typedef l4_pgentry_t root_pgentry_t; #define PAGE_HYPERVISOR (__PAGE_HYPERVISOR | _PAGE_GLOBAL) #define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL) -#define GRANT_PTE_FLAGS \ - (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_GNTTAB|_PAGE_USER) - #define USER_MAPPINGS_ARE_GLOBAL #ifdef USER_MAPPINGS_ARE_GLOBAL /* _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri Nov 07 17:09:50 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Fri, 07 Nov 2008 17:09:50 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1KycKj-0004nh-QW; Fri, 07 Nov 2008 17:09:49 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1KycKh-0004nJ-Ok for xen-changelog@lists.xensource.com; Fri, 07 Nov 2008 17:09:47 -0800 X-ASG-Debug-ID: 1226106586-440b00010000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 59DA0DEF95 for ; Fri, 7 Nov 2008 17:09:47 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 6BZxlOTJ4c3djXOZ for ; Fri, 07 Nov 2008 17:09:47 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2598384 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,567,1220241600"; d="scan'208";a="2598384" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 Nov 2008 20:09:46 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mA819kOM010450 for ; Fri, 7 Nov 2008 17:09:46 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mA81A9Io030923 for ; Fri, 7 Nov 2008 17:10:09 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mA81A9Bc030922 for xen-changelog@lists.xensource.com; Fri, 7 Nov 2008 17:10:09 -0800 Message-Id: <200811080110.mA81A9Bc030922@xenbits.xensource.com> Date: Fri, 07 Nov 2008 17:10:08 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] xen: Shouldn't remove device in pci_bus_probe_wrapper() X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1226106587 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.9721 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] xen: Shouldn't remove device in pci_bus_probe_wrapper() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226077460 0 # Node ID d31b6ccf10e41bfc3c1af4b0ff75deb8e2d5b9d8 # Parent 61ab98b5cc0ebf20dd766ec67a84319f058ef6f0 xen: Shouldn't remove device in pci_bus_probe_wrapper() In pci_bus_probe_wrapper(), it adds (assign) a device to dom0 firstly, but if pci_bus_probe() for the device fails (don't have driver), the device will be removed (deassigned) from dom0. For PCIe-to-PCI bridges, they are removed from dom0 when they are hooked by pci_bus_probe_wrapper(). That's to say they are not mapped in VT-d page table. Thus the PCI devices under these bridges cannot work. This situation happens when install pciback module, because pciback will probe these bridges and removed them from dom0. Built-in pciback won't result in this problem due to these bridges (for example 00:1e.0) are probed before their devices (for example 02:00.0). (When map a pci device (02:00.0) to VT-d, it will also map its pcie-to-pci bridge (00:1e.0) to VT-d) So I think should not remove (deassign) devices from dom0 when pci_bus_probe() fails. Each device which can DMA should be mapped in VT-d when VT-d is enabled. But current code make it possible some these devices are not mapped into VT-d. From: Weidong Han Signed-off-by: Keir Fraser --- drivers/xen/core/pci.c | 8 -------- 1 files changed, 8 deletions(-) diff -r 61ab98b5cc0e -r d31b6ccf10e4 drivers/xen/core/pci.c --- a/drivers/xen/core/pci.c Thu Nov 06 10:29:00 2008 +0000 +++ b/drivers/xen/core/pci.c Fri Nov 07 17:04:20 2008 +0000 @@ -23,14 +23,6 @@ static int pci_bus_probe_wrapper(struct return r; r = pci_bus_probe(dev); - if (r) { - int ret; - - ret = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, - &manage_pci); - WARN_ON(ret && ret != -ENOSYS); - } - return r; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From dosypocyaodia@wildmail.com Wed Nov 12 04:15:23 2008 Return-path: Envelope-to: apache@lists.xensource.com Delivery-date: Wed, 12 Nov 2008 04:15:23 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L0Ed1-0002gh-RW for apache@lists.xensource.com; Wed, 12 Nov 2008 04:15:23 -0800 X-ASG-Debug-ID: 1226492106-176100020000-RounwS X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from wildmail.com (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with SMTP id 5C105E22EA; Wed, 12 Nov 2008 04:15:07 -0800 (PST) Received: from wildmail.com (189107029062.user.veloxzone.com.br [189.107.29.62]) by spam.xensource.com with SMTP id v8ejEXpjweKio8E1; Wed, 12 Nov 2008 04:15:07 -0800 (PST) Message-ID: <40E3CD2F.3E2D6D4A@wildmail.com> Date: Wed, 12 Nov 2008 13:51:45 +0100 From: "The First Gaming" To: , , , , , , , , , , , , , , , , , , X-ASG-Orig-Subj: Congratulations! You w@n 300 Euro casi no chips. Ajyfux Subject: Congratulations! You w@n 300 Euro casi no chips. Ajyfux MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original Content-Transfer-Encoding: 7bit X-Barracuda-Connect: 189107029062.user.veloxzone.com.br[189.107.29.62] X-Barracuda-Start-Time: 1226492122 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 1.00 X-Barracuda-Spam-Status: No, SCORE=1.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=PR0N_SUBJECT, RCVD_IN_PBL, STOX_REPLY_TYPE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10082 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.80 RCVD_IN_PBL RBL: Received via a relay in Spamhaus PBL [189.107.29.62 listed in zen.spamhaus.org] 0.00 STOX_REPLY_TYPE STOX_REPLY_TYPE 0.20 PR0N_SUBJECT Subject has letters around special characters (pr0n) Get ready to play and claim your 300 Euros immediately! http://u.teamlifeplaying.net/?xt=6476061 zu ti Cyxiiihae wy urlbaudzj gaipsahet jisuyitp zyuvix. Dywaunmmun p xoro. From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:09:51 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:09:51 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcl-0000R0-3N; Wed, 19 Nov 2008 08:09:51 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pch-0000QJ-Tx for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:47 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 8AB9FE6504 for ; Wed, 19 Nov 2008 08:09:47 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id dwu2S6sc5dbCgwZ9 for ; Wed, 19 Nov 2008 08:09:47 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690512 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690512" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:46 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9kFr004280 for ; Wed, 19 Nov 2008 08:09:46 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGA9ln029433 for ; Wed, 19 Nov 2008 08:10:09 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGA9Up029432 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:09 -0800 Message-Id: <200811191610.mAJGA9Up029432@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:08 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Use gfn_to_mfn() rather than gfn_to_mfn_current() in callers X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110987 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Use gfn_to_mfn() rather than gfn_to_mfn_current() in callers X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225969622 0 # Node ID 3af208e6f85013efd12265892998ca357457b9d7 # Parent 5fd51e1e9c798f18a06a43c4cb83df93ac0698dd x86: Use gfn_to_mfn() rather than gfn_to_mfn_current() in callers which can execute on arbitrary domains. Signed-off-by: Keir Fraser --- xen/arch/x86/mm/hap/guest_walk.c | 2 +- xen/arch/x86/mm/p2m.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff -r 5fd51e1e9c79 -r 3af208e6f850 xen/arch/x86/mm/hap/guest_walk.c --- a/xen/arch/x86/mm/hap/guest_walk.c Wed Nov 05 10:57:21 2008 +0000 +++ b/xen/arch/x86/mm/hap/guest_walk.c Thu Nov 06 11:07:02 2008 +0000 @@ -83,7 +83,7 @@ unsigned long hap_gva_to_gfn(GUEST_PAGIN gpfn = (gcr3 >> PAGE_SHIFT); for ( lev = mode; lev >= 1; lev-- ) { - mfn = mfn_x(gfn_to_mfn_current(gpfn, &p2mt)); + mfn = mfn_x(gfn_to_mfn(v->domain, gpfn, &p2mt)); if ( !p2m_is_ram(p2mt) ) { HAP_PRINTK("bad pfn=0x%lx from gva=0x%lx at lev%d\n", gpfn, gva, diff -r 5fd51e1e9c79 -r 3af208e6f850 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Wed Nov 05 10:57:21 2008 +0000 +++ b/xen/arch/x86/mm/p2m.c Thu Nov 06 11:07:02 2008 +0000 @@ -748,7 +748,7 @@ static void audit_p2m(struct domain *d) if ( test_linear && (gfn <= d->arch.p2m->max_mapped_pfn) ) { - lp2mfn = mfn_x(gfn_to_mfn_current(gfn, &type)); + lp2mfn = mfn_x(gfn_to_mfn(d, gfn, &type)); if ( lp2mfn != mfn_x(p2mfn) ) { P2M_PRINTK("linear mismatch gfn %#lx -> mfn %#lx " _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:09:58 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:09:58 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcs-0000VS-Ko; Wed, 19 Nov 2008 08:09:58 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pci-0000QQ-Hx for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:48 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 3B350E6509 for ; Wed, 19 Nov 2008 08:09:47 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id R2cI3uZwO9uA35Co for ; Wed, 19 Nov 2008 08:09:47 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690513 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690513" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:47 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9lGx004283 for ; Wed, 19 Nov 2008 08:09:47 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAAli029450 for ; Wed, 19 Nov 2008 08:10:10 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAA4I029449 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:10 -0800 Message-Id: <200811191610.mAJGAA4I029449@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:09 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Fix an inverted flags conversion in map_page_to_xen() X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110988 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Fix an inverted flags conversion in map_page_to_xen() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225972091 0 # Node ID 6b6610c115fc4b0ae75fbbd768e3b01c81152c5f # Parent 3af208e6f85013efd12265892998ca357457b9d7 x86: Fix an inverted flags conversion in map_page_to_xen() Signed-off-by: Jan Beulich --- xen/arch/x86/mm.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 3af208e6f850 -r 6b6610c115fc xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu Nov 06 11:07:02 2008 +0000 +++ b/xen/arch/x86/mm.c Thu Nov 06 11:48:11 2008 +0000 @@ -4294,7 +4294,7 @@ int map_pages_to_xen( { if ( l3e_get_flags(ol3e) & _PAGE_GLOBAL ) flush_flags |= FLUSH_TLB_GLOBAL; - if ( (l1f_to_lNf(l3e_get_flags(ol3e)) ^ flags) & + if ( (lNf_to_l1f(l3e_get_flags(ol3e)) ^ flags) & PAGE_CACHE_ATTRS ) flush_flags |= FLUSH_CACHE; flush_area(virt, flush_flags); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:10:06 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:10:06 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcz-0000a0-RK; Wed, 19 Nov 2008 08:10:05 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcj-0000QW-JF for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:49 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 424FEE650B for ; Wed, 19 Nov 2008 08:09:48 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id tLU2DXGYFvKYSJIk for ; Wed, 19 Nov 2008 08:09:48 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690514 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690514" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:48 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9mRD004286 for ; Wed, 19 Nov 2008 08:09:48 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGABLW029468 for ; Wed, 19 Nov 2008 08:10:11 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGABq6029467 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:11 -0800 Message-Id: <200811191610.mAJGABq6029467@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:10 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, hvm: Better MTRR type check. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110989 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, hvm: Better MTRR type check. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1225972221 0 # Node ID 3450cb9706acc2a1aa55316cb3e1474b57172419 # Parent 6b6610c115fc4b0ae75fbbd768e3b01c81152c5f x86, hvm: Better MTRR type check. From: Disheng Su Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/mtrr.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) diff -r 6b6610c115fc -r 3450cb9706ac xen/arch/x86/hvm/mtrr.c --- a/xen/arch/x86/hvm/mtrr.c Thu Nov 06 11:48:11 2008 +0000 +++ b/xen/arch/x86/hvm/mtrr.c Thu Nov 06 11:50:21 2008 +0000 @@ -392,7 +392,10 @@ uint32_t get_pat_flags(struct vcpu *v, */ if ( pat_entry_value == INVALID_MEM_TYPE ) { - if (mfn_valid(paddr_to_pfn(spaddr))) + struct domain *d = v->domain; + p2m_type_t p2mt; + gfn_to_mfn(d, paddr_to_pfn(gpaddr), &p2mt); + if (p2m_is_ram(p2mt)) gdprintk(XENLOG_WARNING, "Conflict occurs for a given guest l1e flags:%x " "at %"PRIx64" (the effective mm type:%d), " _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:10:12 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:10:12 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pd6-0000e5-92; Wed, 19 Nov 2008 08:10:12 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pck-0000Qz-IF for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:50 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 39662E650F for ; Wed, 19 Nov 2008 08:09:49 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id pbWqhiQYyancxBzx for ; Wed, 19 Nov 2008 08:09:49 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690515 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690515" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:49 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9nU0004289 for ; Wed, 19 Nov 2008 08:09:49 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGACH4029485 for ; Wed, 19 Nov 2008 08:10:12 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGACe8029484 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:12 -0800 Message-Id: <200811191610.mAJGACe8029484@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:11 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xenpm: Fix an error path. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110990 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] xenpm: Fix an error path. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226077239 0 # Node ID 256067cbf5b30d07e856f8a4b97fae506b2f3c60 # Parent 3450cb9706acc2a1aa55316cb3e1474b57172419 xenpm: Fix an error path. Signed-off-by: Jinsong Liu --- tools/misc/xenpm.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 3450cb9706ac -r 256067cbf5b3 tools/misc/xenpm.c --- a/tools/misc/xenpm.c Thu Nov 06 11:50:21 2008 +0000 +++ b/tools/misc/xenpm.c Fri Nov 07 17:00:39 2008 +0000 @@ -170,7 +170,7 @@ int main(int argc, char **argv) if ( !pxstat->pt ) { fprintf(stderr, "failed to malloc for P-states table\n"); - free(pxstat->pt); + free(pxstat->trans_pt); break; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:10:20 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:10:20 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdE-0000ix-FG; Wed, 19 Nov 2008 08:10:20 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcl-0000RZ-HN for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:51 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050004-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 2C6B6E6511 for ; Wed, 19 Nov 2008 08:09:50 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id vbJbTG4MPoKv1Hy1 for ; Wed, 19 Nov 2008 08:09:50 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690516 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690516" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:50 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9oda004292 for ; Wed, 19 Nov 2008 08:09:50 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGADtP029502 for ; Wed, 19 Nov 2008 08:10:13 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGADWk029501 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:13 -0800 Message-Id: <200811191610.mAJGADWk029501@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:12 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, vmx realmode: Stack manipulation on interrupt/exception injection X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110991 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, vmx realmode: Stack manipulation on interrupt/exception injection X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226077581 0 # Node ID 832efb028a1dc72fb52edc11c958fd19f8542e48 # Parent 256067cbf5b30d07e856f8a4b97fae506b2f3c60 x86, vmx realmode: Stack manipulation on interrupt/exception injection should respect SS size, not CS size. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vmx/realmode.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 256067cbf5b3 -r 832efb028a1d xen/arch/x86/hvm/vmx/realmode.c --- a/xen/arch/x86/hvm/vmx/realmode.c Fri Nov 07 17:00:39 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/realmode.c Fri Nov 07 17:06:21 2008 +0000 @@ -69,7 +69,7 @@ static void realmode_deliver_exception( frame[1] = csr->sel; frame[2] = regs->eflags & ~X86_EFLAGS_RF; - if ( hvmemul_ctxt->ctxt.addr_size == 32 ) + if ( hvmemul_ctxt->ctxt.sp_size == 32 ) { regs->esp -= 6; pstk = regs->esp; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:10:29 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:10:29 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdM-0000nS-JH; Wed, 19 Nov 2008 08:10:28 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcm-0000SA-Jt for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:52 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050005-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 21C06E6514 for ; Wed, 19 Nov 2008 08:09:51 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id PeozGRRCJlxtDU0Y for ; Wed, 19 Nov 2008 08:09:51 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690517 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690517" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:51 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9pOx004295 for ; Wed, 19 Nov 2008 08:09:51 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAETg029519 for ; Wed, 19 Nov 2008 08:10:14 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAEBH029518 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:14 -0800 Message-Id: <200811191610.mAJGAEBH029518@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:13 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] vtd: fix interrupt remapping to handle SMI RTE's with uninitialized X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110992 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] vtd: fix interrupt remapping to handle SMI RTE's with uninitialized X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226313701 0 # Node ID 40668908260c7667cc5a0b75862352016c52e38f # Parent 832efb028a1dc72fb52edc11c958fd19f8542e48 vtd: fix interrupt remapping to handle SMI RTE's with uninitialized reserved fields Some BIOS does not zero out reserve fields in IOAPIC RTE's. clear_IO_APIC() zeroes out all RTE's except for RTE with MSI delivery type. This is a problem when the host OS converts SMI delivery type to some other type but leaving the reserved field uninitialized. This can cause interrupt remapping table out of bound error if "format" field is 1 and the uninitialized "index" field has a value that that is larger than the maximum index of interrupt remapping table. Signed-off-by: Allen Kay = --- xen/drivers/passthrough/vtd/dmar.c | 4 +++- xen/drivers/passthrough/vtd/intremap.c | 27 ++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff -r 832efb028a1d -r 40668908260c xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Fri Nov 07 17:06:21 2008 +0000 +++ b/xen/drivers/passthrough/vtd/dmar.c Mon Nov 10 10:41:41 2008 +0000 @@ -351,7 +351,9 @@ acpi_parse_one_rmrr(struct acpi_dmar_ent if ( rmrr->base_address >= rmrr->end_address ) { - dprintk(XENLOG_ERR VTDPREFIX, "RMRR is incorrect.\n"); + dprintk(XENLOG_ERR VTDPREFIX, + "RMRR error: base_addr %"PRIx64" end_address %"PRIx64"\n", + rmrr->base_address, rmrr->end_address); return -EFAULT; } diff -r 832efb028a1d -r 40668908260c xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Fri Nov 07 17:06:21 2008 +0000 +++ b/xen/drivers/passthrough/vtd/intremap.c Mon Nov 10 10:41:41 2008 +0000 @@ -207,7 +207,7 @@ unsigned int io_apic_read_remap_rte( remap_rte = (struct IO_APIC_route_remap_entry *) &old_rte; - if ( remap_rte->format == 0 ) + if ( (remap_rte->format == 0) || (old_rte.delivery_mode == dest_SMI) ) { *IO_APIC_BASE(apic) = rte_upper ? (reg + 1) : reg; return *(IO_APIC_BASE(apic)+4); @@ -252,6 +252,31 @@ void io_apic_write_remap_rte( *(((u32 *)&old_rte) + 1) = *(IO_APIC_BASE(apic)+4); remap_rte = (struct IO_APIC_route_remap_entry *) &old_rte; + + if ( old_rte.delivery_mode == dest_SMI ) + { + /* Some BIOS does not zero out reserve fields in IOAPIC + * RTE's. clear_IO_APIC() zeroes out all RTE's except for RTE + * with MSI delivery type. This is a problem when the host + * OS converts SMI delivery type to some other type but leaving + * the reserved field uninitialized. This can cause interrupt + * remapping table out of bound error if "format" field is 1 + * and the "index" field has a value that that is larger than + * the maximum index of interrupt remapping table. + */ + if ( remap_rte->format == 1 ) + { + remap_rte->format = 0; + *IO_APIC_BASE(apic) = reg; + *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+0); + *IO_APIC_BASE(apic) = reg + 1; + *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+1); + } + + *IO_APIC_BASE(apic) = rte_upper ? (reg + 1) : reg; + *(IO_APIC_BASE(apic)+4) = value; + return; + } /* mask the interrupt while we change the intremap table */ saved_mask = remap_rte->mask; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:10:36 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:10:36 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdU-0000ra-0J; Wed, 19 Nov 2008 08:10:36 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcn-0000Sx-Q1 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:53 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050006-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 42E19E6514 for ; Wed, 19 Nov 2008 08:09:52 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id ASlkA8fErdEzlVkT for ; Wed, 19 Nov 2008 08:09:52 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690518 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690518" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:52 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9qSU004298 for ; Wed, 19 Nov 2008 08:09:52 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAFOJ029536 for ; Wed, 19 Nov 2008 08:10:15 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAFgr029535 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:15 -0800 Message-Id: <200811191610.mAJGAFgr029535@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:14 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] minios: add a barebone net/if.h X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110993 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] minios: add a barebone net/if.h X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226401438 0 # Node ID beade55d67fc2c81adaaa552804e0b66dc25becb # Parent 40668908260c7667cc5a0b75862352016c52e38f minios: add a barebone net/if.h net/if.h is a standard header but unfortunately lwip doesn't provide it for any target but linux. Therefore I am adding a net/if.h, with an empty implementation of the declared functions. Signed-off-by: Stefano Stabellini --- extras/mini-os/include/posix/net/if.h | 85 ++++++++++++++++++++++++++++++++++ extras/mini-os/lib/sys.c | 7 ++ 2 files changed, 92 insertions(+) diff -r 40668908260c -r beade55d67fc extras/mini-os/include/posix/net/if.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extras/mini-os/include/posix/net/if.h Tue Nov 11 11:03:58 2008 +0000 @@ -0,0 +1,85 @@ +/* + * This code is mostly taken from NetBSD net/if.h + * Changes: Stefano Stabellini + * + ****************************************************************************** + * + * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by William Studenmund and Jason R. Thorpe. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifndef _NET_IF_H_ +#define _NET_IF_H_ + +/* + * Length of interface external name, including terminating '\0'. + * Note: this is the same size as a generic device's external name. + */ +#define IF_NAMESIZE 16 + +struct if_nameindex { + unsigned int if_index; /* 1, 2, ... */ + char *if_name; /* null terminated name: "le0", ... */ +}; + +unsigned int if_nametoindex(const char *); +char * if_indextoname(unsigned int, char *); +struct if_nameindex * if_nameindex(void); +void if_freenameindex(struct if_nameindex *); + +#endif /* !_NET_IF_H_ */ + diff -r 40668908260c -r beade55d67fc extras/mini-os/lib/sys.c --- a/extras/mini-os/lib/sys.c Mon Nov 10 10:41:41 2008 +0000 +++ b/extras/mini-os/lib/sys.c Tue Nov 11 11:03:58 2008 +0000 @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -1324,6 +1325,12 @@ unsupported_function(int, tcgetattr, 0); unsupported_function(int, tcgetattr, 0); unsupported_function(int, poll, -1); +/* net/if.h */ +unsupported_function_log(unsigned int, if_nametoindex, -1); +unsupported_function_log(char *, if_indextoname, (char *) NULL); +unsupported_function_log(struct if_nameindex *, if_nameindex, (struct if_nameindex *) NULL); +unsupported_function_crash(if_freenameindex); + /* Linuxish abi for the Caml runtime, don't support */ unsupported_function_log(struct dirent *, readdir64, NULL); unsupported_function_log(int, getrusage, -1); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:10:42 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:10:42 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pda-0000vF-76; Wed, 19 Nov 2008 08:10:42 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pco-0000Tn-TL for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:54 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050007-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 501D0E6522 for ; Wed, 19 Nov 2008 08:09:53 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id fOv0TQyQPhrvX7MK for ; Wed, 19 Nov 2008 08:09:53 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690519 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690519" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:53 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9rLF004301 for ; Wed, 19 Nov 2008 08:09:53 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAG5o029553 for ; Wed, 19 Nov 2008 08:10:16 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAGg9029552 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:16 -0800 Message-Id: <200811191610.mAJGAGg9029552@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:15 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xend: Restore CPU affinity on domain resume. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110994 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] xend: Restore CPU affinity on domain resume. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226401587 0 # Node ID 76e90ac5067ef71f60b68ea0515f7f0466be5dca # Parent beade55d67fc2c81adaaa552804e0b66dc25becb xend: Restore CPU affinity on domain resume. Move affinity-setting logic into its own function and call from relevant places. From: Jiri Denemark Signed-off-by: Keir Fraser --- tools/python/xen/xend/XendDomainInfo.py | 112 +++++++++++++++++--------------- 1 files changed, 60 insertions(+), 52 deletions(-) diff -r beade55d67fc -r 76e90ac5067e tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Tue Nov 11 11:03:58 2008 +0000 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Nov 11 11:06:27 2008 +0000 @@ -479,6 +479,7 @@ class XendDomainInfo: if state in (DOM_STATE_SUSPENDED, DOM_STATE_HALTED): try: self._constructDomain() + self._setCPUAffinity() self._storeVmDetails() self._createChannels() self._createDevices() @@ -2166,6 +2167,64 @@ class XendDomainInfo: raise XendError(str(exn)) + def _setCPUAffinity(self): + """ Repin domain vcpus if a restricted cpus list is provided + """ + + def has_cpus(): + if self.info['cpus'] is not None: + for c in self.info['cpus']: + if c: + return True + return False + + if has_cpus(): + for v in range(0, self.info['VCPUs_max']): + if self.info['cpus'][v]: + xc.vcpu_setaffinity(self.domid, v, self.info['cpus'][v]) + else: + def find_relaxed_node(node_list): + import sys + nr_nodes = info['nr_nodes'] + if node_list is None: + node_list = range(0, nr_nodes) + nodeload = [0] + nodeload = nodeload * nr_nodes + from xen.xend import XendDomain + doms = XendDomain.instance().list('all') + for dom in filter (lambda d: d.domid != self.domid, doms): + cpuinfo = dom.getVCPUInfo() + for vcpu in sxp.children(cpuinfo, 'vcpu'): + if sxp.child_value(vcpu, 'online') == 0: continue + cpumap = list(sxp.child_value(vcpu,'cpumap')) + for i in range(0, nr_nodes): + node_cpumask = info['node_to_cpu'][i] + for j in node_cpumask: + if j in cpumap: + nodeload[i] += 1 + break + for i in range(0, nr_nodes): + if len(info['node_to_cpu'][i]) > 0 and i in node_list: + nodeload[i] = int(nodeload[i] * 16 / len(info['node_to_cpu'][i])) + else: + nodeload[i] = sys.maxint + index = nodeload.index( min(nodeload) ) + return index + + info = xc.physinfo() + if info['nr_nodes'] > 1: + node_memory_list = info['node_to_memory'] + needmem = self.image.getRequiredAvailableMemory(self.info['memory_dynamic_max']) / 1024 + candidate_node_list = [] + for i in range(0, info['nr_nodes']): + if node_memory_list[i] >= needmem and len(info['node_to_cpu'][i]) > 0: + candidate_node_list.append(i) + index = find_relaxed_node(candidate_node_list) + cpumask = info['node_to_cpu'][index] + for v in range(0, self.info['VCPUs_max']): + xc.vcpu_setaffinity(self.domid, v, cpumask) + + def _initDomain(self): log.debug('XendDomainInfo.initDomain: %s %s', self.domid, @@ -2185,58 +2244,7 @@ class XendDomainInfo: # repin domain vcpus if a restricted cpus list is provided # this is done prior to memory allocation to aide in memory # distribution for NUMA systems. - def has_cpus(): - if self.info['cpus'] is not None: - for c in self.info['cpus']: - if c: - return True - return False - - if has_cpus(): - for v in range(0, self.info['VCPUs_max']): - if self.info['cpus'][v]: - xc.vcpu_setaffinity(self.domid, v, self.info['cpus'][v]) - else: - def find_relaxed_node(node_list): - import sys - nr_nodes = info['nr_nodes'] - if node_list is None: - node_list = range(0, nr_nodes) - nodeload = [0] - nodeload = nodeload * nr_nodes - from xen.xend import XendDomain - doms = XendDomain.instance().list('all') - for dom in filter (lambda d: d.domid != self.domid, doms): - cpuinfo = dom.getVCPUInfo() - for vcpu in sxp.children(cpuinfo, 'vcpu'): - if sxp.child_value(vcpu, 'online') == 0: continue - cpumap = list(sxp.child_value(vcpu,'cpumap')) - for i in range(0, nr_nodes): - node_cpumask = info['node_to_cpu'][i] - for j in node_cpumask: - if j in cpumap: - nodeload[i] += 1 - break - for i in range(0, nr_nodes): - if len(info['node_to_cpu'][i]) > 0 and i in node_list: - nodeload[i] = int(nodeload[i] * 16 / len(info['node_to_cpu'][i])) - else: - nodeload[i] = sys.maxint - index = nodeload.index( min(nodeload) ) - return index - - info = xc.physinfo() - if info['nr_nodes'] > 1: - node_memory_list = info['node_to_memory'] - needmem = self.image.getRequiredAvailableMemory(self.info['memory_dynamic_max']) / 1024 - candidate_node_list = [] - for i in range(0, info['nr_nodes']): - if node_memory_list[i] >= needmem and len(info['node_to_cpu'][i]) > 0: - candidate_node_list.append(i) - index = find_relaxed_node(candidate_node_list) - cpumask = info['node_to_cpu'][index] - for v in range(0, self.info['VCPUs_max']): - xc.vcpu_setaffinity(self.domid, v, cpumask) + self._setCPUAffinity() # Use architecture- and image-specific calculations to determine # the various headrooms necessary, given the raw configured _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:10:49 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:10:49 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdh-0000zh-PF; Wed, 19 Nov 2008 08:10:49 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcp-0000U0-H4 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:55 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050008-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 0FE5DE6562 for ; Wed, 19 Nov 2008 08:09:54 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 0rViLe1NIhdRgOGi for ; Wed, 19 Nov 2008 08:09:54 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690520 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690520" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:54 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9rNF004304 for ; Wed, 19 Nov 2008 08:09:54 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAHVD029570 for ; Wed, 19 Nov 2008 08:10:17 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAHX5029569 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:17 -0800 Message-Id: <200811191610.mAJGAHX5029569@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:16 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] vtd cleanup: change some function return types to void X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110995 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] vtd cleanup: change some function return types to void X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226401641 0 # Node ID 36bda0bb805f12e3abafa889070f0646a2b10a2e # Parent 76e90ac5067ef71f60b68ea0515f7f0466be5dca vtd cleanup: change some function return types to void iommu_suspend(), iommu_resume(), iommu_enable() translation don't have meaningful return values. Changed their function types to void. Signed-off-by: Allen Kay --- xen/drivers/passthrough/vtd/iommu.c | 28 ++++++++++------------------ xen/include/xen/iommu.h | 4 ++-- 2 files changed, 12 insertions(+), 20 deletions(-) diff -r 76e90ac5067e -r 36bda0bb805f xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Tue Nov 11 11:06:27 2008 +0000 +++ b/xen/drivers/passthrough/vtd/iommu.c Tue Nov 11 11:07:21 2008 +0000 @@ -634,7 +634,7 @@ static int iommu_set_root_entry(struct i return 0; } -static int iommu_enable_translation(struct iommu *iommu) +static void iommu_enable_translation(struct iommu *iommu) { u32 sts; unsigned long flags; @@ -661,7 +661,6 @@ static int iommu_enable_translation(stru /* Disable PMRs when VT-d engine takes effect per spec definition */ disable_pmr(iommu); spin_unlock_irqrestore(&iommu->register_lock, flags); - return 0; } int iommu_disable_translation(struct iommu *iommu) @@ -1046,8 +1045,7 @@ static int intel_iommu_domain_init(struc for_each_drhd_unit ( drhd ) { iommu = drhd->iommu; - if ( iommu_enable_translation(iommu) ) - return -EIO; + iommu_enable_translation(iommu); } } @@ -1799,14 +1797,14 @@ static int intel_iommu_group_id(u8 bus, } static u32 iommu_state[MAX_IOMMUS][MAX_IOMMU_REGS]; -int iommu_suspend(void) +void iommu_suspend(void) { struct acpi_drhd_unit *drhd; struct iommu *iommu; u32 i; if ( !vtd_enabled ) - return 0; + return; iommu_flush_all(); @@ -1824,18 +1822,16 @@ int iommu_suspend(void) iommu_state[i][DMAR_FEUADDR_REG] = (u32) dmar_readl(iommu->reg, DMAR_FEUADDR_REG); } - - return 0; -} - -int iommu_resume(void) +} + +void iommu_resume(void) { struct acpi_drhd_unit *drhd; struct iommu *iommu; u32 i; if ( !vtd_enabled ) - return 0; + return; iommu_flush_all(); @@ -1855,12 +1851,8 @@ int iommu_resume(void) (u32) iommu_state[i][DMAR_FEADDR_REG]); dmar_writel(iommu->reg, DMAR_FEUADDR_REG, (u32) iommu_state[i][DMAR_FEUADDR_REG]); - - if ( iommu_enable_translation(iommu) ) - return -EIO; - } - - return 0; + iommu_enable_translation(iommu); + } } struct iommu_ops intel_iommu_ops = { diff -r 76e90ac5067e -r 36bda0bb805f xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Tue Nov 11 11:06:27 2008 +0000 +++ b/xen/include/xen/iommu.h Tue Nov 11 11:07:21 2008 +0000 @@ -110,7 +110,7 @@ void iommu_update_ire_from_apic(unsigned void iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned int value); void iommu_update_ire_from_msi(struct msi_desc *msi_desc, struct msi_msg *msg); -int iommu_suspend(void); -int iommu_resume(void); +void iommu_suspend(void); +void iommu_resume(void); #endif /* _IOMMU_H_ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:10:55 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:10:55 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdn-00013W-RI; Wed, 19 Nov 2008 08:10:55 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcq-0000Uj-OY for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:56 -0800 X-ASG-Debug-ID: 1227110987-0d6b00050009-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 53B6DE6569 for ; Wed, 19 Nov 2008 08:09:56 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id C1BDiEBn4lSZXoV8 for ; Wed, 19 Nov 2008 08:09:56 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690521 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690521" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:55 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9snP004307 for ; Wed, 19 Nov 2008 08:09:54 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAIN9029587 for ; Wed, 19 Nov 2008 08:10:18 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAIZf029586 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:18 -0800 Message-Id: <200811191610.mAJGAIZf029586@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:17 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] vmx: Fix realmode exception delivery to correctly check stack pointer size. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110996 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] vmx: Fix realmode exception delivery to correctly check stack pointer size. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226401859 0 # Node ID 92d0e13b0ea365f019116450910bb0f3819c109c # Parent 36bda0bb805f12e3abafa889070f0646a2b10a2e vmx: Fix realmode exception delivery to correctly check stack pointer size. Bug tracked down by Tim Deegan Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vmx/realmode.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -r 36bda0bb805f -r 92d0e13b0ea3 xen/arch/x86/hvm/vmx/realmode.c --- a/xen/arch/x86/hvm/vmx/realmode.c Tue Nov 11 11:07:21 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/realmode.c Tue Nov 11 11:10:59 2008 +0000 @@ -69,7 +69,8 @@ static void realmode_deliver_exception( frame[1] = csr->sel; frame[2] = regs->eflags & ~X86_EFLAGS_RF; - if ( hvmemul_ctxt->ctxt.sp_size == 32 ) + /* We can't test hvmemul_ctxt->ctxt.sp_size: it may not be initialised. */ + if ( hvmemul_ctxt->seg_reg[x86_seg_ss].attr.fields.db ) { regs->esp -= 6; pstk = regs->esp; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:02 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:02 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdu-00017k-Bi; Wed, 19 Nov 2008 08:11:02 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcr-0000Uz-Bc for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:57 -0800 X-ASG-Debug-ID: 1227110987-0d6b0005000a-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id F22CEE656D for ; Wed, 19 Nov 2008 08:09:56 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id lW5Q5dngx8eHfh9x for ; Wed, 19 Nov 2008 08:09:56 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690522 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690522" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:56 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9tlx004310 for ; Wed, 19 Nov 2008 08:09:55 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAJfm029604 for ; Wed, 19 Nov 2008 08:10:19 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAJGS029603 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:19 -0800 Message-Id: <200811191610.mAJGAJGS029603@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:18 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: fix getvcpucontext for HVM segment registers X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110996 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86: fix getvcpucontext for HVM segment registers X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226402037 0 # Node ID 7e8db19d72a54a86034177e2a48f7d2a2af87648 # Parent 92d0e13b0ea365f019116450910bb0f3819c109c x86: fix getvcpucontext for HVM segment registers Signed-off-by: Kouya Shimura Signed-off-by: Akio Takebe Signed-off-by: Keir Fraser --- xen/arch/x86/domctl.c | 13 +++++++++++++ 1 files changed, 13 insertions(+) diff -r 92d0e13b0ea3 -r 7e8db19d72a5 xen/arch/x86/domctl.c --- a/xen/arch/x86/domctl.c Tue Nov 11 11:10:59 2008 +0000 +++ b/xen/arch/x86/domctl.c Tue Nov 11 11:13:57 2008 +0000 @@ -1074,11 +1074,24 @@ void arch_get_info_guest(struct vcpu *v, if ( is_hvm_vcpu(v) ) { + struct segment_register sreg; memset(c.nat->ctrlreg, 0, sizeof(c.nat->ctrlreg)); c.nat->ctrlreg[0] = v->arch.hvm_vcpu.guest_cr[0]; c.nat->ctrlreg[2] = v->arch.hvm_vcpu.guest_cr[2]; c.nat->ctrlreg[3] = v->arch.hvm_vcpu.guest_cr[3]; c.nat->ctrlreg[4] = v->arch.hvm_vcpu.guest_cr[4]; + hvm_get_segment_register(v, x86_seg_cs, &sreg); + c.nat->user_regs.cs = sreg.sel; + hvm_get_segment_register(v, x86_seg_ss, &sreg); + c.nat->user_regs.ss = sreg.sel; + hvm_get_segment_register(v, x86_seg_ds, &sreg); + c.nat->user_regs.ds = sreg.sel; + hvm_get_segment_register(v, x86_seg_es, &sreg); + c.nat->user_regs.es = sreg.sel; + hvm_get_segment_register(v, x86_seg_fs, &sreg); + c.nat->user_regs.fs = sreg.sel; + hvm_get_segment_register(v, x86_seg_gs, &sreg); + c.nat->user_regs.gs = sreg.sel; } else { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:08 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:08 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pe0-0001Bp-Cg; Wed, 19 Nov 2008 08:11:08 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcs-0000Vr-RN for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:58 -0800 X-ASG-Debug-ID: 1227110987-0d6b0005000b-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 3E487E656F for ; Wed, 19 Nov 2008 08:09:57 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id Oe8X6LGqka6pXakF for ; Wed, 19 Nov 2008 08:09:57 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690523 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690523" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:57 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9uvn004313 for ; Wed, 19 Nov 2008 08:09:56 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAKNN029621 for ; Wed, 19 Nov 2008 08:10:20 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAK8p029620 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:20 -0800 Message-Id: <200811191610.mAJGAK8p029620@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:19 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] vmx: Clean up exception delivery logic. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110998 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] vmx: Clean up exception delivery logic. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226403300 0 # Node ID 7be8e7eefbd79e7bb823b20eadfbdd1fec483d93 # Parent 7e8db19d72a54a86034177e2a48f7d2a2af87648 vmx: Clean up exception delivery logic. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vmx/intr.c | 4 - xen/arch/x86/hvm/vmx/vmx.c | 80 ++++++++++++++++++-------------------- xen/arch/x86/hvm/vmx/vpmu_core2.c | 2 xen/include/asm-x86/hvm/vmx/vmx.h | 6 +- 4 files changed, 44 insertions(+), 48 deletions(-) diff -r 7e8db19d72a5 -r 7be8e7eefbd7 xen/arch/x86/hvm/vmx/intr.c --- a/xen/arch/x86/hvm/vmx/intr.c Tue Nov 11 11:13:57 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/intr.c Tue Nov 11 11:35:00 2008 +0000 @@ -140,12 +140,12 @@ asmlinkage void vmx_intr_assist(void) if ( intack.source == hvm_intsrc_nmi ) { - vmx_inject_nmi(v); + vmx_inject_nmi(); } else { HVMTRACE_2D(INJ_VIRQ, intack.vector, /*fake=*/ 0); - vmx_inject_extint(v, intack.vector); + vmx_inject_extint(intack.vector); pt_intr_post(v, intack); } diff -r 7e8db19d72a5 -r 7be8e7eefbd7 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Tue Nov 11 11:13:57 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Nov 11 11:35:00 2008 +0000 @@ -187,7 +187,7 @@ static enum handler_return long_mode_do_ check_long_mode: if ( !(hvm_long_mode_enabled(v)) ) { - vmx_inject_hw_exception(v, TRAP_gp_fault, 0); + vmx_inject_hw_exception(TRAP_gp_fault, 0); return HNDL_exception_raised; } break; @@ -284,7 +284,7 @@ static enum handler_return long_mode_do_ uncanonical_address: HVM_DBG_LOG(DBG_LEVEL_0, "Not cano address of msr write %x", ecx); gp_fault: - vmx_inject_hw_exception(v, TRAP_gp_fault, 0); + vmx_inject_hw_exception(TRAP_gp_fault, 0); exception_raised: return HNDL_exception_raised; } @@ -1094,8 +1094,7 @@ void ept_sync_domain(struct domain *d) } } -static void __vmx_inject_exception( - struct vcpu *v, int trap, int type, int error_code) +static void __vmx_inject_exception(int trap, int type, int error_code) { unsigned long intr_fields; @@ -1114,15 +1113,9 @@ static void __vmx_inject_exception( } __vmwrite(VM_ENTRY_INTR_INFO, intr_fields); - - if ( trap == TRAP_page_fault ) - HVMTRACE_LONG_2D(PF_INJECT, error_code, - TRC_PAR_LONG(v->arch.hvm_vcpu.guest_cr[2])); - else - HVMTRACE_2D(INJ_EXC, trap, error_code); -} - -void vmx_inject_hw_exception(struct vcpu *v, int trap, int error_code) +} + +void vmx_inject_hw_exception(int trap, int error_code) { unsigned long intr_info = __vmread(VM_ENTRY_INTR_INFO); @@ -1134,37 +1127,41 @@ void vmx_inject_hw_exception(struct vcpu error_code = 0; } - __vmx_inject_exception(v, trap, X86_EVENTTYPE_HW_EXCEPTION, error_code); -} - -void vmx_inject_extint(struct vcpu *v, int trap) -{ - __vmx_inject_exception(v, trap, X86_EVENTTYPE_EXT_INTR, + __vmx_inject_exception(trap, X86_EVENTTYPE_HW_EXCEPTION, error_code); + + if ( trap == TRAP_page_fault ) + HVMTRACE_LONG_2D(PF_INJECT, error_code, + TRC_PAR_LONG(current->arch.hvm_vcpu.guest_cr[2])); + else + HVMTRACE_2D(INJ_EXC, trap, error_code); + + if ( (trap == TRAP_debug) && + (guest_cpu_user_regs()->eflags & X86_EFLAGS_TF) ) + { + __restore_debug_registers(current); + write_debugreg(6, read_debugreg(6) | 0x4000); + } +} + +void vmx_inject_extint(int trap) +{ + __vmx_inject_exception(trap, X86_EVENTTYPE_EXT_INTR, HVM_DELIVER_NO_ERROR_CODE); } -void vmx_inject_nmi(struct vcpu *v) -{ - __vmx_inject_exception(v, 2, X86_EVENTTYPE_NMI, +void vmx_inject_nmi(void) +{ + __vmx_inject_exception(2, X86_EVENTTYPE_NMI, HVM_DELIVER_NO_ERROR_CODE); } static void vmx_inject_exception( unsigned int trapnr, int errcode, unsigned long cr2) { - struct vcpu *curr = current; - - vmx_inject_hw_exception(curr, trapnr, errcode); - if ( trapnr == TRAP_page_fault ) - curr->arch.hvm_vcpu.guest_cr[2] = cr2; - - if ( (trapnr == TRAP_debug) && - (guest_cpu_user_regs()->eflags & X86_EFLAGS_TF) ) - { - __restore_debug_registers(curr); - write_debugreg(6, read_debugreg(6) | 0x4000); - } + current->arch.hvm_vcpu.guest_cr[2] = cr2; + + vmx_inject_hw_exception(trapnr, errcode); } static int vmx_event_pending(struct vcpu *v) @@ -1315,7 +1312,7 @@ static void __update_guest_eip(unsigned } if ( regs->eflags & X86_EFLAGS_TF ) - vmx_inject_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE, 0); + vmx_inject_hw_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE); } static void vmx_fpu_dirty_intercept(void) @@ -1636,7 +1633,6 @@ static int vmx_msr_read_intercept(struct { u64 msr_content = 0; u32 ecx = regs->ecx, eax, edx; - struct vcpu *v = current; HVM_DBG_LOG(DBG_LEVEL_1, "ecx=%x", ecx); @@ -1712,7 +1708,7 @@ done: return X86EMUL_OKAY; gp_fault: - vmx_inject_hw_exception(v, TRAP_gp_fault, 0); + vmx_inject_hw_exception(TRAP_gp_fault, 0); return X86EMUL_EXCEPTION; } @@ -1849,7 +1845,7 @@ static int vmx_msr_write_intercept(struc if ( (rc < 0) || (vmx_add_host_load_msr(ecx) < 0) ) - vmx_inject_hw_exception(v, TRAP_machine_check, 0); + vmx_inject_hw_exception(TRAP_machine_check, 0); else { __vmwrite(GUEST_IA32_DEBUGCTL, msr_content); @@ -1889,7 +1885,7 @@ static int vmx_msr_write_intercept(struc return X86EMUL_OKAY; gp_fault: - vmx_inject_hw_exception(v, TRAP_gp_fault, 0); + vmx_inject_hw_exception(TRAP_gp_fault, 0); return X86EMUL_EXCEPTION; } @@ -2197,7 +2193,7 @@ asmlinkage void vmx_vmexit_handler(struc } v->arch.hvm_vcpu.guest_cr[2] = exit_qualification; - vmx_inject_hw_exception(v, TRAP_page_fault, regs->error_code); + vmx_inject_hw_exception(TRAP_page_fault, regs->error_code); break; case TRAP_nmi: if ( (intr_info & INTR_INFO_INTR_TYPE_MASK) != @@ -2317,7 +2313,7 @@ asmlinkage void vmx_vmexit_handler(struc case EXIT_REASON_VMWRITE: case EXIT_REASON_VMXOFF: case EXIT_REASON_VMXON: - vmx_inject_hw_exception(v, TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); + vmx_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE); break; case EXIT_REASON_TPR_BELOW_THRESHOLD: @@ -2326,7 +2322,7 @@ asmlinkage void vmx_vmexit_handler(struc case EXIT_REASON_IO_INSTRUCTION: case EXIT_REASON_APIC_ACCESS: if ( !handle_mmio() ) - hvm_inject_exception(TRAP_gp_fault, 0, 0); + vmx_inject_hw_exception(TRAP_gp_fault, 0); break; case EXIT_REASON_INVD: diff -r 7e8db19d72a5 -r 7be8e7eefbd7 xen/arch/x86/hvm/vmx/vpmu_core2.c --- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Tue Nov 11 11:13:57 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Tue Nov 11 11:35:00 2008 +0000 @@ -335,7 +335,7 @@ static int core2_vpmu_do_wrmsr(struct cp case MSR_CORE_PERF_GLOBAL_STATUS: gdprintk(XENLOG_INFO, "Can not write readonly MSR: " "MSR_PERF_GLOBAL_STATUS(0x38E)!\n"); - vmx_inject_hw_exception(current, TRAP_gp_fault, 0); + vmx_inject_hw_exception(TRAP_gp_fault, 0); return 1; case MSR_IA32_PEBS_ENABLE: if ( msr_content & 1 ) diff -r 7e8db19d72a5 -r 7be8e7eefbd7 xen/include/asm-x86/hvm/vmx/vmx.h --- a/xen/include/asm-x86/hvm/vmx/vmx.h Tue Nov 11 11:13:57 2008 +0000 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h Tue Nov 11 11:35:00 2008 +0000 @@ -351,9 +351,9 @@ static inline int __vmxon(u64 addr) return rc; } -void vmx_inject_hw_exception(struct vcpu *v, int trap, int error_code); -void vmx_inject_extint(struct vcpu *v, int trap); -void vmx_inject_nmi(struct vcpu *v); +void vmx_inject_hw_exception(int trap, int error_code); +void vmx_inject_extint(int trap); +void vmx_inject_nmi(void); void ept_p2m_init(struct domain *d); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:16 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:16 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pe8-0001GM-8p; Wed, 19 Nov 2008 08:11:16 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pct-0000WR-L7 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:09:59 -0800 X-ASG-Debug-ID: 1227110987-0d6b0005000c-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 1C573E6571 for ; Wed, 19 Nov 2008 08:09:58 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id gEGki0xdMV0f5M4S for ; Wed, 19 Nov 2008 08:09:58 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690524 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690524" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:58 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9vMc004316 for ; Wed, 19 Nov 2008 08:09:57 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGALB8029638 for ; Wed, 19 Nov 2008 08:10:21 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGALoY029637 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:21 -0800 Message-Id: <200811191610.mAJGALoY029637@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:20 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] hvm: fix single stepping on debugger X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227110999 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] hvm: fix single stepping on debugger X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226404023 0 # Node ID 07d0be88571fa4dfbf3449069c78c08acc09b2da # Parent 7be8e7eefbd79e7bb823b20eadfbdd1fec483d93 hvm: fix single stepping on debugger The debuggee domain will die with unexpected trap on single stepping of emulated instruction. Signed-off-by: Kouya Shimura Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/svm/svm.c | 24 +++++++++++++++++------- xen/arch/x86/hvm/vmx/realmode.c | 20 ++++++++++++++------ xen/arch/x86/hvm/vmx/vmx.c | 25 ++++++++++++++++++------- 3 files changed, 49 insertions(+), 20 deletions(-) diff -r 7be8e7eefbd7 -r 07d0be88571f xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Tue Nov 11 11:35:00 2008 +0000 +++ b/xen/arch/x86/hvm/svm/svm.c Tue Nov 11 11:47:03 2008 +0000 @@ -739,6 +739,23 @@ static void svm_inject_exception( struct vmcb_struct *vmcb = curr->arch.hvm_svm.vmcb; eventinj_t event = vmcb->eventinj; + switch ( trapnr ) + { + case TRAP_debug: + if ( guest_cpu_user_regs()->eflags & X86_EFLAGS_TF ) + { + __restore_debug_registers(curr); + vmcb->dr6 |= 0x4000; + } + case TRAP_int3: + if ( curr->domain->debugger_attached ) + { + /* Debug/Int3: Trap to debugger. */ + domain_pause_for_debugger(); + return; + } + } + if ( unlikely(event.fields.v) && (event.fields.type == X86_EVENTTYPE_HW_EXCEPTION) ) { @@ -764,13 +781,6 @@ static void svm_inject_exception( else { HVMTRACE_2D(INJ_EXC, trapnr, errcode); - } - - if ( (trapnr == TRAP_debug) && - (guest_cpu_user_regs()->eflags & X86_EFLAGS_TF) ) - { - __restore_debug_registers(curr); - vmcb->dr6 |= 0x4000; } } diff -r 7be8e7eefbd7 -r 07d0be88571f xen/arch/x86/hvm/vmx/realmode.c --- a/xen/arch/x86/hvm/vmx/realmode.c Tue Nov 11 11:35:00 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/realmode.c Tue Nov 11 11:47:03 2008 +0000 @@ -149,17 +149,25 @@ static void realmode_emulate_one(struct hvmemul_ctxt->exn_insn_len = 0; } - if ( curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE ) + if ( unlikely(curr->domain->debugger_attached) && + ((hvmemul_ctxt->exn_vector == TRAP_debug) || + (hvmemul_ctxt->exn_vector == TRAP_int3)) ) + { + domain_pause_for_debugger(); + } + else if ( curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE ) { gdprintk(XENLOG_ERR, "Exception %02x in protected mode.\n", hvmemul_ctxt->exn_vector); goto fail; } - - realmode_deliver_exception( - hvmemul_ctxt->exn_vector, - hvmemul_ctxt->exn_insn_len, - hvmemul_ctxt); + else + { + realmode_deliver_exception( + hvmemul_ctxt->exn_vector, + hvmemul_ctxt->exn_insn_len, + hvmemul_ctxt); + } } return; diff -r 7be8e7eefbd7 -r 07d0be88571f xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Tue Nov 11 11:35:00 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Nov 11 11:47:03 2008 +0000 @@ -1118,6 +1118,24 @@ void vmx_inject_hw_exception(int trap, i void vmx_inject_hw_exception(int trap, int error_code) { unsigned long intr_info = __vmread(VM_ENTRY_INTR_INFO); + struct vcpu *curr = current; + + switch ( trap ) + { + case TRAP_debug: + if ( guest_cpu_user_regs()->eflags & X86_EFLAGS_TF ) + { + __restore_debug_registers(curr); + write_debugreg(6, read_debugreg(6) | 0x4000); + } + case TRAP_int3: + if ( curr->domain->debugger_attached ) + { + /* Debug/Int3: Trap to debugger. */ + domain_pause_for_debugger(); + return; + } + } if ( unlikely(intr_info & INTR_INFO_VALID_MASK) && (((intr_info >> 8) & 7) == X86_EVENTTYPE_HW_EXCEPTION) ) @@ -1134,13 +1152,6 @@ void vmx_inject_hw_exception(int trap, i TRC_PAR_LONG(current->arch.hvm_vcpu.guest_cr[2])); else HVMTRACE_2D(INJ_EXC, trap, error_code); - - if ( (trap == TRAP_debug) && - (guest_cpu_user_regs()->eflags & X86_EFLAGS_TF) ) - { - __restore_debug_registers(current); - write_debugreg(6, read_debugreg(6) | 0x4000); - } } void vmx_inject_extint(int trap) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:22 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:22 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2peE-0001K8-Io; Wed, 19 Nov 2008 08:11:22 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcv-0000Xe-J6 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:01 -0800 X-ASG-Debug-ID: 1227110987-0d6b0005000d-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 0C930E6575 for ; Wed, 19 Nov 2008 08:09:59 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id iFhBfvZmN8iQCAUQ for ; Wed, 19 Nov 2008 08:09:59 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690525 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690525" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:09:59 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9wAn004319 for ; Wed, 19 Nov 2008 08:09:58 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAMri029655 for ; Wed, 19 Nov 2008 08:10:22 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAMP7029654 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:22 -0800 Message-Id: <200811191610.mAJGAMP7029654@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:21 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xend, pciif: fix some indentation X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111000 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] xend, pciif: fix some indentation X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226490625 0 # Node ID 2bd99c5faa420612544a9d94e298332e0e72a86a # Parent 07d0be88571fa4dfbf3449069c78c08acc09b2da xend, pciif: fix some indentation Signed-off-by: Dexuan Cui --- tools/python/xen/xend/server/pciif.py | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff -r 07d0be88571f -r 2bd99c5faa42 tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Tue Nov 11 11:47:03 2008 +0000 +++ b/tools/python/xen/xend/server/pciif.py Wed Nov 12 11:50:25 2008 +0000 @@ -333,12 +333,6 @@ class PciController(DevController): if rc<0: raise VmError(('pci: failed to configure I/O memory on device '+ '%s - errno=%d')%(dev.name,rc)) - rc = xc.physdev_map_pirq(domid = fe_domid, - index = dev.irq, - pirq = dev.irq) - if rc < 0: - raise VmError(('pci: failed to map irq on device '+ - '%s - errno=%d')%(dev.name,rc)) if dev.msix: for (start, size) in dev.msix_iomem: @@ -353,6 +347,12 @@ class PciController(DevController): if rc<0: raise VmError(('pci: failed to remove msi-x iomem')) + rc = xc.physdev_map_pirq(domid = fe_domid, + index = dev.irq, + pirq = dev.irq) + if rc < 0: + raise VmError(('pci: failed to map irq on device '+ + '%s - errno=%d')%(dev.name,rc)) if dev.irq>0: log.debug('pci: enabling irq %d'%dev.irq) rc = xc.domain_irq_permission(domid = fe_domid, pirq = dev.irq, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:28 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:28 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2peK-0001O7-MR; Wed, 19 Nov 2008 08:11:28 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcy-0000Zl-FV for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:04 -0800 X-ASG-Debug-ID: 1227111002-0dd700010000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 5A1FDE6575 for ; Wed, 19 Nov 2008 08:10:03 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id lVeAKd8FMbXVuBAi for ; Wed, 19 Nov 2008 08:10:03 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690533 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690533" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:02 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGA1N1004328 for ; Wed, 19 Nov 2008 08:10:01 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAPFO029706 for ; Wed, 19 Nov 2008 08:10:25 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAP4i029705 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:25 -0800 Message-Id: <200811191610.mAJGAP4i029705@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:24 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xm: display domain id on domain creation X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111003 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=INFO_TLD X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 INFO_TLD URI: Contains an URL in the INFO top-level domain Subject: [Xen-changelog] [xen-unstable] xm: display domain id on domain creation X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226573450 0 # Node ID 9f68b6ae6243dd8af575ce79bc60d74e1f2364c4 # Parent 8de4b4e9a435cea9b8e85863fcb832c213281076 xm: display domain id on domain creation Signed-off-by: Kouya Shimura --- tools/python/xen/xm/create.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r 8de4b4e9a435 -r 9f68b6ae6243 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Wed Nov 12 12:04:15 2008 +0000 +++ b/tools/python/xen/xm/create.py Thu Nov 13 10:50:50 2008 +0000 @@ -1202,8 +1202,9 @@ def make_domain(opts, config): except: server.xend.domain.destroy(dom) err("Failed to unpause domain %s" % dom) - opts.info("Started domain %s" % (dom)) - return int(sxp.child_value(dominfo, 'domid')) + domid = int(sxp.child_value(dominfo, 'domid')) + opts.info("Started domain %s (id=%d)" % (dom, domid)) + return domid def get_xauthority(): _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:35 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:35 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2peQ-0001SG-W2; Wed, 19 Nov 2008 08:11:35 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pcz-0000a9-3s for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:05 -0800 X-ASG-Debug-ID: 1227110987-0d6b0005000e-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 83320E6579 for ; Wed, 19 Nov 2008 08:10:01 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id H6oNxJDIdDimPD4k for ; Wed, 19 Nov 2008 08:10:01 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690527 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690527" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:00 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJG9xbQ004322 for ; Wed, 19 Nov 2008 08:09:59 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAN98029672 for ; Wed, 19 Nov 2008 08:10:23 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGANaU029671 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:23 -0800 Message-Id: <200811191610.mAJGANaU029671@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:22 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: reduce GDT switching X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111001 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: reduce GDT switching X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226491295 0 # Node ID 8e18dd41c6c7bb0980b29393b275c564cfb96437 # Parent 2bd99c5faa420612544a9d94e298332e0e72a86a x86: reduce GDT switching Both idle and HVM vCPU-s can easily run on the GDT mapped into general hypervisor space (rather than that placed in per-vCPU virtual space). This makes unnecessary some of the additions c/s 18520 did. Signed-off-by: Jan Beulich --- xen/arch/x86/cpu/common.c | 9 +++++---- xen/arch/x86/domain.c | 44 ++++++++++++++++++++++++-------------------- xen/arch/x86/domain_build.c | 34 ++++++---------------------------- xen/arch/x86/hvm/vmx/vmcs.c | 5 ++--- xen/arch/x86/setup.c | 8 +------- xen/arch/x86/smpboot.c | 17 +++++------------ xen/arch/x86/x86_32/mm.c | 24 ------------------------ xen/arch/x86/x86_64/mm.c | 19 ------------------- xen/include/asm-x86/page.h | 1 - 9 files changed, 43 insertions(+), 118 deletions(-) diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/arch/x86/cpu/common.c --- a/xen/arch/x86/cpu/common.c Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/arch/x86/cpu/common.c Wed Nov 12 12:01:35 2008 +0000 @@ -564,7 +564,10 @@ void __cpuinit cpu_init(void) { int cpu = smp_processor_id(); struct tss_struct *t = &init_tss[cpu]; - char gdt_load[10]; + struct desc_ptr gdt_desc = { + .base = (unsigned long)(this_cpu(gdt_table) - FIRST_RESERVED_GDT_ENTRY), + .limit = LAST_RESERVED_GDT_BYTE + }; if (cpu_test_and_set(cpu, cpu_initialized)) { printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); @@ -578,9 +581,7 @@ void __cpuinit cpu_init(void) /* Install correct page table. */ write_ptbase(current); - *(unsigned short *)(&gdt_load[0]) = LAST_RESERVED_GDT_BYTE; - *(unsigned long *)(&gdt_load[2]) = GDT_VIRT_START(current); - asm volatile ( "lgdt %0" : "=m" (gdt_load) ); + asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); /* No nested task. */ asm volatile ("pushf ; andw $0xbfff,(%"__OP"sp) ; popf" ); diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/arch/x86/domain.c Wed Nov 12 12:01:35 2008 +0000 @@ -310,12 +310,7 @@ int vcpu_initialise(struct vcpu *v) if ( is_idle_domain(d) ) { v->arch.schedule_tail = continue_idle_domain; - if ( v->vcpu_id ) - v->arch.cr3 = d->vcpu[0]->arch.cr3; - else if ( !*idle_vcpu ) - v->arch.cr3 = __pa(idle_pg_table); - else if ( !(v->arch.cr3 = clone_idle_pagetable(v)) ) - return -ENOMEM; + v->arch.cr3 = __pa(idle_pg_table); } v->arch.guest_context.ctrlreg[4] = @@ -1172,14 +1167,18 @@ static void paravirt_ctxt_switch_to(stru } } +static inline int need_full_gdt(struct vcpu *v) +{ + return (!is_hvm_vcpu(v) && !is_idle_vcpu(v)); +} + static void __context_switch(void) { struct cpu_user_regs *stack_regs = guest_cpu_user_regs(); - unsigned int i, cpu = smp_processor_id(); + unsigned int cpu = smp_processor_id(); struct vcpu *p = per_cpu(curr_vcpu, cpu); struct vcpu *n = current; struct desc_struct *gdt; - struct page_info *page; struct desc_ptr gdt_desc; ASSERT(p != n); @@ -1208,16 +1207,19 @@ static void __context_switch(void) gdt = !is_pv_32on64_vcpu(n) ? per_cpu(gdt_table, cpu) : per_cpu(compat_gdt_table, cpu); - page = virt_to_page(gdt); - for (i = 0; i < NR_RESERVED_GDT_PAGES; ++i) - { - l1e_write(n->domain->arch.mm_perdomain_pt + - (n->vcpu_id << GDT_LDT_VCPU_SHIFT) + - FIRST_RESERVED_GDT_PAGE + i, - l1e_from_page(page + i, __PAGE_HYPERVISOR)); - } - - if ( p->vcpu_id != n->vcpu_id ) + if ( need_full_gdt(n) ) + { + struct page_info *page = virt_to_page(gdt); + unsigned int i; + for ( i = 0; i < NR_RESERVED_GDT_PAGES; i++ ) + l1e_write(n->domain->arch.mm_perdomain_pt + + (n->vcpu_id << GDT_LDT_VCPU_SHIFT) + + FIRST_RESERVED_GDT_PAGE + i, + l1e_from_page(page + i, __PAGE_HYPERVISOR)); + } + + if ( need_full_gdt(p) && + ((p->vcpu_id != n->vcpu_id) || !need_full_gdt(n)) ) { gdt_desc.limit = LAST_RESERVED_GDT_BYTE; gdt_desc.base = (unsigned long)(gdt - FIRST_RESERVED_GDT_ENTRY); @@ -1226,8 +1228,10 @@ static void __context_switch(void) write_ptbase(n); - if ( p->vcpu_id != n->vcpu_id ) - { + if ( need_full_gdt(n) && + ((p->vcpu_id != n->vcpu_id) || !need_full_gdt(p)) ) + { + gdt_desc.limit = LAST_RESERVED_GDT_BYTE; gdt_desc.base = GDT_VIRT_START(n); asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); } diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/arch/x86/domain_build.c Wed Nov 12 12:01:35 2008 +0000 @@ -194,30 +194,6 @@ static void __init process_dom0_ioports_ } } -/* We run on dom0's page tables for the final part of the build process. */ -static void dom0_pt_enter(struct vcpu *v) -{ - struct desc_ptr gdt_desc = { - .limit = LAST_RESERVED_GDT_BYTE, - .base = (unsigned long)(this_cpu(gdt_table) - FIRST_RESERVED_GDT_ENTRY) - }; - - asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); - write_ptbase(v); -} - -/* Return to idle domain's page tables. */ -static void dom0_pt_exit(void) -{ - struct desc_ptr gdt_desc = { - .limit = LAST_RESERVED_GDT_BYTE, - .base = GDT_VIRT_START(current) - }; - - write_ptbase(current); - asm volatile ( "lgdt %0" : : "m" (gdt_desc) ); -} - int __init construct_dom0( struct domain *d, unsigned long _image_start, unsigned long image_len, @@ -729,7 +705,8 @@ int __init construct_dom0( else update_cr3(v); - dom0_pt_enter(v); + /* We run on dom0's page tables for the final part of the build process. */ + write_ptbase(v); /* Copy the OS image and free temporary buffer. */ elf.dest = (void*)vkern_start; @@ -741,11 +718,11 @@ int __init construct_dom0( (parms.virt_hypercall >= v_end) ) { write_ptbase(current); - local_irq_enable(); printk("Invalid HYPERCALL_PAGE field in ELF notes.\n"); return -1; } - hypercall_page_initialise(d, (void *)(unsigned long)parms.virt_hypercall); + hypercall_page_initialise( + d, (void *)(unsigned long)parms.virt_hypercall); } /* Copy the initial ramdisk. */ @@ -826,7 +803,8 @@ int __init construct_dom0( xlat_start_info(si, XLAT_start_info_console_dom0); #endif - dom0_pt_exit(); + /* Return to idle domain's page tables. */ + write_ptbase(current); #if defined(__i386__) /* Destroy low mappings - they were only for our convenience. */ diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/arch/x86/hvm/vmx/vmcs.c --- a/xen/arch/x86/hvm/vmx/vmcs.c Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmcs.c Wed Nov 12 12:01:35 2008 +0000 @@ -444,6 +444,8 @@ static void vmx_set_host_env(struct vcpu { unsigned int cpu = smp_processor_id(); + __vmwrite(HOST_GDTR_BASE, + (unsigned long)(this_cpu(gdt_table) - FIRST_RESERVED_GDT_ENTRY)); __vmwrite(HOST_IDTR_BASE, (unsigned long)idt_tables[cpu]); __vmwrite(HOST_TR_SELECTOR, TSS_ENTRY << 3); @@ -540,9 +542,6 @@ static int construct_vmcs(struct vcpu *v /* I/O access bitmap. */ __vmwrite(IO_BITMAP_A, virt_to_maddr((char *)hvm_io_bitmap + 0)); __vmwrite(IO_BITMAP_B, virt_to_maddr((char *)hvm_io_bitmap + PAGE_SIZE)); - - /* Host GDTR base. */ - __vmwrite(HOST_GDTR_BASE, GDT_VIRT_START(v)); /* Host data selectors. */ __vmwrite(HOST_SS_SELECTOR, __HYPERVISOR_DS); diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/arch/x86/setup.c Wed Nov 12 12:01:35 2008 +0000 @@ -230,7 +230,6 @@ static void __init init_idle_domain(void static void __init init_idle_domain(void) { struct domain *idle_domain; - unsigned int i; /* Domain creation requires that scheduler structures are initialised. */ scheduler_init(); @@ -243,12 +242,6 @@ static void __init init_idle_domain(void idle_vcpu[0] = this_cpu(curr_vcpu) = current; setup_idle_pagetable(); - - for (i = 0; i < NR_RESERVED_GDT_PAGES; ++i) - idle_domain->arch.mm_perdomain_pt[FIRST_RESERVED_GDT_PAGE + i] = - l1e_from_page(virt_to_page(boot_cpu_gdt_table) + i, - __PAGE_HYPERVISOR); - } static void __init srat_detect_node(int cpu) @@ -456,6 +449,7 @@ void __init __start_xen(unsigned long mb parse_video_info(); set_current((struct vcpu *)0xfffff000); /* debug sanity */ + idle_vcpu[0] = current; set_processor_id(0); /* needed early, for smp_processor_id() */ if ( cpu_has_efer ) rdmsrl(MSR_EFER, this_cpu(efer)); diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/arch/x86/smpboot.c Wed Nov 12 12:01:35 2008 +0000 @@ -821,7 +821,7 @@ static int __devinit do_boot_cpu(int api */ { unsigned long boot_error; - unsigned int i; + unsigned int order; int timeout; unsigned long start_eip; unsigned short nmi_high = 0, nmi_low = 0; @@ -857,34 +857,27 @@ static int __devinit do_boot_cpu(int api gdt = per_cpu(gdt_table, cpu); if (gdt == boot_cpu_gdt_table) { - i = get_order_from_pages(NR_RESERVED_GDT_PAGES); + order = get_order_from_pages(NR_RESERVED_GDT_PAGES); #ifdef __x86_64__ #ifdef CONFIG_COMPAT - page = alloc_domheap_pages(NULL, i, + page = alloc_domheap_pages(NULL, order, MEMF_node(cpu_to_node(cpu))); per_cpu(compat_gdt_table, cpu) = gdt = page_to_virt(page); memcpy(gdt, boot_cpu_compat_gdt_table, NR_RESERVED_GDT_PAGES * PAGE_SIZE); gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu; #endif - page = alloc_domheap_pages(NULL, i, + page = alloc_domheap_pages(NULL, order, MEMF_node(cpu_to_node(cpu))); per_cpu(gdt_table, cpu) = gdt = page_to_virt(page); #else - per_cpu(gdt_table, cpu) = gdt = alloc_xenheap_pages(i); + per_cpu(gdt_table, cpu) = gdt = alloc_xenheap_pages(order); #endif memcpy(gdt, boot_cpu_gdt_table, NR_RESERVED_GDT_PAGES * PAGE_SIZE); BUILD_BUG_ON(NR_CPUS > 0x10000); gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu; } - - for (i = 0; i < NR_RESERVED_GDT_PAGES; ++i) - v->domain->arch.mm_perdomain_pt - [(v->vcpu_id << GDT_LDT_VCPU_SHIFT) + - FIRST_RESERVED_GDT_PAGE + i] - = l1e_from_page(virt_to_page(gdt) + i, - __PAGE_HYPERVISOR); #ifdef __i386__ if (!per_cpu(doublefault_tss, cpu)) { diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/arch/x86/x86_32/mm.c --- a/xen/arch/x86/x86_32/mm.c Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/arch/x86/x86_32/mm.c Wed Nov 12 12:01:35 2008 +0000 @@ -132,30 +132,6 @@ void __init setup_idle_pagetable(void) __PAGE_HYPERVISOR)); } -unsigned long clone_idle_pagetable(struct vcpu *v) -{ - unsigned int i; - struct domain *d = v->domain; - l3_pgentry_t *l3_table = v->arch.pae_l3_cache.table[0]; - l2_pgentry_t *l2_table = alloc_xenheap_page(); - - if ( !l2_table ) - return 0; - - memcpy(l3_table, idle_pg_table, L3_PAGETABLE_ENTRIES * sizeof(*l3_table)); - l3_table[l3_table_offset(PERDOMAIN_VIRT_START)] = - l3e_from_page(virt_to_page(l2_table), _PAGE_PRESENT); - - copy_page(l2_table, idle_pg_table_l2 + - l3_table_offset(PERDOMAIN_VIRT_START) * L2_PAGETABLE_ENTRIES); - for ( i = 0; i < PDPT_L2_ENTRIES; ++i ) - l2_table[l2_table_offset(PERDOMAIN_VIRT_START) + i] = - l2e_from_page(virt_to_page(d->arch.mm_perdomain_pt) + i, - __PAGE_HYPERVISOR); - - return __pa(l3_table); -} - void __init zap_low_mappings(l2_pgentry_t *dom0_l2) { int i; diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/arch/x86/x86_64/mm.c --- a/xen/arch/x86/x86_64/mm.c Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/arch/x86/x86_64/mm.c Wed Nov 12 12:01:35 2008 +0000 @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -207,24 +206,6 @@ void __init setup_idle_pagetable(void) __PAGE_HYPERVISOR)); } -unsigned long clone_idle_pagetable(struct vcpu *v) -{ - struct domain *d = v->domain; - struct page_info *page = alloc_domheap_page(NULL, - MEMF_node(vcpu_to_node(v))); - l4_pgentry_t *l4_table = page_to_virt(page); - - if ( !page ) - return 0; - - copy_page(l4_table, idle_pg_table); - l4_table[l4_table_offset(PERDOMAIN_VIRT_START)] = - l4e_from_page(virt_to_page(d->arch.mm_perdomain_l3), - __PAGE_HYPERVISOR); - - return __pa(l4_table); -} - void __init zap_low_mappings(void) { BUG_ON(num_online_cpus() != 1); diff -r 2bd99c5faa42 -r 8e18dd41c6c7 xen/include/asm-x86/page.h --- a/xen/include/asm-x86/page.h Wed Nov 12 11:50:25 2008 +0000 +++ b/xen/include/asm-x86/page.h Wed Nov 12 12:01:35 2008 +0000 @@ -278,7 +278,6 @@ extern unsigned int m2p_compat_vstart; #endif void paging_init(void); void setup_idle_pagetable(void); -unsigned long clone_idle_pagetable(struct vcpu *); #endif /* !defined(__ASSEMBLY__) */ #define _PAGE_PRESENT 0x001U _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:43 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:43 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2peZ-0001We-IT; Wed, 19 Nov 2008 08:11:43 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pd5-0000e1-FC for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:11 -0800 X-ASG-Debug-ID: 1227111002-0dd700010001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 65737E6579 for ; Wed, 19 Nov 2008 08:10:05 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id gTKZpX6Qg7T1aA4A for ; Wed, 19 Nov 2008 08:10:05 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690534 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690534" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:04 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGA4gU004331 for ; Wed, 19 Nov 2008 08:10:04 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGARLe029730 for ; Wed, 19 Nov 2008 08:10:27 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAR5T029729 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:27 -0800 Message-Id: <200811191610.mAJGAR5T029729@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:25 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Move guest_l*e definitions into common code X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111006 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Move guest_l*e definitions into common code X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226581282 0 # Node ID b87cc4de3ca676e895f6374daed1d33a79849b9d # Parent 9f68b6ae6243dd8af575ce79bc60d74e1f2364c4 x86: Move guest_l*e definitions into common code Move the definitions of guest pagetable types and the guest pagetable walk record out of the shadow-code headers into asm-x86. Signed-off-by: Tim Deegan --- xen/arch/x86/mm/shadow/multi.c | 16 +-- xen/arch/x86/mm/shadow/types.h | 203 +---------------------------------------- xen/include/asm-x86/guest_pt.h | 202 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 215 insertions(+), 206 deletions(-) diff -r 9f68b6ae6243 -r b87cc4de3ca6 xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu Nov 13 10:50:50 2008 +0000 +++ b/xen/arch/x86/mm/shadow/multi.c Thu Nov 13 13:01:22 2008 +0000 @@ -35,6 +35,7 @@ #include #include #include +#include #include "private.h" #include "types.h" @@ -254,7 +255,7 @@ static uint32_t set_ad_bits(void *guest_ * Return 1 to indicate success and 0 for inconsistency */ static inline uint32_t -shadow_check_gwalk(struct vcpu *v, unsigned long va, walk_t *gw) +shadow_check_gwalk(struct vcpu *v, unsigned long va, walk_t *gw, int version) { struct domain *d = v->domain; guest_l1e_t *l1p; @@ -267,9 +268,8 @@ shadow_check_gwalk(struct vcpu *v, unsig ASSERT(shadow_locked_by_me(d)); - if ( gw->version == - atomic_read(&d->arch.paging.shadow.gtable_dirty_version) ) - return 1; + if ( version == atomic_read(&d->arch.paging.shadow.gtable_dirty_version) ) + return 1; /* We may consider caching guest page mapping from last * guest table walk. However considering this check happens @@ -401,9 +401,6 @@ guest_walk_tables(struct vcpu *v, unsign perfc_incr(shadow_guest_walk); memset(gw, 0, sizeof(*gw)); gw->va = va; - - gw->version = atomic_read(&d->arch.paging.shadow.gtable_dirty_version); - rmb(); /* Mandatory bits that must be set in every entry. We invert NX, to * calculate as if there were an "X" bit that allowed access. @@ -3173,6 +3170,7 @@ static int sh_page_fault(struct vcpu *v, fetch_type_t ft = 0; p2m_type_t p2mt; uint32_t rc; + int version; #if SHADOW_OPTIMIZATIONS & SHOPT_FAST_EMULATION int fast_emul = 0; #endif @@ -3316,6 +3314,8 @@ static int sh_page_fault(struct vcpu *v, } rewalk: + version = atomic_read(&d->arch.paging.shadow.gtable_dirty_version); + rmb(); rc = guest_walk_tables(v, va, &gw, regs->error_code); #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) @@ -3392,7 +3392,7 @@ static int sh_page_fault(struct vcpu *v, } #endif /* OOS */ - if ( !shadow_check_gwalk(v, va, &gw) ) + if ( !shadow_check_gwalk(v, va, &gw, version) ) { perfc_incr(shadow_inconsistent_gwalk); shadow_unlock(d); diff -r 9f68b6ae6243 -r b87cc4de3ca6 xen/arch/x86/mm/shadow/types.h --- a/xen/arch/x86/mm/shadow/types.h Thu Nov 13 10:50:50 2008 +0000 +++ b/xen/arch/x86/mm/shadow/types.h Thu Nov 13 13:01:22 2008 +0000 @@ -191,169 +191,13 @@ static inline shadow_l4e_t shadow_l4e_fr }) #endif - -/* Type of the guest's frame numbers */ -TYPE_SAFE(unsigned long,gfn) -#define SH_PRI_gfn "05lx" - -#define VALID_GFN(m) (m != INVALID_GFN) - -static inline int -valid_gfn(gfn_t m) -{ - return VALID_GFN(gfn_x(m)); -} - -static inline paddr_t -gfn_to_paddr(gfn_t gfn) -{ - return ((paddr_t)gfn_x(gfn)) << PAGE_SHIFT; -} - -/* Override gfn_to_mfn to work with gfn_t */ -#undef gfn_to_mfn -#define gfn_to_mfn(d, g, t) _gfn_to_mfn((d), gfn_x(g), (t)) +/* The shadow types needed for the various levels. */ #if GUEST_PAGING_LEVELS == 2 - -#include "../page-guest32.h" - -#define GUEST_L1_PAGETABLE_ENTRIES 1024 -#define GUEST_L2_PAGETABLE_ENTRIES 1024 -#define GUEST_L1_PAGETABLE_SHIFT 12 -#define GUEST_L2_PAGETABLE_SHIFT 22 - -/* Types of the guest's page tables */ -typedef l1_pgentry_32_t guest_l1e_t; -typedef l2_pgentry_32_t guest_l2e_t; -typedef intpte_32_t guest_intpte_t; - -/* Access functions for them */ -static inline paddr_t guest_l1e_get_paddr(guest_l1e_t gl1e) -{ return l1e_get_paddr_32(gl1e); } -static inline paddr_t guest_l2e_get_paddr(guest_l2e_t gl2e) -{ return l2e_get_paddr_32(gl2e); } - -static inline gfn_t guest_l1e_get_gfn(guest_l1e_t gl1e) -{ return _gfn(l1e_get_paddr_32(gl1e) >> PAGE_SHIFT); } -static inline gfn_t guest_l2e_get_gfn(guest_l2e_t gl2e) -{ return _gfn(l2e_get_paddr_32(gl2e) >> PAGE_SHIFT); } - -static inline u32 guest_l1e_get_flags(guest_l1e_t gl1e) -{ return l1e_get_flags_32(gl1e); } -static inline u32 guest_l2e_get_flags(guest_l2e_t gl2e) -{ return l2e_get_flags_32(gl2e); } - -static inline guest_l1e_t guest_l1e_add_flags(guest_l1e_t gl1e, u32 flags) -{ l1e_add_flags_32(gl1e, flags); return gl1e; } -static inline guest_l2e_t guest_l2e_add_flags(guest_l2e_t gl2e, u32 flags) -{ l2e_add_flags_32(gl2e, flags); return gl2e; } - -static inline guest_l1e_t guest_l1e_from_gfn(gfn_t gfn, u32 flags) -{ return l1e_from_pfn_32(gfn_x(gfn), flags); } -static inline guest_l2e_t guest_l2e_from_gfn(gfn_t gfn, u32 flags) -{ return l2e_from_pfn_32(gfn_x(gfn), flags); } - -#define guest_l1_table_offset(a) l1_table_offset_32(a) -#define guest_l2_table_offset(a) l2_table_offset_32(a) - -/* The shadow types needed for the various levels. */ #define SH_type_l1_shadow SH_type_l1_32_shadow #define SH_type_l2_shadow SH_type_l2_32_shadow #define SH_type_fl1_shadow SH_type_fl1_32_shadow - -#else /* GUEST_PAGING_LEVELS != 2 */ - -#if GUEST_PAGING_LEVELS == 3 -#define GUEST_L1_PAGETABLE_ENTRIES 512 -#define GUEST_L2_PAGETABLE_ENTRIES 512 -#define GUEST_L3_PAGETABLE_ENTRIES 4 -#define GUEST_L1_PAGETABLE_SHIFT 12 -#define GUEST_L2_PAGETABLE_SHIFT 21 -#define GUEST_L3_PAGETABLE_SHIFT 30 -#else /* GUEST_PAGING_LEVELS == 4 */ -#define GUEST_L1_PAGETABLE_ENTRIES 512 -#define GUEST_L2_PAGETABLE_ENTRIES 512 -#define GUEST_L3_PAGETABLE_ENTRIES 512 -#define GUEST_L4_PAGETABLE_ENTRIES 512 -#define GUEST_L1_PAGETABLE_SHIFT 12 -#define GUEST_L2_PAGETABLE_SHIFT 21 -#define GUEST_L3_PAGETABLE_SHIFT 30 -#define GUEST_L4_PAGETABLE_SHIFT 39 -#endif - -/* Types of the guest's page tables */ -typedef l1_pgentry_t guest_l1e_t; -typedef l2_pgentry_t guest_l2e_t; -typedef l3_pgentry_t guest_l3e_t; -#if GUEST_PAGING_LEVELS >= 4 -typedef l4_pgentry_t guest_l4e_t; -#endif -typedef intpte_t guest_intpte_t; - -/* Access functions for them */ -static inline paddr_t guest_l1e_get_paddr(guest_l1e_t gl1e) -{ return l1e_get_paddr(gl1e); } -static inline paddr_t guest_l2e_get_paddr(guest_l2e_t gl2e) -{ return l2e_get_paddr(gl2e); } -static inline paddr_t guest_l3e_get_paddr(guest_l3e_t gl3e) -{ return l3e_get_paddr(gl3e); } -#if GUEST_PAGING_LEVELS >= 4 -static inline paddr_t guest_l4e_get_paddr(guest_l4e_t gl4e) -{ return l4e_get_paddr(gl4e); } -#endif - -static inline gfn_t guest_l1e_get_gfn(guest_l1e_t gl1e) -{ return _gfn(l1e_get_paddr(gl1e) >> PAGE_SHIFT); } -static inline gfn_t guest_l2e_get_gfn(guest_l2e_t gl2e) -{ return _gfn(l2e_get_paddr(gl2e) >> PAGE_SHIFT); } -static inline gfn_t guest_l3e_get_gfn(guest_l3e_t gl3e) -{ return _gfn(l3e_get_paddr(gl3e) >> PAGE_SHIFT); } -#if GUEST_PAGING_LEVELS >= 4 -static inline gfn_t guest_l4e_get_gfn(guest_l4e_t gl4e) -{ return _gfn(l4e_get_paddr(gl4e) >> PAGE_SHIFT); } -#endif - -static inline u32 guest_l1e_get_flags(guest_l1e_t gl1e) -{ return l1e_get_flags(gl1e); } -static inline u32 guest_l2e_get_flags(guest_l2e_t gl2e) -{ return l2e_get_flags(gl2e); } -static inline u32 guest_l3e_get_flags(guest_l3e_t gl3e) -{ return l3e_get_flags(gl3e); } -#if GUEST_PAGING_LEVELS >= 4 -static inline u32 guest_l4e_get_flags(guest_l4e_t gl4e) -{ return l4e_get_flags(gl4e); } -#endif - -static inline guest_l1e_t guest_l1e_add_flags(guest_l1e_t gl1e, u32 flags) -{ l1e_add_flags(gl1e, flags); return gl1e; } -static inline guest_l2e_t guest_l2e_add_flags(guest_l2e_t gl2e, u32 flags) -{ l2e_add_flags(gl2e, flags); return gl2e; } -static inline guest_l3e_t guest_l3e_add_flags(guest_l3e_t gl3e, u32 flags) -{ l3e_add_flags(gl3e, flags); return gl3e; } -#if GUEST_PAGING_LEVELS >= 4 -static inline guest_l4e_t guest_l4e_add_flags(guest_l4e_t gl4e, u32 flags) -{ l4e_add_flags(gl4e, flags); return gl4e; } -#endif - -static inline guest_l1e_t guest_l1e_from_gfn(gfn_t gfn, u32 flags) -{ return l1e_from_pfn(gfn_x(gfn), flags); } -static inline guest_l2e_t guest_l2e_from_gfn(gfn_t gfn, u32 flags) -{ return l2e_from_pfn(gfn_x(gfn), flags); } -static inline guest_l3e_t guest_l3e_from_gfn(gfn_t gfn, u32 flags) -{ return l3e_from_pfn(gfn_x(gfn), flags); } -#if GUEST_PAGING_LEVELS >= 4 -static inline guest_l4e_t guest_l4e_from_gfn(gfn_t gfn, u32 flags) -{ return l4e_from_pfn(gfn_x(gfn), flags); } -#endif - -#define guest_l1_table_offset(a) l1_table_offset(a) -#define guest_l2_table_offset(a) l2_table_offset(a) -#define guest_l3_table_offset(a) l3_table_offset(a) -#define guest_l4_table_offset(a) l4_table_offset(a) - -/* The shadow types needed for the various levels. */ -#if GUEST_PAGING_LEVELS == 3 +#elif GUEST_PAGING_LEVELS == 3 #define SH_type_l1_shadow SH_type_l1_pae_shadow #define SH_type_fl1_shadow SH_type_fl1_pae_shadow #define SH_type_l2_shadow SH_type_l2_pae_shadow @@ -366,35 +210,6 @@ static inline guest_l4e_t guest_l4e_from #define SH_type_l3_shadow SH_type_l3_64_shadow #define SH_type_l4_shadow SH_type_l4_64_shadow #endif - -#endif /* GUEST_PAGING_LEVELS != 2 */ - - -/* Type used for recording a walk through guest pagetables. It is - * filled in by the pagetable walk function, and also used as a cache - * for later walks. When we encounter a suporpage l2e, we fabricate an - * l1e for propagation to the shadow (for splintering guest superpages - * into many shadow l1 entries). */ -typedef struct shadow_walk_t walk_t; -struct shadow_walk_t -{ - unsigned long va; /* Address we were looking for */ -#if GUEST_PAGING_LEVELS >= 3 -#if GUEST_PAGING_LEVELS >= 4 - guest_l4e_t l4e; /* Guest's level 4 entry */ -#endif - guest_l3e_t l3e; /* Guest's level 3 entry */ -#endif - guest_l2e_t l2e; /* Guest's level 2 entry */ - guest_l1e_t l1e; /* Guest's level 1 entry (or fabrication) */ -#if GUEST_PAGING_LEVELS >= 4 - mfn_t l4mfn; /* MFN that the level 4 entry was in */ - mfn_t l3mfn; /* MFN that the level 3 entry was in */ -#endif - mfn_t l2mfn; /* MFN that the level 2 entry was in */ - mfn_t l1mfn; /* MFN that the level 1 entry was in */ - int version; /* Saved guest dirty version */ -}; /* macros for dealing with the naming of the internal function names of the * shadow code's external entry points. @@ -460,17 +275,9 @@ struct shadow_walk_t #define MFN_FITS_IN_HVM_CR3(_MFN) !(mfn_x(_MFN) >> 20) #endif -#define SH_PRI_pte PRIpte - -#if GUEST_PAGING_LEVELS == 2 -#define SH_PRI_gpte "08x" -#else /* GUEST_PAGING_LEVELS >= 3 */ -#ifndef __x86_64__ -#define SH_PRI_gpte "016llx" -#else -#define SH_PRI_gpte "016lx" -#endif -#endif /* GUEST_PAGING_LEVELS >= 3 */ +#define SH_PRI_pte PRIpte +#define SH_PRI_gpte PRI_gpte +#define SH_PRI_gfn PRI_gfn #if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH) diff -r 9f68b6ae6243 -r b87cc4de3ca6 xen/include/asm-x86/guest_pt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/include/asm-x86/guest_pt.h Thu Nov 13 13:01:22 2008 +0000 @@ -0,0 +1,202 @@ +/****************************************************************************** + * xen/asm-x86/guest_pt.h + * + * Types and accessors for guest pagetable entries, as distinct from + * Xen's pagetable types. + * + * Users must #define GUEST_PAGING_LEVELS to 2, 3 or 4 before including + * this file. + * + * Parts of this code are Copyright (c) 2006 by XenSource Inc. + * Parts of this code are Copyright (c) 2006 by Michael A Fetterman + * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _XEN_ASM_GUEST_PT_H +#define _XEN_ASM_GUEST_PT_H + +/* Type of the guest's frame numbers */ +TYPE_SAFE(unsigned long,gfn) +#define PRI_gfn "05lx" + +#define VALID_GFN(m) (m != INVALID_GFN) + +static inline int +valid_gfn(gfn_t m) +{ + return VALID_GFN(gfn_x(m)); +} + +static inline paddr_t +gfn_to_paddr(gfn_t gfn) +{ + return ((paddr_t)gfn_x(gfn)) << PAGE_SHIFT; +} + +/* Override gfn_to_mfn to work with gfn_t */ +#undef gfn_to_mfn +#define gfn_to_mfn(d, g, t) _gfn_to_mfn((d), gfn_x(g), (t)) + + +/* Types of the guest's page tables and access functions for them */ + +#if GUEST_PAGING_LEVELS == 2 + +#define GUEST_L1_PAGETABLE_ENTRIES 1024 +#define GUEST_L2_PAGETABLE_ENTRIES 1024 +#define GUEST_L1_PAGETABLE_SHIFT 12 +#define GUEST_L2_PAGETABLE_SHIFT 22 + +typedef uint32_t guest_intpte_t; +typedef struct { guest_intpte_t l1; } guest_l1e_t; +typedef struct { guest_intpte_t l2; } guest_l2e_t; + +#define PRI_gpte "08x" + +static inline paddr_t guest_l1e_get_paddr(guest_l1e_t gl1e) +{ return ((paddr_t) gl1e.l1) & (PADDR_MASK & PAGE_MASK); } +static inline paddr_t guest_l2e_get_paddr(guest_l2e_t gl2e) +{ return ((paddr_t) gl2e.l2) & (PADDR_MASK & PAGE_MASK); } + +static inline gfn_t guest_l1e_get_gfn(guest_l1e_t gl1e) +{ return _gfn(guest_l1e_get_paddr(gl1e) >> PAGE_SHIFT); } +static inline gfn_t guest_l2e_get_gfn(guest_l2e_t gl2e) +{ return _gfn(guest_l2e_get_paddr(gl2e) >> PAGE_SHIFT); } + +static inline u32 guest_l1e_get_flags(guest_l1e_t gl1e) +{ return gl1e.l1 & 0xfff; } +static inline u32 guest_l2e_get_flags(guest_l2e_t gl2e) +{ return gl2e.l2 & 0xfff; } + +static inline guest_l1e_t guest_l1e_from_gfn(gfn_t gfn, u32 flags) +{ return (guest_l1e_t) { (gfn_x(gfn) << PAGE_SHIFT) | flags }; } +static inline guest_l2e_t guest_l2e_from_gfn(gfn_t gfn, u32 flags) +{ return (guest_l2e_t) { (gfn_x(gfn) << PAGE_SHIFT) | flags }; } + +#define guest_l1_table_offset(_va) \ + (((_va) >> GUEST_L1_PAGETABLE_SHIFT) & (GUEST_L1_PAGETABLE_ENTRIES - 1)) +#define guest_l2_table_offset(_va) \ + (((_va) >> GUEST_L2_PAGETABLE_SHIFT) & (GUEST_L2_PAGETABLE_ENTRIES - 1)) + +#else /* GUEST_PAGING_LEVELS != 2 */ + +#if GUEST_PAGING_LEVELS == 3 +#define GUEST_L1_PAGETABLE_ENTRIES 512 +#define GUEST_L2_PAGETABLE_ENTRIES 512 +#define GUEST_L3_PAGETABLE_ENTRIES 4 +#define GUEST_L1_PAGETABLE_SHIFT 12 +#define GUEST_L2_PAGETABLE_SHIFT 21 +#define GUEST_L3_PAGETABLE_SHIFT 30 +#else /* GUEST_PAGING_LEVELS == 4 */ +#define GUEST_L1_PAGETABLE_ENTRIES 512 +#define GUEST_L2_PAGETABLE_ENTRIES 512 +#define GUEST_L3_PAGETABLE_ENTRIES 512 +#define GUEST_L4_PAGETABLE_ENTRIES 512 +#define GUEST_L1_PAGETABLE_SHIFT 12 +#define GUEST_L2_PAGETABLE_SHIFT 21 +#define GUEST_L3_PAGETABLE_SHIFT 30 +#define GUEST_L4_PAGETABLE_SHIFT 39 +#endif + +typedef l1_pgentry_t guest_l1e_t; +typedef l2_pgentry_t guest_l2e_t; +typedef l3_pgentry_t guest_l3e_t; +#if GUEST_PAGING_LEVELS >= 4 +typedef l4_pgentry_t guest_l4e_t; +#endif +typedef intpte_t guest_intpte_t; + +#define PRI_gpte "016"PRIx64 + +static inline paddr_t guest_l1e_get_paddr(guest_l1e_t gl1e) +{ return l1e_get_paddr(gl1e); } +static inline paddr_t guest_l2e_get_paddr(guest_l2e_t gl2e) +{ return l2e_get_paddr(gl2e); } +static inline paddr_t guest_l3e_get_paddr(guest_l3e_t gl3e) +{ return l3e_get_paddr(gl3e); } +#if GUEST_PAGING_LEVELS >= 4 +static inline paddr_t guest_l4e_get_paddr(guest_l4e_t gl4e) +{ return l4e_get_paddr(gl4e); } +#endif + +static inline gfn_t guest_l1e_get_gfn(guest_l1e_t gl1e) +{ return _gfn(l1e_get_paddr(gl1e) >> PAGE_SHIFT); } +static inline gfn_t guest_l2e_get_gfn(guest_l2e_t gl2e) +{ return _gfn(l2e_get_paddr(gl2e) >> PAGE_SHIFT); } +static inline gfn_t guest_l3e_get_gfn(guest_l3e_t gl3e) +{ return _gfn(l3e_get_paddr(gl3e) >> PAGE_SHIFT); } +#if GUEST_PAGING_LEVELS >= 4 +static inline gfn_t guest_l4e_get_gfn(guest_l4e_t gl4e) +{ return _gfn(l4e_get_paddr(gl4e) >> PAGE_SHIFT); } +#endif + +static inline u32 guest_l1e_get_flags(guest_l1e_t gl1e) +{ return l1e_get_flags(gl1e); } +static inline u32 guest_l2e_get_flags(guest_l2e_t gl2e) +{ return l2e_get_flags(gl2e); } +static inline u32 guest_l3e_get_flags(guest_l3e_t gl3e) +{ return l3e_get_flags(gl3e); } +#if GUEST_PAGING_LEVELS >= 4 +static inline u32 guest_l4e_get_flags(guest_l4e_t gl4e) +{ return l4e_get_flags(gl4e); } +#endif + +static inline guest_l1e_t guest_l1e_from_gfn(gfn_t gfn, u32 flags) +{ return l1e_from_pfn(gfn_x(gfn), flags); } +static inline guest_l2e_t guest_l2e_from_gfn(gfn_t gfn, u32 flags) +{ return l2e_from_pfn(gfn_x(gfn), flags); } +static inline guest_l3e_t guest_l3e_from_gfn(gfn_t gfn, u32 flags) +{ return l3e_from_pfn(gfn_x(gfn), flags); } +#if GUEST_PAGING_LEVELS >= 4 +static inline guest_l4e_t guest_l4e_from_gfn(gfn_t gfn, u32 flags) +{ return l4e_from_pfn(gfn_x(gfn), flags); } +#endif + +#define guest_l1_table_offset(a) l1_table_offset(a) +#define guest_l2_table_offset(a) l2_table_offset(a) +#define guest_l3_table_offset(a) l3_table_offset(a) +#define guest_l4_table_offset(a) l4_table_offset(a) + +#endif /* GUEST_PAGING_LEVELS != 2 */ + + +/* Type used for recording a walk through guest pagetables. It is + * filled in by the pagetable walk function, and also used as a cache + * for later walks. When we encounter a superpage l2e, we fabricate an + * l1e for propagation to the shadow (for splintering guest superpages + * into many shadow l1 entries). */ +typedef struct guest_pagetable_walk walk_t; +struct guest_pagetable_walk +{ + unsigned long va; /* Address we were looking for */ +#if GUEST_PAGING_LEVELS >= 3 +#if GUEST_PAGING_LEVELS >= 4 + guest_l4e_t l4e; /* Guest's level 4 entry */ +#endif + guest_l3e_t l3e; /* Guest's level 3 entry */ +#endif + guest_l2e_t l2e; /* Guest's level 2 entry */ + guest_l1e_t l1e; /* Guest's level 1 entry (or fabrication) */ +#if GUEST_PAGING_LEVELS >= 4 + mfn_t l4mfn; /* MFN that the level 4 entry was in */ + mfn_t l3mfn; /* MFN that the level 3 entry was in */ +#endif + mfn_t l2mfn; /* MFN that the level 2 entry was in */ + mfn_t l1mfn; /* MFN that the level 1 entry was in */ +}; + +#endif /* _XEN_ASM_GUEST_PT_H */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:50 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:50 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pef-0001aJ-Tk; Wed, 19 Nov 2008 08:11:49 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pd5-0000eF-Mw for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:11 -0800 X-ASG-Debug-ID: 1227111002-0dd700010004-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id BBD45E6585 for ; Wed, 19 Nov 2008 08:10:09 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id MNKUiAtZymnYlNcq for ; Wed, 19 Nov 2008 08:10:09 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690537 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690537" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:08 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGA8bk004340 for ; Wed, 19 Nov 2008 08:10:08 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAWVO029791 for ; Wed, 19 Nov 2008 08:10:32 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAVEI029790 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:31 -0800 Message-Id: <200811191610.mAJGAVEI029790@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:31 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, hvm: Provide access to limited VCPUOP_ hypercalls. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111009 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, hvm: Provide access to limited VCPUOP_ hypercalls. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226585996 0 # Node ID d44ad6db638c1308e5ee4a47509769c3cccbe1e8 # Parent 48879ca5884866c38b99a984ddf2854dfc6f9ff0 x86, hvm: Provide access to limited VCPUOP_ hypercalls. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hvm.c | 41 +++++++++++++++++++++++++++++++++++++++++ xen/include/xen/hypercall.h | 6 ++++++ 2 files changed, 47 insertions(+) diff -r 48879ca58848 -r d44ad6db638c xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Thu Nov 13 13:03:16 2008 +0000 +++ b/xen/arch/x86/hvm/hvm.c Thu Nov 13 14:19:56 2008 +0000 @@ -1884,6 +1884,25 @@ static long hvm_memory_op(int cmd, XEN_G return rc; } +static long hvm_vcpu_op( + int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg) +{ + long rc; + + switch ( cmd ) + { + case VCPUOP_register_runstate_memory_area: + case VCPUOP_get_runstate_info: + rc = do_vcpu_op(cmd, vcpuid, arg); + break; + default: + rc = -ENOSYS; + break; + } + + return rc; +} + typedef unsigned long hvm_hypercall_t( unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); @@ -1895,6 +1914,7 @@ static hvm_hypercall_t *hvm_hypercall32_ static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = { [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op, [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op, + [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op, HYPERCALL(xen_version), HYPERCALL(event_channel_op), HYPERCALL(sched_op), @@ -1911,9 +1931,29 @@ static long hvm_memory_op_compat32(int c return rc; } +static long hvm_vcpu_op_compat32( + int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg) +{ + long rc; + + switch ( cmd ) + { + case VCPUOP_register_runstate_memory_area: + case VCPUOP_get_runstate_info: + rc = compat_vcpu_op(cmd, vcpuid, arg); + break; + default: + rc = -ENOSYS; + break; + } + + return rc; +} + static hvm_hypercall_t *hvm_hypercall64_table[NR_hypercalls] = { [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op, [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op, + [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op, HYPERCALL(xen_version), HYPERCALL(event_channel_op), HYPERCALL(sched_op), @@ -1923,6 +1963,7 @@ static hvm_hypercall_t *hvm_hypercall32_ static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = { [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op_compat32, [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op, + [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op_compat32, HYPERCALL(xen_version), HYPERCALL(event_channel_op), HYPERCALL(sched_op), diff -r 48879ca58848 -r d44ad6db638c xen/include/xen/hypercall.h --- a/xen/include/xen/hypercall.h Thu Nov 13 13:03:16 2008 +0000 +++ b/xen/include/xen/hypercall.h Thu Nov 13 14:19:56 2008 +0000 @@ -124,6 +124,12 @@ compat_memory_op( unsigned int cmd, XEN_GUEST_HANDLE(void) arg); +extern int +compat_vcpu_op( + int cmd, + int vcpuid, + XEN_GUEST_HANDLE(void) arg); + #endif #endif /* __XEN_HYPERCALL_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:11:56 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:11:56 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pem-0001eZ-7k; Wed, 19 Nov 2008 08:11:56 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pd7-0000ey-08 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:13 -0800 X-ASG-Debug-ID: 1227111002-0dd700010003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 0D418E6581 for ; Wed, 19 Nov 2008 08:10:08 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id z3LboaBtJ6CvLVx3 for ; Wed, 19 Nov 2008 08:10:08 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690536 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690536" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:07 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGA7BU004337 for ; Wed, 19 Nov 2008 08:10:07 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAVcY029773 for ; Wed, 19 Nov 2008 08:10:31 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAU0B029772 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:30 -0800 Message-Id: <200811191610.mAJGAU0B029772@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:30 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Use the shadow-code PT walker from the HAP functions X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111009 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Use the shadow-code PT walker from the HAP functions X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226581396 0 # Node ID 48879ca5884866c38b99a984ddf2854dfc6f9ff0 # Parent 7fb33d15dc9bc5892e4708011beded66dd756be3 x86: Use the shadow-code PT walker from the HAP functions Replace the guts of the HAP pagetable walker with a call to the newly-commonified walker from the shadow code. This reduces duplication, and gives HAP guests proper access control and A/D-bit setting for memory accesses from the emulator Signed-off-by: Tim Deegan --- xen/arch/x86/mm/page-guest32.h | 100 --------------------- xen/arch/x86/mm/hap/guest_walk.c | 181 +++++++++------------------------------ xen/arch/x86/mm/hap/private.h | 34 ------- 3 files changed, 46 insertions(+), 269 deletions(-) diff -r 7fb33d15dc9b -r 48879ca58848 xen/arch/x86/mm/hap/guest_walk.c --- a/xen/arch/x86/mm/hap/guest_walk.c Thu Nov 13 13:02:08 2008 +0000 +++ b/xen/arch/x86/mm/hap/guest_walk.c Thu Nov 13 13:03:16 2008 +0000 @@ -19,25 +19,58 @@ * Place - Suite 330, Boston, MA 02111-1307 USA. */ + +#include +#include #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include - -#include "private.h" #define _hap_gva_to_gfn(levels) hap_gva_to_gfn_##levels##level #define hap_gva_to_gfn(levels) _hap_gva_to_gfn(levels) -#if GUEST_PAGING_LEVELS > CONFIG_PAGING_LEVELS +#if GUEST_PAGING_LEVELS <= CONFIG_PAGING_LEVELS + +#include + +unsigned long hap_gva_to_gfn(GUEST_PAGING_LEVELS)( + struct vcpu *v, unsigned long gva, uint32_t *pfec) +{ + unsigned long cr3; + uint32_t missing; + mfn_t top_mfn; + void *top_map; + p2m_type_t p2mt; + walk_t gw; + + /* Get the top-level table's MFN */ + cr3 = v->arch.hvm_vcpu.guest_cr[3]; + top_mfn = gfn_to_mfn(v->domain, _gfn(cr3 >> PAGE_SHIFT), &p2mt); + if ( !p2m_is_ram(p2mt) ) + { + pfec[0] &= ~PFEC_page_present; + return INVALID_GFN; + } + + /* Map the top-level table and call the tree-walker */ + ASSERT(mfn_valid(mfn_x(top_mfn))); + top_map = map_domain_page(mfn_x(top_mfn)); +#if GUEST_PAGING_LEVELS == 3 + top_map += (cr3 & ~(PAGE_MASK | 31)); +#endif + missing = guest_walk_tables(v, gva, &gw, pfec[0], top_mfn, top_map); + unmap_domain_page(top_map); + + /* Interpret the answer */ + if ( missing == 0 ) + return gfn_x(guest_l1e_get_gfn(gw.l1e)); + + if ( missing & _PAGE_PRESENT ) + pfec[0] &= ~PFEC_page_present; + + return INVALID_GFN; +} + +#else unsigned long hap_gva_to_gfn(GUEST_PAGING_LEVELS)( struct vcpu *v, unsigned long gva, uint32_t *pfec) @@ -48,130 +81,8 @@ unsigned long hap_gva_to_gfn(GUEST_PAGIN return INVALID_GFN; } -#else - -#if GUEST_PAGING_LEVELS == 2 -#include "../page-guest32.h" -#define l1_pgentry_t l1_pgentry_32_t -#define l2_pgentry_t l2_pgentry_32_t -#undef l2e_get_flags -#define l2e_get_flags(x) l2e_get_flags_32(x) -#undef l1e_get_flags -#define l1e_get_flags(x) l1e_get_flags_32(x) #endif -unsigned long hap_gva_to_gfn(GUEST_PAGING_LEVELS)( - struct vcpu *v, unsigned long gva, uint32_t *pfec) -{ - unsigned long gcr3 = v->arch.hvm_vcpu.guest_cr[3]; - int mode = GUEST_PAGING_LEVELS; - int lev, index; - paddr_t gpa = 0; - unsigned long gpfn, mfn; - p2m_type_t p2mt; - int success = 1; - - l1_pgentry_t *l1e; - l2_pgentry_t *l2e; -#if GUEST_PAGING_LEVELS >= 3 - l3_pgentry_t *l3e; -#endif -#if GUEST_PAGING_LEVELS >= 4 - l4_pgentry_t *l4e; -#endif - - gpfn = (gcr3 >> PAGE_SHIFT); - for ( lev = mode; lev >= 1; lev-- ) - { - mfn = mfn_x(gfn_to_mfn(v->domain, gpfn, &p2mt)); - if ( !p2m_is_ram(p2mt) ) - { - HAP_PRINTK("bad pfn=0x%lx from gva=0x%lx at lev%d\n", gpfn, gva, - lev); - success = 0; - break; - } - ASSERT(mfn_valid(mfn)); - - index = (gva >> PT_SHIFT[mode][lev]) & (PT_ENTRIES[mode][lev]-1); - -#if GUEST_PAGING_LEVELS >= 4 - if ( lev == 4 ) - { - l4e = map_domain_page(mfn); - if ( !(l4e_get_flags(l4e[index]) & _PAGE_PRESENT) ) - { - HAP_PRINTK("Level 4 entry not present at index = %d\n", index); - success = 0; - } - gpfn = l4e_get_pfn(l4e[index]); - unmap_domain_page(l4e); - } -#endif - -#if GUEST_PAGING_LEVELS >= 3 - if ( lev == 3 ) - { - l3e = map_domain_page(mfn); -#if GUEST_PAGING_LEVELS == 3 - index += ((gcr3 >> 5) & 127) * 4; -#endif - if ( !(l3e_get_flags(l3e[index]) & _PAGE_PRESENT) ) - { - HAP_PRINTK("Level 3 entry not present at index = %d\n", index); - success = 0; - } - gpfn = l3e_get_pfn(l3e[index]); - unmap_domain_page(l3e); - } -#endif - - if ( lev == 2 ) - { - l2e = map_domain_page(mfn); - if ( !(l2e_get_flags(l2e[index]) & _PAGE_PRESENT) ) - { - HAP_PRINTK("Level 2 entry not present at index = %d\n", index); - success = 0; - } - - if ( l2e_get_flags(l2e[index]) & _PAGE_PSE ) - { - paddr_t mask = ((paddr_t)1 << PT_SHIFT[mode][2]) - 1; - HAP_PRINTK("guest page table is PSE\n"); - gpa = (l2e_get_intpte(l2e[index]) & ~mask) + (gva & mask); - unmap_domain_page(l2e); - break; /* last level page table, jump out from here */ - } - - gpfn = l2e_get_pfn(l2e[index]); - unmap_domain_page(l2e); - } - - if ( lev == 1 ) - { - l1e = map_domain_page(mfn); - if ( !(l1e_get_flags(l1e[index]) & _PAGE_PRESENT) ) - { - HAP_PRINTK("Level 1 entry not present at index = %d\n", index); - success = 0; - } - gpfn = l1e_get_pfn(l1e[index]); - gpa = (l1e_get_intpte(l1e[index]) & PAGE_MASK) + (gva &~PAGE_MASK); - unmap_domain_page(l1e); - } - - if ( success != 1 ) /* error happened, jump out */ - break; - } - - gpa &= PADDR_MASK; - HAP_PRINTK("success = %d, gva = %lx, gpa = %lx\n", success, gva, gpa); - - return (!success ? INVALID_GFN : ((paddr_t)gpa >> PAGE_SHIFT)); -} - -#endif /* * Local variables: diff -r 7fb33d15dc9b -r 48879ca58848 xen/arch/x86/mm/hap/private.h --- a/xen/arch/x86/mm/hap/private.h Thu Nov 13 13:02:08 2008 +0000 +++ b/xen/arch/x86/mm/hap/private.h Thu Nov 13 13:03:16 2008 +0000 @@ -20,9 +20,6 @@ #ifndef __HAP_PRIVATE_H__ #define __HAP_PRIVATE_H__ -#include -#include - /********************************************/ /* GUEST TRANSLATION FUNCS */ /********************************************/ @@ -33,36 +30,5 @@ unsigned long hap_gva_to_gfn_4level(stru unsigned long hap_gva_to_gfn_4level(struct vcpu *v, unsigned long gva, uint32_t *pfec); -/********************************************/ -/* MISC DEFINITIONS */ -/********************************************/ - -/* PT_SHIFT describes the amount by which a virtual address is shifted right - * to right justify the portion to be used for indexing into a page - * table, given the guest memory model (i.e. number of levels) and the level - * of the page table being accessed. The idea is from Virtual Iron's code. - */ -static const int PT_SHIFT[][5] = - { /* ------ level ------ nr_levels */ - /* 1 2 3 4 */ - { 0, 0, 0, 0, 0}, /* 0 not used */ - { 0, 0, 0, 0, 0}, /* 1 not used */ - { 0, 12, 22, 0, 0}, /* 2 */ - { 0, 12, 21, 30, 0}, /* 3 */ - { 0, 12, 21, 30, 39} /* 4 */ - }; - -/* PT_ENTRIES describes the number of entries in a page table, given the - * memory model (i.e. number of levels) and the level of the page table - * being considered. This idea from Virtual Iron's shadow code*/ -static const int PT_ENTRIES[][5] = - { /* ------ level ------ nr_levels */ - /* 1 2 3 4 */ - { 0, 0, 0, 0, 0}, /* 0 not used */ - { 0, 0, 0, 0, 0}, /* 1 not used */ - { 0, 1024, 1024, 0, 0}, /* 2 */ - { 0, 512, 512, 4, 0}, /* 3 */ - { 0, 512, 512, 512, 512} /* 4 */ - }; #endif /* __SVM_NPT_H__ */ diff -r 7fb33d15dc9b -r 48879ca58848 xen/arch/x86/mm/page-guest32.h --- a/xen/arch/x86/mm/page-guest32.h Thu Nov 13 13:02:08 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ - -#ifndef __X86_PAGE_GUEST_H__ -#define __X86_PAGE_GUEST_H__ - -#ifndef __ASSEMBLY__ -# include -#endif - -#define PAGETABLE_ORDER_32 10 -#define L1_PAGETABLE_ENTRIES_32 (1<> L1_PAGETABLE_SHIFT_32) & (L1_PAGETABLE_ENTRIES_32 - 1)) -#define l2_table_offset_32(a) \ - (((a) >> L2_PAGETABLE_SHIFT_32) & (L2_PAGETABLE_ENTRIES_32 - 1)) - -#endif /* __X86_PAGE_GUEST_H__ */ - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:03 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:03 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pet-0001ix-1T; Wed, 19 Nov 2008 08:12:03 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pd7-0000fB-7u for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:13 -0800 X-ASG-Debug-ID: 1227111002-0dd700010006-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id EB244E658B for ; Wed, 19 Nov 2008 08:10:11 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id yI4tjPU0hXjUrFxp for ; Wed, 19 Nov 2008 08:10:11 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690539 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690539" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:11 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAASE004346 for ; Wed, 19 Nov 2008 08:10:10 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAYDY029826 for ; Wed, 19 Nov 2008 08:10:34 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAYTu029825 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:34 -0800 Message-Id: <200811191610.mAJGAYTu029825@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:33 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] vt-d: Fix ia64 build. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111011 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] vt-d: Fix ia64 build. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226672828 0 # Node ID 3ba83def85a234d49ac426f46100dc2a6bcda761 # Parent a0910b1b5ec0c938f1c46437df6c28cbeff52c68 vt-d: Fix ia64 build. Signed-off-by: Keir Fraser --- xen/drivers/passthrough/vtd/intremap.c | 4 ++++ 1 files changed, 4 insertions(+) diff -r a0910b1b5ec0 -r 3ba83def85a2 xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Thu Nov 13 16:31:08 2008 +0000 +++ b/xen/drivers/passthrough/vtd/intremap.c Fri Nov 14 14:27:08 2008 +0000 @@ -30,6 +30,10 @@ #include "vtd.h" #include "extern.h" +#ifndef dest_SMI +#define dest_SMI -1 +#endif + u16 apicid_to_bdf(int apic_id) { struct acpi_drhd_unit *drhd = ioapic_to_drhd(apic_id); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:10 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:10 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pf0-0001nX-Io; Wed, 19 Nov 2008 08:12:10 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pd8-0000fT-10 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:14 -0800 X-ASG-Debug-ID: 1227111002-0dd700010005-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 01C9CE6586 for ; Wed, 19 Nov 2008 08:10:10 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id BksHk3YaJNVGtR7g for ; Wed, 19 Nov 2008 08:10:10 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690538 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690538" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:10 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGA9QC004343 for ; Wed, 19 Nov 2008 08:10:09 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAXgj029809 for ; Wed, 19 Nov 2008 08:10:33 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAXJp029808 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:33 -0800 Message-Id: <200811191610.mAJGAXJp029808@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:32 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: don't disable MSI in order to mask an IRQ X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111011 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86: don't disable MSI in order to mask an IRQ X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226593868 0 # Node ID a0910b1b5ec0c938f1c46437df6c28cbeff52c68 # Parent d44ad6db638c1308e5ee4a47509769c3cccbe1e8 x86: don't disable MSI in order to mask an IRQ ... as that's not really correct, and there are devices which can't even cope with that. Instead, check whether an MSI IRQ can be masked, and if it can't, treat it just like a level triggered IO-APIC IRQ. There's one other bug fix in here, correcting an off-by-one error on the entry_nr range check in __pci_enable_msix(). Signed-off-by: Jan Beulich --- xen/arch/x86/irq.c | 11 ++++++++--- xen/arch/x86/msi.c | 11 ++++++++--- xen/include/asm-x86/msi.h | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-) diff -r d44ad6db638c -r a0910b1b5ec0 xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Thu Nov 13 14:19:56 2008 +0000 +++ b/xen/arch/x86/irq.c Thu Nov 13 16:31:08 2008 +0000 @@ -463,12 +463,17 @@ int pirq_acktype(struct domain *d, int i /* * Edge-triggered IO-APIC and LAPIC interrupts need no final * acknowledgement: we ACK early during interrupt processing. - * MSIs are treated as edge-triggered interrupts. */ if ( !strcmp(desc->handler->typename, "IO-APIC-edge") || - !strcmp(desc->handler->typename, "local-APIC-edge") || - !strcmp(desc->handler->typename, "PCI-MSI") ) + !strcmp(desc->handler->typename, "local-APIC-edge") ) return ACKTYPE_NONE; + + /* + * MSIs are treated as edge-triggered interrupts, except + * when there is no proper way to mask them. + */ + if ( desc->handler == &pci_msi_type ) + return msi_maskable_irq(desc->msi_desc) ? ACKTYPE_NONE : ACKTYPE_EOI; /* * Level-triggered IO-APIC interrupts need to be acknowledged on the CPU diff -r d44ad6db638c -r a0910b1b5ec0 xen/arch/x86/msi.c --- a/xen/arch/x86/msi.c Thu Nov 13 14:19:56 2008 +0000 +++ b/xen/arch/x86/msi.c Thu Nov 13 16:31:08 2008 +0000 @@ -298,6 +298,13 @@ static void msix_flush_writes(unsigned i } } +int msi_maskable_irq(const struct msi_desc *entry) +{ + BUG_ON(!entry); + return entry->msi_attrib.type != PCI_CAP_ID_MSI + || entry->msi_attrib.maskbit; +} + static void msi_set_mask_bit(unsigned int irq, int flag) { struct msi_desc *entry = irq_desc[irq].msi_desc; @@ -318,8 +325,6 @@ static void msi_set_mask_bit(unsigned in mask_bits &= ~(1); mask_bits |= flag; pci_conf_write32(bus, slot, func, pos, mask_bits); - } else { - msi_set_enable(entry->dev, !flag); } break; case PCI_CAP_ID_MSIX: @@ -649,7 +654,7 @@ static int __pci_enable_msix(struct msi_ pos = pci_find_cap_offset(msi->bus, slot, func, PCI_CAP_ID_MSIX); control = pci_conf_read16(msi->bus, slot, func, msi_control_reg(pos)); nr_entries = multi_msix_capable(control); - if (msi->entry_nr > nr_entries) + if (msi->entry_nr >= nr_entries) { spin_unlock(&pdev->lock); return -EINVAL; diff -r d44ad6db638c -r a0910b1b5ec0 xen/include/asm-x86/msi.h --- a/xen/include/asm-x86/msi.h Thu Nov 13 14:19:56 2008 +0000 +++ b/xen/include/asm-x86/msi.h Thu Nov 13 16:31:08 2008 +0000 @@ -96,6 +96,8 @@ struct msi_desc { int remap_index; /* index in interrupt remapping table */ }; + +int msi_maskable_irq(const struct msi_desc *); /* * Assume the maximum number of hot plug slots supported by the system is about _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:17 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:17 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pf7-0001r8-Cg; Wed, 19 Nov 2008 08:12:17 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pd8-0000fn-Ii for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:14 -0800 X-ASG-Debug-ID: 1227111002-0dd700010007-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id D4D87E6585 for ; Wed, 19 Nov 2008 08:10:12 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id lxnCHK8pwbOSggpY for ; Wed, 19 Nov 2008 08:10:12 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690540 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690540" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:12 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGABww004349 for ; Wed, 19 Nov 2008 08:10:11 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAZZl029843 for ; Wed, 19 Nov 2008 08:10:35 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAZpT029842 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:35 -0800 Message-Id: <200811191610.mAJGAZpT029842@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:34 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Fix to save CPU affinity for xm save/restore X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111012 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Fix to save CPU affinity for xm save/restore X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226672871 0 # Node ID 85198c4d4da516000d002f66fded65f11ef64ab6 # Parent 3ba83def85a234d49ac426f46100dc2a6bcda761 Fix to save CPU affinity for xm save/restore Signed-off-by: Masaki Kanno --- tools/python/xen/xend/XendConfig.py | 2 -- 1 files changed, 2 deletions(-) diff -r 3ba83def85a2 -r 85198c4d4da5 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Fri Nov 14 14:27:08 2008 +0000 +++ b/tools/python/xen/xend/XendConfig.py Fri Nov 14 14:27:51 2008 +0000 @@ -1032,8 +1032,6 @@ class XendConfig(dict): sxpr.append([name, s]) for xenapi, legacy in XENAPI_CFG_TO_LEGACY_CFG.items(): - if legacy in ('cpus'): # skip this - continue if self.has_key(xenapi) and self[xenapi] not in (None, []): if type(self[xenapi]) == bool: # convert booleans to ints before making an sxp item _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:23 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:23 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pfD-0001v5-C2; Wed, 19 Nov 2008 08:12:23 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdA-0000h6-HT for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:16 -0800 X-ASG-Debug-ID: 1227111002-0dd700010009-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id A765AE6595 for ; Wed, 19 Nov 2008 08:10:14 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id JroggM7aI5XESF6w for ; Wed, 19 Nov 2008 08:10:14 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690542 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690542" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:13 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGADeX004355 for ; Wed, 19 Nov 2008 08:10:13 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAbPB029877 for ; Wed, 19 Nov 2008 08:10:37 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAbOk029876 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:37 -0800 Message-Id: <200811191610.mAJGAbOk029876@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:36 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] tools: use sysfs interface to balloon driver if present X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111014 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] tools: use sysfs interface to balloon driver if present X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226937271 0 # Node ID 17911073a90a09c0dd781c2f09368d2d8b4c883e # Parent 2188ed106885586376f7eb428b9ea9f16ec6f7c7 tools: use sysfs interface to balloon driver if present The pvops dom0 kernel does not expose the balloon driver via /proc/xen, so use the sysfs interface. Signed-off-by: Jeremy Fitzhardinge --- tools/python/xen/xend/osdep.py | 29 +++++++++++++++++++++++++++-- 1 files changed, 27 insertions(+), 2 deletions(-) diff -r 2188ed106885 -r 17911073a90a tools/python/xen/xend/osdep.py --- a/tools/python/xen/xend/osdep.py Fri Nov 14 14:33:25 2008 +0000 +++ b/tools/python/xen/xend/osdep.py Mon Nov 17 15:54:31 2008 +0000 @@ -38,7 +38,10 @@ _vif_script = { "SunOS": "vif-vnic" } -def _linux_balloon_stat(label): +PROC_XEN_BALLOON = '/proc/xen/balloon' +SYSFS_XEN_MEMORY = '/sys/devices/system/xen_memory/xen_memory0' + +def _linux_balloon_stat_proc(label): """Returns the value for the named label, or None if an error occurs.""" xend2linux_labels = { 'current' : 'Current allocation', @@ -47,7 +50,6 @@ def _linux_balloon_stat(label): 'high-balloon' : 'High-mem balloon', 'limit' : 'Xen hard limit' } - PROC_XEN_BALLOON = '/proc/xen/balloon' f = file(PROC_XEN_BALLOON, 'r') try: for line in f: @@ -61,6 +63,29 @@ def _linux_balloon_stat(label): return None finally: f.close() + +def _linux_balloon_stat_sysfs(label): + sysfiles = { 'target' : 'target_kb', + 'current' : 'info/current_kb', + 'low-balloon' : 'info/low_kb', + 'high-balloon' : 'info/high_kb', + 'limit' : 'info/hard_limit_kb' } + + name = os.path.join(SYSFS_XEN_MEMORY, sysfiles[label]) + f = file(name, 'r') + + val = f.read().strip() + if val.isdigit(): + return int(val) + return None + +def _linux_balloon_stat(label): + if os.access(PROC_XEN_BALLOON, os.F_OK): + return _linux_balloon_stat_proc(label) + elif os.access(SYSFS_XEN_MEMORY, os.F_OK): + return _linux_balloon_stat_sysfs(label) + + return None def _solaris_balloon_stat(label): """Returns the value for the named label, or None if an error occurs.""" _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:30 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:30 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pfJ-0001yt-M1; Wed, 19 Nov 2008 08:12:29 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdA-0000hB-KP for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:16 -0800 X-ASG-Debug-ID: 1227111002-0dd700010002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id EA3B5E6582 for ; Wed, 19 Nov 2008 08:10:07 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id E0va0mzVmJTWcnOA for ; Wed, 19 Nov 2008 08:10:07 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690535 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690535" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:06 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGA6Vn004334 for ; Wed, 19 Nov 2008 08:10:06 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGATUA029752 for ; Wed, 19 Nov 2008 08:10:29 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGATpj029751 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:29 -0800 Message-Id: <200811191610.mAJGATpj029751@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:28 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Move the guest pagetable walker out of shadow/multi.c X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111007 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Move the guest pagetable walker out of shadow/multi.c X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226581328 0 # Node ID 7fb33d15dc9bc5892e4708011beded66dd756be3 # Parent b87cc4de3ca676e895f6374daed1d33a79849b9d x86: Move the guest pagetable walker out of shadow/multi.c Move the guest PT walker into its own file, and purge it of references to the rest of the shadow code. Signed-off-by: Tim Deegan --- xen/arch/x86/mm/Makefile | 6 xen/arch/x86/mm/guest_walk.c | 260 +++++++++++++++++++++++++++++ xen/arch/x86/mm/shadow/multi.c | 341 ++------------------------------------- xen/include/asm-x86/guest_pt.h | 89 ++++++++++ xen/include/asm-x86/perfc_defn.h | 2 5 files changed, 378 insertions(+), 320 deletions(-) diff -r b87cc4de3ca6 -r 7fb33d15dc9b xen/arch/x86/mm/Makefile --- a/xen/arch/x86/mm/Makefile Thu Nov 13 13:01:22 2008 +0000 +++ b/xen/arch/x86/mm/Makefile Thu Nov 13 13:02:08 2008 +0000 @@ -3,3 +3,9 @@ subdir-y += hap obj-y += paging.o obj-y += p2m.o +obj-y += guest_walk_2.o +obj-y += guest_walk_3.o +obj-$(x86_64) += guest_walk_4.o + +guest_walk_%.o: guest_walk.c $(HDRS) Makefile + $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=$* -c $< -o $@ diff -r b87cc4de3ca6 -r 7fb33d15dc9b xen/arch/x86/mm/guest_walk.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/mm/guest_walk.c Thu Nov 13 13:02:08 2008 +0000 @@ -0,0 +1,260 @@ +/****************************************************************************** + * arch/x86/mm/guest_walk.c + * + * Pagetable walker for guest memory accesses. + * + * Parts of this code are Copyright (c) 2006 by XenSource Inc. + * Parts of this code are Copyright (c) 2006 by Michael A Fetterman + * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include + + +/* Flags that are needed in a pagetable entry, with the sense of NX inverted */ +static uint32_t mandatory_flags(struct vcpu *v, uint32_t pfec) +{ + static uint32_t flags[] = { + /* I/F - Usr Wr */ + /* 0 0 0 0 */ _PAGE_PRESENT, + /* 0 0 0 1 */ _PAGE_PRESENT|_PAGE_RW, + /* 0 0 1 0 */ _PAGE_PRESENT|_PAGE_USER, + /* 0 0 1 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER, + /* 0 1 0 0 */ _PAGE_PRESENT, + /* 0 1 0 1 */ _PAGE_PRESENT|_PAGE_RW, + /* 0 1 1 0 */ _PAGE_PRESENT|_PAGE_USER, + /* 0 1 1 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER, + /* 1 0 0 0 */ _PAGE_PRESENT|_PAGE_NX_BIT, + /* 1 0 0 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_NX_BIT, + /* 1 0 1 0 */ _PAGE_PRESENT|_PAGE_USER|_PAGE_NX_BIT, + /* 1 0 1 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_NX_BIT, + /* 1 1 0 0 */ _PAGE_PRESENT|_PAGE_NX_BIT, + /* 1 1 0 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_NX_BIT, + /* 1 1 1 0 */ _PAGE_PRESENT|_PAGE_USER|_PAGE_NX_BIT, + /* 1 1 1 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_NX_BIT, + }; + + /* Don't demand not-NX if the CPU wouldn't enforce it. */ + if ( !guest_supports_nx(v) ) + pfec &= ~PFEC_insn_fetch; + + /* Don't demand R/W if the CPU wouldn't enforce it. */ + if ( is_hvm_vcpu(v) && unlikely(!hvm_wp_enabled(v)) + && !(pfec & PFEC_user_mode) ) + pfec &= ~PFEC_write_access; + + return flags[(pfec & 0x1f) >> 1]; +} + +/* Modify a guest pagetable entry to set the Accessed and Dirty bits. + * Returns non-zero if it actually writes to guest memory. */ +static uint32_t set_ad_bits(void *guest_p, void *walk_p, int set_dirty) +{ + guest_intpte_t old, new; + + old = *(guest_intpte_t *)walk_p; + new = old | _PAGE_ACCESSED | (set_dirty ? _PAGE_DIRTY : 0); + if ( old != new ) + { + /* Write the new entry into the walk, and try to write it back + * into the guest table as well. If the guest table has changed + * under out feet then leave it alone. */ + *(guest_intpte_t *)walk_p = new; + if ( cmpxchg(((guest_intpte_t *)guest_p), old, new) == old ) + return 1; + } + return 0; +} + + +/* Walk the guest pagetables, after the manner of a hardware walker. */ +uint32_t +guest_walk_tables(struct vcpu *v, unsigned long va, walk_t *gw, + uint32_t pfec, mfn_t top_mfn, void *top_map) +{ + struct domain *d = v->domain; + p2m_type_t p2mt; + guest_l1e_t *l1p = NULL; + guest_l2e_t *l2p = NULL; +#if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */ + guest_l3e_t *l3p = NULL; + guest_l4e_t *l4p; +#endif + uint32_t gflags, mflags, rc = 0; + int pse; + + perfc_incr(guest_walk); + memset(gw, 0, sizeof(*gw)); + gw->va = va; + + /* Mandatory bits that must be set in every entry. We invert NX, to + * calculate as if there were an "X" bit that allowed access. + * We will accumulate, in rc, the set of flags that are missing. */ + mflags = mandatory_flags(v, pfec); + +#if GUEST_PAGING_LEVELS >= 3 /* PAE or 64... */ +#if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */ + + /* Get the l4e from the top level table and check its flags*/ + gw->l4mfn = top_mfn; + l4p = (guest_l4e_t *) top_map; + gw->l4e = l4p[guest_l4_table_offset(va)]; + gflags = guest_l4e_get_flags(gw->l4e) ^ _PAGE_NX_BIT; + rc |= ((gflags & mflags) ^ mflags); + if ( rc & _PAGE_PRESENT ) goto out; + + /* Map the l3 table */ + gw->l3mfn = gfn_to_mfn(d, guest_l4e_get_gfn(gw->l4e), &p2mt); + if ( !p2m_is_ram(p2mt) ) + { + rc |= _PAGE_PRESENT; + goto out; + } + ASSERT(mfn_valid(mfn_x(gw->l3mfn))); + + /* Get the l3e and check its flags*/ + l3p = map_domain_page(mfn_x(gw->l3mfn)); + gw->l3e = l3p[guest_l3_table_offset(va)]; + gflags = guest_l3e_get_flags(gw->l3e) ^ _PAGE_NX_BIT; + rc |= ((gflags & mflags) ^ mflags); + if ( rc & _PAGE_PRESENT ) + goto out; + +#else /* PAE only... */ + + /* Get the l3e and check its flag */ + gw->l3e = ((guest_l3e_t *) top_map)[guest_l3_table_offset(va)]; + if ( !(guest_l3e_get_flags(gw->l3e) & _PAGE_PRESENT) ) + { + rc |= _PAGE_PRESENT; + goto out; + } + +#endif /* PAE or 64... */ + + /* Map the l2 table */ + gw->l2mfn = gfn_to_mfn(d, guest_l3e_get_gfn(gw->l3e), &p2mt); + if ( !p2m_is_ram(p2mt) ) + { + rc |= _PAGE_PRESENT; + goto out; + } + ASSERT(mfn_valid(mfn_x(gw->l2mfn))); + + /* Get the l2e */ + l2p = map_domain_page(mfn_x(gw->l2mfn)); + gw->l2e = l2p[guest_l2_table_offset(va)]; + +#else /* 32-bit only... */ + + /* Get l2e from the top level table */ + gw->l2mfn = top_mfn; + l2p = (guest_l2e_t *) top_map; + gw->l2e = l2p[guest_l2_table_offset(va)]; + +#endif /* All levels... */ + + gflags = guest_l2e_get_flags(gw->l2e) ^ _PAGE_NX_BIT; + rc |= ((gflags & mflags) ^ mflags); + if ( rc & _PAGE_PRESENT ) + goto out; + + pse = (guest_supports_superpages(v) && + (guest_l2e_get_flags(gw->l2e) & _PAGE_PSE)); + + if ( pse ) + { + /* Special case: this guest VA is in a PSE superpage, so there's + * no guest l1e. We make one up so that the propagation code + * can generate a shadow l1 table. Start with the gfn of the + * first 4k-page of the superpage. */ + gfn_t start = guest_l2e_get_gfn(gw->l2e); + /* Grant full access in the l1e, since all the guest entry's + * access controls are enforced in the shadow l2e. */ + int flags = (_PAGE_PRESENT|_PAGE_USER|_PAGE_RW| + _PAGE_ACCESSED|_PAGE_DIRTY); + /* PSE level 2 entries use bit 12 for PAT; propagate it to bit 7 + * of the level 1. */ + if ( (guest_l2e_get_flags(gw->l2e) & _PAGE_PSE_PAT) ) + flags |= _PAGE_PAT; + /* Copy the cache-control bits to the l1 as well, because we + * can't represent PAT in the (non-PSE) shadow l2e. :( + * This could cause problems if a guest ever maps an area of + * memory with superpages using more than one caching mode. */ + flags |= guest_l2e_get_flags(gw->l2e) & (_PAGE_PWT|_PAGE_PCD); + /* Increment the pfn by the right number of 4k pages. + * The ~0x1 is to mask out the PAT bit mentioned above. */ + start = _gfn((gfn_x(start) & ~0x1) + guest_l1_table_offset(va)); + gw->l1e = guest_l1e_from_gfn(start, flags); + gw->l1mfn = _mfn(INVALID_MFN); + } + else + { + /* Not a superpage: carry on and find the l1e. */ + gw->l1mfn = gfn_to_mfn(d, guest_l2e_get_gfn(gw->l2e), &p2mt); + if ( !p2m_is_ram(p2mt) ) + { + rc |= _PAGE_PRESENT; + goto out; + } + ASSERT(mfn_valid(mfn_x(gw->l1mfn))); + l1p = map_domain_page(mfn_x(gw->l1mfn)); + gw->l1e = l1p[guest_l1_table_offset(va)]; + gflags = guest_l1e_get_flags(gw->l1e) ^ _PAGE_NX_BIT; + rc |= ((gflags & mflags) ^ mflags); + } + + /* Go back and set accessed and dirty bits only if the walk was a + * success. Although the PRMs say higher-level _PAGE_ACCESSED bits + * get set whenever a lower-level PT is used, at least some hardware + * walkers behave this way. */ + if ( rc == 0 ) + { +#if GUEST_PAGING_LEVELS == 4 /* 64-bit only... */ + if ( set_ad_bits(l4p + guest_l4_table_offset(va), &gw->l4e, 0) ) + paging_mark_dirty(d, mfn_x(gw->l4mfn)); + if ( set_ad_bits(l3p + guest_l3_table_offset(va), &gw->l3e, 0) ) + paging_mark_dirty(d, mfn_x(gw->l3mfn)); +#endif + if ( set_ad_bits(l2p + guest_l2_table_offset(va), &gw->l2e, + (pse && (pfec & PFEC_write_access))) ) + paging_mark_dirty(d, mfn_x(gw->l2mfn)); + if ( !pse ) + { + if ( set_ad_bits(l1p + guest_l1_table_offset(va), &gw->l1e, + (pfec & PFEC_write_access)) ) + paging_mark_dirty(d, mfn_x(gw->l1mfn)); + } + } + + out: +#if GUEST_PAGING_LEVELS == 4 + if ( l3p ) unmap_domain_page(l3p); +#endif +#if GUEST_PAGING_LEVELS >= 3 + if ( l2p ) unmap_domain_page(l2p); +#endif + if ( l1p ) unmap_domain_page(l1p); + + return rc; +} diff -r b87cc4de3ca6 -r 7fb33d15dc9b xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu Nov 13 13:01:22 2008 +0000 +++ b/xen/arch/x86/mm/shadow/multi.c Thu Nov 13 13:02:08 2008 +0000 @@ -157,95 +157,23 @@ delete_shadow_status(struct vcpu *v, mfn put_page(mfn_to_page(gmfn)); } -/**************************************************************************/ -/* CPU feature support querying */ - -static inline int -guest_supports_superpages(struct vcpu *v) -{ - /* The _PAGE_PSE bit must be honoured in HVM guests, whenever - * CR4.PSE is set or the guest is in PAE or long mode. - * It's also used in the dummy PT for vcpus with CR4.PG cleared. */ - return (is_hvm_vcpu(v) && - (GUEST_PAGING_LEVELS != 2 - || !hvm_paging_enabled(v) - || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE))); -} - -static inline int -guest_supports_nx(struct vcpu *v) -{ - if ( GUEST_PAGING_LEVELS == 2 || !cpu_has_nx ) - return 0; - if ( !is_hvm_vcpu(v) ) - return cpu_has_nx; - return hvm_nx_enabled(v); -} - /**************************************************************************/ /* Functions for walking the guest page tables */ -/* Flags that are needed in a pagetable entry, with the sense of NX inverted */ -static uint32_t mandatory_flags(struct vcpu *v, uint32_t pfec) -{ - static uint32_t flags[] = { - /* I/F - Usr Wr */ - /* 0 0 0 0 */ _PAGE_PRESENT, - /* 0 0 0 1 */ _PAGE_PRESENT|_PAGE_RW, - /* 0 0 1 0 */ _PAGE_PRESENT|_PAGE_USER, - /* 0 0 1 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER, - /* 0 1 0 0 */ _PAGE_PRESENT, - /* 0 1 0 1 */ _PAGE_PRESENT|_PAGE_RW, - /* 0 1 1 0 */ _PAGE_PRESENT|_PAGE_USER, - /* 0 1 1 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER, - /* 1 0 0 0 */ _PAGE_PRESENT|_PAGE_NX_BIT, - /* 1 0 0 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_NX_BIT, - /* 1 0 1 0 */ _PAGE_PRESENT|_PAGE_USER|_PAGE_NX_BIT, - /* 1 0 1 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_NX_BIT, - /* 1 1 0 0 */ _PAGE_PRESENT|_PAGE_NX_BIT, - /* 1 1 0 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_NX_BIT, - /* 1 1 1 0 */ _PAGE_PRESENT|_PAGE_USER|_PAGE_NX_BIT, - /* 1 1 1 1 */ _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_NX_BIT, - }; - - /* Don't demand not-NX if the CPU wouldn't enforce it. */ - if ( !guest_supports_nx(v) ) - pfec &= ~PFEC_insn_fetch; - - /* Don't demand R/W if the CPU wouldn't enforce it. */ - if ( is_hvm_vcpu(v) && unlikely(!hvm_wp_enabled(v)) - && !(pfec & PFEC_user_mode) ) - pfec &= ~PFEC_write_access; - - return flags[(pfec & 0x1f) >> 1]; -} - -/* Modify a guest pagetable entry to set the Accessed and Dirty bits. - * Returns non-zero if it actually writes to guest memory. */ -static uint32_t set_ad_bits(void *guest_p, void *walk_p, int set_dirty) -{ - guest_intpte_t old, new; - int ret = 0; - - old = *(guest_intpte_t *)walk_p; - new = old | _PAGE_ACCESSED | (set_dirty ? _PAGE_DIRTY : 0); - if ( old != new ) - { - /* Write the new entry into the walk, and try to write it back - * into the guest table as well. If the guest table has changed - * under out feet then leave it alone. */ - *(guest_intpte_t *)walk_p = new; - if( cmpxchg(((guest_intpte_t *)guest_p), old, new) == old ) - ret = 1; - - /* FIXME -- this code is longer than necessary */ - if(set_dirty) - TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SET_AD); - else - TRACE_SHADOW_PATH_FLAG(TRCE_SFLAG_SET_A); - } - return ret; +static inline uint32_t +sh_walk_guest_tables(struct vcpu *v, unsigned long va, walk_t *gw, + uint32_t pfec) +{ + return guest_walk_tables(v, va, gw, pfec, +#if GUEST_PAGING_LEVELS == 3 /* PAE */ + _mfn(INVALID_MFN), + v->arch.paging.shadow.gl3e +#else /* 32 or 64 */ + pagetable_get_mfn(v->arch.guest_table), + v->arch.paging.shadow.guest_vtable +#endif + ); } /* This validation is called with lock held, and after write permission @@ -364,236 +292,6 @@ gw_remove_write_accesses(struct vcpu *v, return rc; } -/* Walk the guest pagetables, after the manner of a hardware walker. - * - * Inputs: a vcpu, a virtual address, a walk_t to fill, a - * pointer to a pagefault code - * - * We walk the vcpu's guest pagetables, filling the walk_t with what we - * see and adding any Accessed and Dirty bits that are needed in the - * guest entries. Using the pagefault code, we check the permissions as - * we go. For the purposes of reading pagetables we treat all non-RAM - * memory as contining zeroes. - * - * The walk is done in a lock-free style, with some sanity check postponed - * after grabbing shadow lock later. Those delayed checks will make sure - * no inconsistent mapping being translated into shadow page table. - * - * Returns 0 for success, or the set of permission bits that we failed on - * if the walk did not complete. - * N.B. This is different from the old return code but almost no callers - * checked the old return code anyway. - */ -static uint32_t -guest_walk_tables(struct vcpu *v, unsigned long va, walk_t *gw, uint32_t pfec) -{ - struct domain *d = v->domain; - p2m_type_t p2mt; - guest_l1e_t *l1p = NULL; - guest_l2e_t *l2p = NULL; -#if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */ - guest_l3e_t *l3p = NULL; - guest_l4e_t *l4p; -#endif - uint32_t gflags, mflags, rc = 0; - int pse; - - perfc_incr(shadow_guest_walk); - memset(gw, 0, sizeof(*gw)); - gw->va = va; - - /* Mandatory bits that must be set in every entry. We invert NX, to - * calculate as if there were an "X" bit that allowed access. - * We will accumulate, in rc, the set of flags that are missing. */ - mflags = mandatory_flags(v, pfec); - -#if GUEST_PAGING_LEVELS >= 3 /* PAE or 64... */ -#if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */ - - /* Get the l4e from the top level table and check its flags*/ - gw->l4mfn = pagetable_get_mfn(v->arch.guest_table); - l4p = ((guest_l4e_t *)v->arch.paging.shadow.guest_vtable); - gw->l4e = l4p[guest_l4_table_offset(va)]; - gflags = guest_l4e_get_flags(gw->l4e) ^ _PAGE_NX_BIT; - rc |= ((gflags & mflags) ^ mflags); - if ( rc & _PAGE_PRESENT ) goto out; - - /* Map the l3 table */ - gw->l3mfn = gfn_to_mfn(d, guest_l4e_get_gfn(gw->l4e), &p2mt); - if ( !p2m_is_ram(p2mt) ) - { - rc |= _PAGE_PRESENT; - goto out; - } - ASSERT(mfn_valid(gw->l3mfn)); - - /* Get the l3e and check its flags*/ - l3p = sh_map_domain_page(gw->l3mfn); - gw->l3e = l3p[guest_l3_table_offset(va)]; - gflags = guest_l3e_get_flags(gw->l3e) ^ _PAGE_NX_BIT; - rc |= ((gflags & mflags) ^ mflags); - if ( rc & _PAGE_PRESENT ) - goto out; - -#else /* PAE only... */ - - /* Get l3e from the cache of the top level table and check its flag */ - gw->l3e = v->arch.paging.shadow.gl3e[guest_l3_table_offset(va)]; - if ( !(guest_l3e_get_flags(gw->l3e) & _PAGE_PRESENT) ) - { - rc |= _PAGE_PRESENT; - goto out; - } - -#endif /* PAE or 64... */ - - /* Map the l2 table */ - gw->l2mfn = gfn_to_mfn(d, guest_l3e_get_gfn(gw->l3e), &p2mt); - if ( !p2m_is_ram(p2mt) ) - { - rc |= _PAGE_PRESENT; - goto out; - } - ASSERT(mfn_valid(gw->l2mfn)); - - /* Get the l2e */ - l2p = sh_map_domain_page(gw->l2mfn); - gw->l2e = l2p[guest_l2_table_offset(va)]; - -#else /* 32-bit only... */ - - /* Get l2e from the top level table */ - gw->l2mfn = pagetable_get_mfn(v->arch.guest_table); - l2p = ((guest_l2e_t *)v->arch.paging.shadow.guest_vtable); - gw->l2e = l2p[guest_l2_table_offset(va)]; - -#endif /* All levels... */ - - gflags = guest_l2e_get_flags(gw->l2e) ^ _PAGE_NX_BIT; - rc |= ((gflags & mflags) ^ mflags); - if ( rc & _PAGE_PRESENT ) - goto out; - - pse = (guest_supports_superpages(v) && - (guest_l2e_get_flags(gw->l2e) & _PAGE_PSE)); - - if ( pse ) - { - /* Special case: this guest VA is in a PSE superpage, so there's - * no guest l1e. We make one up so that the propagation code - * can generate a shadow l1 table. Start with the gfn of the - * first 4k-page of the superpage. */ - gfn_t start = guest_l2e_get_gfn(gw->l2e); - /* Grant full access in the l1e, since all the guest entry's - * access controls are enforced in the shadow l2e. */ - int flags = (_PAGE_PRESENT|_PAGE_USER|_PAGE_RW| - _PAGE_ACCESSED|_PAGE_DIRTY); - /* PSE level 2 entries use bit 12 for PAT; propagate it to bit 7 - * of the level 1. */ - if ( (guest_l2e_get_flags(gw->l2e) & _PAGE_PSE_PAT) ) - flags |= _PAGE_PAT; - /* Copy the cache-control bits to the l1 as well, because we - * can't represent PAT in the (non-PSE) shadow l2e. :( - * This could cause problems if a guest ever maps an area of - * memory with superpages using more than one caching mode. */ - flags |= guest_l2e_get_flags(gw->l2e) & (_PAGE_PWT|_PAGE_PCD); - /* Increment the pfn by the right number of 4k pages. - * The ~0x1 is to mask out the PAT bit mentioned above. */ - start = _gfn((gfn_x(start) & ~0x1) + guest_l1_table_offset(va)); - gw->l1e = guest_l1e_from_gfn(start, flags); - gw->l1mfn = _mfn(INVALID_MFN); - } - else - { - /* Not a superpage: carry on and find the l1e. */ - gw->l1mfn = gfn_to_mfn(d, guest_l2e_get_gfn(gw->l2e), &p2mt); - if ( !p2m_is_ram(p2mt) ) - { - rc |= _PAGE_PRESENT; - goto out; - } - ASSERT(mfn_valid(gw->l1mfn)); - l1p = sh_map_domain_page(gw->l1mfn); - gw->l1e = l1p[guest_l1_table_offset(va)]; - gflags = guest_l1e_get_flags(gw->l1e) ^ _PAGE_NX_BIT; - rc |= ((gflags & mflags) ^ mflags); - } - - /* Go back and set accessed and dirty bits only if the walk was a - * success. Although the PRMs say higher-level _PAGE_ACCESSED bits - * get set whenever a lower-level PT is used, at least some hardware - * walkers behave this way. */ - if ( rc == 0 ) - { -#if GUEST_PAGING_LEVELS == 4 /* 64-bit only... */ - if ( set_ad_bits(l4p + guest_l4_table_offset(va), &gw->l4e, 0) ) - paging_mark_dirty(d, mfn_x(gw->l4mfn)); - if ( set_ad_bits(l3p + guest_l3_table_offset(va), &gw->l3e, 0) ) - paging_mark_dirty(d, mfn_x(gw->l3mfn)); -#endif - if ( set_ad_bits(l2p + guest_l2_table_offset(va), &gw->l2e, - (pse && (pfec & PFEC_write_access))) ) - paging_mark_dirty(d, mfn_x(gw->l2mfn)); - if ( !pse ) - { - if ( set_ad_bits(l1p + guest_l1_table_offset(va), &gw->l1e, - (pfec & PFEC_write_access)) ) - paging_mark_dirty(d, mfn_x(gw->l1mfn)); - } - } - - out: -#if GUEST_PAGING_LEVELS == 4 - if ( l3p ) sh_unmap_domain_page(l3p); -#endif -#if GUEST_PAGING_LEVELS >= 3 - if ( l2p ) sh_unmap_domain_page(l2p); -#endif - if ( l1p ) sh_unmap_domain_page(l1p); - - return rc; -} - -/* Given a walk_t, translate the gw->va into the guest's notion of the - * corresponding frame number. */ -static inline gfn_t -guest_walk_to_gfn(walk_t *gw) -{ - if ( !(guest_l1e_get_flags(gw->l1e) & _PAGE_PRESENT) ) - return _gfn(INVALID_GFN); - return guest_l1e_get_gfn(gw->l1e); -} - -/* Given a walk_t, translate the gw->va into the guest's notion of the - * corresponding physical address. */ -static inline paddr_t -guest_walk_to_gpa(walk_t *gw) -{ - if ( !(guest_l1e_get_flags(gw->l1e) & _PAGE_PRESENT) ) - return 0; - return guest_l1e_get_paddr(gw->l1e) + (gw->va & ~PAGE_MASK); -} - -#if 0 /* Keep for debugging */ -/* Pretty-print the contents of a guest-walk */ -static inline void print_gw(walk_t *gw) -{ - SHADOW_PRINTK("GUEST WALK TO %#lx:\n", gw->va); -#if GUEST_PAGING_LEVELS >= 3 /* PAE or 64... */ -#if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */ - SHADOW_PRINTK(" l4mfn=%" PRI_mfn "\n", mfn_x(gw->l4mfn)); - SHADOW_PRINTK(" l4e=%" SH_PRI_gpte "\n", gw->l4e.l4); - SHADOW_PRINTK(" l3mfn=%" PRI_mfn "\n", mfn_x(gw->l3mfn)); -#endif /* PAE or 64... */ - SHADOW_PRINTK(" l3e=%" SH_PRI_gpte "\n", gw->l3e.l3); -#endif /* All levels... */ - SHADOW_PRINTK(" l2mfn=%" PRI_mfn "\n", mfn_x(gw->l2mfn)); - SHADOW_PRINTK(" l2e=%" SH_PRI_gpte "\n", gw->l2e.l2); - SHADOW_PRINTK(" l1mfn=%" PRI_mfn "\n", mfn_x(gw->l1mfn)); - SHADOW_PRINTK(" l1e=%" SH_PRI_gpte "\n", gw->l1e.l1); -} -#endif /* 0 */ - #if SHADOW_AUDIT & SHADOW_AUDIT_ENTRIES /* Lightweight audit: pass all the shadows associated with this guest walk * through the audit mechanisms */ @@ -654,7 +352,7 @@ sh_guest_map_l1e(struct vcpu *v, unsigne // XXX -- this is expensive, but it's easy to cobble together... // FIXME! - if ( guest_walk_tables(v, addr, &gw, PFEC_page_present) == 0 + if ( sh_walk_guest_tables(v, addr, &gw, PFEC_page_present) == 0 && mfn_valid(gw.l1mfn) ) { if ( gl1mfn ) @@ -676,7 +374,7 @@ sh_guest_get_eff_l1e(struct vcpu *v, uns // XXX -- this is expensive, but it's easy to cobble together... // FIXME! - (void) guest_walk_tables(v, addr, &gw, PFEC_page_present); + (void) sh_walk_guest_tables(v, addr, &gw, PFEC_page_present); *(guest_l1e_t *)eff_l1e = gw.l1e; } #endif /* CONFIG == GUEST (== SHADOW) */ @@ -3314,9 +3012,14 @@ static int sh_page_fault(struct vcpu *v, } rewalk: + + /* The walk is done in a lock-free style, with some sanity check + * postponed after grabbing shadow lock later. Those delayed checks + * will make sure no inconsistent mapping being translated into + * shadow page table. */ version = atomic_read(&d->arch.paging.shadow.gtable_dirty_version); rmb(); - rc = guest_walk_tables(v, va, &gw, regs->error_code); + rc = sh_walk_guest_tables(v, va, &gw, regs->error_code); #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) regs->error_code &= ~PFEC_page_present; @@ -3869,7 +3572,7 @@ sh_gva_to_gfn(struct vcpu *v, unsigned l return vtlb_gfn; #endif /* (SHADOW_OPTIMIZATIONS & SHOPT_VIRTUAL_TLB) */ - if ( guest_walk_tables(v, va, &gw, pfec[0]) != 0 ) + if ( sh_walk_guest_tables(v, va, &gw, pfec[0]) != 0 ) { if ( !(guest_l1e_get_flags(gw.l1e) & _PAGE_PRESENT) ) pfec[0] &= ~PFEC_page_present; diff -r b87cc4de3ca6 -r 7fb33d15dc9b xen/include/asm-x86/guest_pt.h --- a/xen/include/asm-x86/guest_pt.h Thu Nov 13 13:01:22 2008 +0000 +++ b/xen/include/asm-x86/guest_pt.h Thu Nov 13 13:02:08 2008 +0000 @@ -174,6 +174,32 @@ static inline guest_l4e_t guest_l4e_from #endif /* GUEST_PAGING_LEVELS != 2 */ +/* Which pagetable features are supported on this vcpu? */ + +static inline int +guest_supports_superpages(struct vcpu *v) +{ + /* The _PAGE_PSE bit must be honoured in HVM guests, whenever + * CR4.PSE is set or the guest is in PAE or long mode. + * It's also used in the dummy PT for vcpus with CR4.PG cleared. */ + return (is_hvm_vcpu(v) && + (GUEST_PAGING_LEVELS != 2 + || !hvm_paging_enabled(v) + || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE))); +} + +static inline int +guest_supports_nx(struct vcpu *v) +{ + if ( GUEST_PAGING_LEVELS == 2 || !cpu_has_nx ) + return 0; + if ( !is_hvm_vcpu(v) ) + return cpu_has_nx; + return hvm_nx_enabled(v); +} + + + /* Type used for recording a walk through guest pagetables. It is * filled in by the pagetable walk function, and also used as a cache * for later walks. When we encounter a superpage l2e, we fabricate an @@ -199,4 +225,67 @@ struct guest_pagetable_walk mfn_t l1mfn; /* MFN that the level 1 entry was in */ }; +/* Given a walk_t, translate the gw->va into the guest's notion of the + * corresponding frame number. */ +static inline gfn_t +guest_walk_to_gfn(walk_t *gw) +{ + if ( !(guest_l1e_get_flags(gw->l1e) & _PAGE_PRESENT) ) + return _gfn(INVALID_GFN); + return guest_l1e_get_gfn(gw->l1e); +} + +/* Given a walk_t, translate the gw->va into the guest's notion of the + * corresponding physical address. */ +static inline paddr_t +guest_walk_to_gpa(walk_t *gw) +{ + if ( !(guest_l1e_get_flags(gw->l1e) & _PAGE_PRESENT) ) + return 0; + return guest_l1e_get_paddr(gw->l1e) + (gw->va & ~PAGE_MASK); +} + +/* Walk the guest pagetables, after the manner of a hardware walker. + * + * Inputs: a vcpu, a virtual address, a walk_t to fill, a + * pointer to a pagefault code, the MFN of the guest's + * top-level pagetable, and a mapping of the + * guest's top-level pagetable. + * + * We walk the vcpu's guest pagetables, filling the walk_t with what we + * see and adding any Accessed and Dirty bits that are needed in the + * guest entries. Using the pagefault code, we check the permissions as + * we go. For the purposes of reading pagetables we treat all non-RAM + * memory as contining zeroes. + * + * Returns 0 for success, or the set of permission bits that we failed on + * if the walk did not complete. */ + +/* Macro-fu so you can call guest_walk_tables() and get the right one. */ +#define GPT_RENAME2(_n, _l) _n ## _ ## _l ## _levels +#define GPT_RENAME(_n, _l) GPT_RENAME2(_n, _l) +#define guest_walk_tables GPT_RENAME(guest_walk_tables, GUEST_PAGING_LEVELS) + +extern uint32_t +guest_walk_tables(struct vcpu *v, unsigned long va, walk_t *gw, + uint32_t pfec, mfn_t top_mfn, void *top_map); + +/* Pretty-print the contents of a guest-walk */ +static inline void print_gw(walk_t *gw) +{ + gdprintk(XENLOG_INFO, "GUEST WALK TO %#lx:\n", gw->va); +#if GUEST_PAGING_LEVELS >= 3 /* PAE or 64... */ +#if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */ + gdprintk(XENLOG_INFO, " l4mfn=%" PRI_mfn "\n", mfn_x(gw->l4mfn)); + gdprintk(XENLOG_INFO, " l4e=%" PRI_gpte "\n", gw->l4e.l4); + gdprintk(XENLOG_INFO, " l3mfn=%" PRI_mfn "\n", mfn_x(gw->l3mfn)); +#endif /* PAE or 64... */ + gdprintk(XENLOG_INFO, " l3e=%" PRI_gpte "\n", gw->l3e.l3); +#endif /* All levels... */ + gdprintk(XENLOG_INFO, " l2mfn=%" PRI_mfn "\n", mfn_x(gw->l2mfn)); + gdprintk(XENLOG_INFO, " l2e=%" PRI_gpte "\n", gw->l2e.l2); + gdprintk(XENLOG_INFO, " l1mfn=%" PRI_mfn "\n", mfn_x(gw->l1mfn)); + gdprintk(XENLOG_INFO, " l1e=%" PRI_gpte "\n", gw->l1e.l1); +} + #endif /* _XEN_ASM_GUEST_PT_H */ diff -r b87cc4de3ca6 -r 7fb33d15dc9b xen/include/asm-x86/perfc_defn.h --- a/xen/include/asm-x86/perfc_defn.h Thu Nov 13 13:01:22 2008 +0000 +++ b/xen/include/asm-x86/perfc_defn.h Thu Nov 13 13:02:08 2008 +0000 @@ -33,6 +33,7 @@ PERFCOUNTER(ptwr_emulations, "wri PERFCOUNTER(exception_fixed, "pre-exception fixed") +PERFCOUNTER(guest_walk, "guest pagetable walks") /* Shadow counters */ PERFCOUNTER(shadow_alloc, "calls to shadow_alloc") @@ -92,7 +93,6 @@ PERFCOUNTER(shadow_up_pointer, "shad PERFCOUNTER(shadow_up_pointer, "shadow unshadow by up-pointer") PERFCOUNTER(shadow_unshadow_bf, "shadow unshadow brute-force") PERFCOUNTER(shadow_get_page_fail, "shadow_get_page_from_l1e failed") -PERFCOUNTER(shadow_guest_walk, "shadow walks guest tables") PERFCOUNTER(shadow_check_gwalk, "shadow checks gwalk") PERFCOUNTER(shadow_inconsistent_gwalk, "shadow check inconsistent gwalk") PERFCOUNTER(shadow_rm_write_flush_tlb, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:37 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:37 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pfR-00022c-1D; Wed, 19 Nov 2008 08:12:37 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdA-0000hP-U1 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:16 -0800 X-ASG-Debug-ID: 1227111002-0dd700010008-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id F09AFE6591 for ; Wed, 19 Nov 2008 08:10:13 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id NwerBg0GKAzsTrwC for ; Wed, 19 Nov 2008 08:10:13 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690541 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690541" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:12 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGACUt004352 for ; Wed, 19 Nov 2008 08:10:12 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAafu029860 for ; Wed, 19 Nov 2008 08:10:36 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAaru029859 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:36 -0800 Message-Id: <200811191610.mAJGAaru029859@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:35 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Remove NR_PIRQS definition -- always use NR_IRQS. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111013 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Remove NR_PIRQS definition -- always use NR_IRQS. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226673205 0 # Node ID 2188ed106885586376f7eb428b9ea9f16ec6f7c7 # Parent 85198c4d4da516000d002f66fded65f11ef64ab6 Remove NR_PIRQS definition -- always use NR_IRQS. Signed-off-by: Keir Fraser --- xen/include/asm-x86/pirq.h | 11 ----------- xen/arch/x86/irq.c | 12 ++++++------ xen/drivers/passthrough/io.c | 4 ++-- xen/drivers/passthrough/pci.c | 6 +++--- xen/drivers/passthrough/vtd/x86/vtd.c | 6 +++--- xen/include/asm-ia64/hvm/irq.h | 1 - xen/include/asm-x86/domain.h | 3 +-- xen/include/asm-x86/hvm/irq.h | 1 - xen/include/xen/hvm/irq.h | 2 +- 9 files changed, 16 insertions(+), 30 deletions(-) diff -r 85198c4d4da5 -r 2188ed106885 xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Fri Nov 14 14:27:51 2008 +0000 +++ b/xen/arch/x86/irq.c Fri Nov 14 14:33:25 2008 +0000 @@ -770,15 +770,15 @@ int get_free_pirq(struct domain *d, int if ( type == MAP_PIRQ_TYPE_GSI ) { - for ( i = 16; i < NR_PIRQS; i++ ) + for ( i = 16; i < NR_IRQS; i++ ) if ( !d->arch.pirq_vector[i] ) break; - if ( i == NR_PIRQS ) + if ( i == NR_IRQS ) return -ENOSPC; } else { - for ( i = NR_PIRQS - 1; i >= 16; i-- ) + for ( i = NR_IRQS - 1; i >= 16; i-- ) if ( !d->arch.pirq_vector[i] ) break; if ( i == 16 ) @@ -805,7 +805,7 @@ int map_domain_pirq( if ( !IS_PRIV(current->domain) ) return -EPERM; - if ( pirq < 0 || pirq >= NR_PIRQS || vector < 0 || vector >= NR_VECTORS ) + if ( pirq < 0 || pirq >= NR_IRQS || vector < 0 || vector >= NR_VECTORS ) { dprintk(XENLOG_G_ERR, "dom%d: invalid pirq %d or vector %d\n", d->domain_id, pirq, vector); @@ -862,7 +862,7 @@ int unmap_domain_pirq(struct domain *d, int vector, ret = 0; bool_t forced_unbind; - if ( (pirq < 0) || (pirq >= NR_PIRQS) ) + if ( (pirq < 0) || (pirq >= NR_IRQS) ) return -EINVAL; if ( !IS_PRIV(current->domain) ) @@ -926,7 +926,7 @@ void free_domain_pirqs(struct domain *d) spin_lock(&d->event_lock); - for ( i = 0; i < NR_PIRQS; i++ ) + for ( i = 0; i < NR_IRQS; i++ ) if ( d->arch.pirq_vector[i] > 0 ) unmap_domain_pirq(d, i); diff -r 85198c4d4da5 -r 2188ed106885 xen/drivers/passthrough/io.c --- a/xen/drivers/passthrough/io.c Fri Nov 14 14:27:51 2008 +0000 +++ b/xen/drivers/passthrough/io.c Fri Nov 14 14:33:25 2008 +0000 @@ -62,7 +62,7 @@ int pt_irq_create_bind_vtd( struct dev_intx_gsi_link *digl; int pirq = pt_irq_bind->machine_irq; - if ( pirq < 0 || pirq >= NR_PIRQS ) + if ( pirq < 0 || pirq >= NR_IRQS ) return -EINVAL; spin_lock(&d->event_lock); @@ -261,7 +261,7 @@ void hvm_dpci_msi_eoi(struct domain *d, spin_lock(&d->event_lock); pirq = hvm_irq_dpci->msi_gvec_pirq[vector]; - if ( ( pirq >= 0 ) && (pirq < NR_PIRQS) && + if ( ( pirq >= 0 ) && (pirq < NR_IRQS) && test_bit(pirq, hvm_irq_dpci->mapping) && (test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[pirq].flags))) { diff -r 85198c4d4da5 -r 2188ed106885 xen/drivers/passthrough/pci.c --- a/xen/drivers/passthrough/pci.c Fri Nov 14 14:27:51 2008 +0000 +++ b/xen/drivers/passthrough/pci.c Fri Nov 14 14:33:25 2008 +0000 @@ -171,9 +171,9 @@ static void pci_clean_dpci_irqs(struct d hvm_irq_dpci = domain_get_irq_dpci(d); if ( hvm_irq_dpci != NULL ) { - for ( i = find_first_bit(hvm_irq_dpci->mapping, NR_PIRQS); - i < NR_PIRQS; - i = find_next_bit(hvm_irq_dpci->mapping, NR_PIRQS, i + 1) ) + for ( i = find_first_bit(hvm_irq_dpci->mapping, NR_IRQS); + i < NR_IRQS; + i = find_next_bit(hvm_irq_dpci->mapping, NR_IRQS, i + 1) ) { pirq_guest_unbind(d, i); kill_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(i)]); diff -r 85198c4d4da5 -r 2188ed106885 xen/drivers/passthrough/vtd/x86/vtd.c --- a/xen/drivers/passthrough/vtd/x86/vtd.c Fri Nov 14 14:27:51 2008 +0000 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c Fri Nov 14 14:33:25 2008 +0000 @@ -121,9 +121,9 @@ void hvm_dpci_isairq_eoi(struct domain * return; } /* Multiple mirq may be mapped to one isa irq */ - for ( i = find_first_bit(dpci->mapping, NR_PIRQS); - i < NR_PIRQS; - i = find_next_bit(dpci->mapping, NR_PIRQS, i + 1) ) + for ( i = find_first_bit(dpci->mapping, NR_IRQS); + i < NR_IRQS; + i = find_next_bit(dpci->mapping, NR_IRQS, i + 1) ) { list_for_each_entry_safe ( digl, tmp, &dpci->mirq[i].digl_list, list ) diff -r 85198c4d4da5 -r 2188ed106885 xen/include/asm-ia64/hvm/irq.h --- a/xen/include/asm-ia64/hvm/irq.h Fri Nov 14 14:27:51 2008 +0000 +++ b/xen/include/asm-ia64/hvm/irq.h Fri Nov 14 14:33:25 2008 +0000 @@ -26,7 +26,6 @@ #define NR_VECTORS 256 #define VIOAPIC_NUM_PINS 48 -#define NR_PIRQS 256 #include diff -r 85198c4d4da5 -r 2188ed106885 xen/include/asm-x86/domain.h --- a/xen/include/asm-x86/domain.h Fri Nov 14 14:27:51 2008 +0000 +++ b/xen/include/asm-x86/domain.h Fri Nov 14 14:33:25 2008 +0000 @@ -6,7 +6,6 @@ #include #include #include -#include #define has_32bit_shinfo(d) ((d)->arch.has_32bit_shinfo) #define is_pv_32bit_domain(d) ((d)->arch.is_32bit_pv) @@ -237,7 +236,7 @@ struct arch_domain /* NB. protected by d->event_lock and by irq_desc[vector].lock */ int vector_pirq[NR_VECTORS]; - int pirq_vector[NR_PIRQS]; + int pirq_vector[NR_IRQS]; /* Pseudophysical e820 map (XENMEM_memory_map). */ struct e820entry e820[3]; diff -r 85198c4d4da5 -r 2188ed106885 xen/include/asm-x86/hvm/irq.h --- a/xen/include/asm-x86/hvm/irq.h Fri Nov 14 14:27:51 2008 +0000 +++ b/xen/include/asm-x86/hvm/irq.h Fri Nov 14 14:33:25 2008 +0000 @@ -22,7 +22,6 @@ #ifndef __ASM_X86_HVM_IRQ_H__ #define __ASM_X86_HVM_IRQ_H__ -#include #include #include #include diff -r 85198c4d4da5 -r 2188ed106885 xen/include/asm-x86/pirq.h --- a/xen/include/asm-x86/pirq.h Fri Nov 14 14:27:51 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#ifndef __XEN_PIRQ_H -#define __XEN_PIRQ_H - -#define PIRQ_BASE 0 -#define NR_PIRQS 256 - -#define DYNIRQ_BASE (PIRQ_BASE + NR_PIRQS) -#define NR_DYNIRQS 256 - -#endif /* __XEN_PIRQ_H */ - diff -r 85198c4d4da5 -r 2188ed106885 xen/include/xen/hvm/irq.h --- a/xen/include/xen/hvm/irq.h Fri Nov 14 14:27:51 2008 +0000 +++ b/xen/include/xen/hvm/irq.h Fri Nov 14 14:33:25 2008 +0000 @@ -63,7 +63,7 @@ struct hvm_girq_dpci_mapping { /* Protected by domain's event_lock */ struct hvm_irq_dpci { /* Machine IRQ to guest device/intx mapping. */ - DECLARE_BITMAP(mapping, NR_PIRQS); + DECLARE_BITMAP(mapping, NR_IRQS); struct hvm_mirq_dpci_mapping mirq[NR_IRQS]; /* Guest IRQ to guest device/intx mapping. */ struct hvm_girq_dpci_mapping girq[NR_IRQS]; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:45 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:45 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pfZ-00027A-0k; Wed, 19 Nov 2008 08:12:45 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdB-0000hb-7g for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:17 -0800 X-ASG-Debug-ID: 1227111002-0dd70001000a-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id C2E38E6585 for ; Wed, 19 Nov 2008 08:10:15 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id KccvOZnVcEDk07wA for ; Wed, 19 Nov 2008 08:10:15 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690543 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690543" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:14 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAEqR004358 for ; Wed, 19 Nov 2008 08:10:14 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAcqD029895 for ; Wed, 19 Nov 2008 08:10:38 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAcJI029894 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:38 -0800 Message-Id: <200811191610.mAJGAcJI029894@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:37 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] hvm: Fix hvm_vcpu_reset_state() to act on specified domain, rather X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111015 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] hvm: Fix hvm_vcpu_reset_state() to act on specified domain, rather X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226937356 0 # Node ID 7dd7220641285076bc6894221b9d8ac46d5e922a # Parent 17911073a90a09c0dd781c2f09368d2d8b4c883e hvm: Fix hvm_vcpu_reset_state() to act on specified domain, rather than current. Signed-off-by: Liping Ke --- xen/arch/x86/hvm/hvm.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 17911073a90a -r 7dd722064128 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Mon Nov 17 15:54:31 2008 +0000 +++ b/xen/arch/x86/hvm/hvm.c Mon Nov 17 15:55:56 2008 +0000 @@ -2122,7 +2122,7 @@ static int hvmop_set_pci_intx_level( void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip) { - struct domain *d = current->domain; + struct domain *d = v->domain; struct vcpu_guest_context *ctxt; struct segment_register reg; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:51 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:51 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pff-0002Ar-98; Wed, 19 Nov 2008 08:12:51 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdD-0000iG-1H for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:19 -0800 X-ASG-Debug-ID: 1227111002-0dd70001000b-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id EB843E659A for ; Wed, 19 Nov 2008 08:10:16 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id wLZ60J0vb6Lf1WZk for ; Wed, 19 Nov 2008 08:10:16 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690544 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690544" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:15 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAF0p004361 for ; Wed, 19 Nov 2008 08:10:15 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAdW5029912 for ; Wed, 19 Nov 2008 08:10:39 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAdwE029911 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:39 -0800 Message-Id: <200811191610.mAJGAdwE029911@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:38 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] vtd: fix memory allocation from NUMA node for VT-d. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111016 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] vtd: fix memory allocation from NUMA node for VT-d. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227005562 0 # Node ID 2604400f75e318dc9f5201e3626213290a89862a # Parent 7dd7220641285076bc6894221b9d8ac46d5e922a vtd: fix memory allocation from NUMA node for VT-d. Signed-off-by: Yuji Shimada --- xen/drivers/passthrough/vtd/ia64/vtd.c | 5 +++-- xen/drivers/passthrough/vtd/intremap.c | 2 +- xen/drivers/passthrough/vtd/iommu.c | 8 ++++---- xen/drivers/passthrough/vtd/qinval.c | 2 +- xen/drivers/passthrough/vtd/vtd.h | 2 +- xen/drivers/passthrough/vtd/x86/vtd.c | 5 +++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff -r 7dd722064128 -r 2604400f75e3 xen/drivers/passthrough/vtd/ia64/vtd.c --- a/xen/drivers/passthrough/vtd/ia64/vtd.c Mon Nov 17 15:55:56 2008 +0000 +++ b/xen/drivers/passthrough/vtd/ia64/vtd.c Tue Nov 18 10:52:42 2008 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include "../iommu.h" @@ -44,12 +45,12 @@ void unmap_vtd_domain_page(void *va) } /* Allocate page table, return its machine address */ -u64 alloc_pgtable_maddr(void) +u64 alloc_pgtable_maddr(struct domain *d) { struct page_info *pg; u64 *vaddr; - pg = alloc_domheap_page(NULL, 0); + pg = alloc_domheap_page(NULL, d ? MEMF_node(domain_to_node(d)) : 0); vaddr = map_domain_page(page_to_mfn(pg)); if ( !vaddr ) return 0; diff -r 7dd722064128 -r 2604400f75e3 xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Mon Nov 17 15:55:56 2008 +0000 +++ b/xen/drivers/passthrough/vtd/intremap.c Tue Nov 18 10:52:42 2008 +0000 @@ -502,7 +502,7 @@ int intremap_setup(struct iommu *iommu) ir_ctrl = iommu_ir_ctrl(iommu); if ( ir_ctrl->iremap_maddr == 0 ) { - ir_ctrl->iremap_maddr = alloc_pgtable_maddr(); + ir_ctrl->iremap_maddr = alloc_pgtable_maddr(NULL); if ( ir_ctrl->iremap_maddr == 0 ) { dprintk(XENLOG_WARNING VTDPREFIX, diff -r 7dd722064128 -r 2604400f75e3 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Mon Nov 17 15:55:56 2008 +0000 +++ b/xen/drivers/passthrough/vtd/iommu.c Tue Nov 18 10:52:42 2008 +0000 @@ -148,7 +148,7 @@ static u64 bus_to_context_maddr(struct i root = &root_entries[bus]; if ( !root_present(*root) ) { - maddr = alloc_pgtable_maddr(); + maddr = alloc_pgtable_maddr(NULL); if ( maddr == 0 ) { unmap_vtd_domain_page(root_entries); @@ -205,7 +205,7 @@ static u64 addr_to_dma_page_maddr(struct addr &= (((u64)1) << addr_width) - 1; spin_lock_irqsave(&hd->mapping_lock, flags); if ( hd->pgd_maddr == 0 ) - if ( !alloc || ((hd->pgd_maddr = alloc_pgtable_maddr()) == 0) ) + if ( !alloc || ((hd->pgd_maddr = alloc_pgtable_maddr(domain)) == 0) ) goto out; parent = (struct dma_pte *)map_vtd_domain_page(hd->pgd_maddr); @@ -218,7 +218,7 @@ static u64 addr_to_dma_page_maddr(struct { if ( !alloc ) break; - maddr = alloc_pgtable_maddr(); + maddr = alloc_pgtable_maddr(domain); if ( !maddr ) break; dma_set_pte_addr(*pte, maddr); @@ -605,7 +605,7 @@ static int iommu_set_root_entry(struct i spin_lock_irqsave(&iommu->register_lock, flags); if ( iommu->root_maddr == 0 ) - iommu->root_maddr = alloc_pgtable_maddr(); + iommu->root_maddr = alloc_pgtable_maddr(NULL); if ( iommu->root_maddr == 0 ) { spin_unlock_irqrestore(&iommu->register_lock, flags); diff -r 7dd722064128 -r 2604400f75e3 xen/drivers/passthrough/vtd/qinval.c --- a/xen/drivers/passthrough/vtd/qinval.c Mon Nov 17 15:55:56 2008 +0000 +++ b/xen/drivers/passthrough/vtd/qinval.c Tue Nov 18 10:52:42 2008 +0000 @@ -426,7 +426,7 @@ int qinval_setup(struct iommu *iommu) if ( qi_ctrl->qinval_maddr == 0 ) { - qi_ctrl->qinval_maddr = alloc_pgtable_maddr(); + qi_ctrl->qinval_maddr = alloc_pgtable_maddr(NULL); if ( qi_ctrl->qinval_maddr == 0 ) { dprintk(XENLOG_WARNING VTDPREFIX, diff -r 7dd722064128 -r 2604400f75e3 xen/drivers/passthrough/vtd/vtd.h --- a/xen/drivers/passthrough/vtd/vtd.h Mon Nov 17 15:55:56 2008 +0000 +++ b/xen/drivers/passthrough/vtd/vtd.h Tue Nov 18 10:52:42 2008 +0000 @@ -101,7 +101,7 @@ void cacheline_flush(char *); void cacheline_flush(char *); void flush_all_cache(void); void *map_to_nocache_virt(int nr_iommus, u64 maddr); -u64 alloc_pgtable_maddr(void); +u64 alloc_pgtable_maddr(struct domain *d); void free_pgtable_maddr(u64 maddr); void *map_vtd_domain_page(u64 maddr); void unmap_vtd_domain_page(void *va); diff -r 7dd722064128 -r 2604400f75e3 xen/drivers/passthrough/vtd/x86/vtd.c --- a/xen/drivers/passthrough/vtd/x86/vtd.c Mon Nov 17 15:55:56 2008 +0000 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c Tue Nov 18 10:52:42 2008 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include "../iommu.h" #include "../dmar.h" #include "../vtd.h" @@ -37,13 +38,13 @@ void unmap_vtd_domain_page(void *va) } /* Allocate page table, return its machine address */ -u64 alloc_pgtable_maddr(void) +u64 alloc_pgtable_maddr(struct domain *d) { struct page_info *pg; u64 *vaddr; unsigned long mfn; - pg = alloc_domheap_page(NULL, 0); + pg = alloc_domheap_page(NULL, d ? MEMF_node(domain_to_node(d)) : 0); if ( !pg ) return 0; mfn = page_to_mfn(pg); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:12:57 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:12:57 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pfl-0002Eg-O2; Wed, 19 Nov 2008 08:12:57 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdD-0000iZ-Mq for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:19 -0800 X-ASG-Debug-ID: 1227111002-0dd70001000c-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id BCF79E6585 for ; Wed, 19 Nov 2008 08:10:17 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id AgvgjTjrY4hs2hI5 for ; Wed, 19 Nov 2008 08:10:17 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690545 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690545" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:16 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAGps004364 for ; Wed, 19 Nov 2008 08:10:16 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAep8029929 for ; Wed, 19 Nov 2008 08:10:40 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAe4a029928 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:40 -0800 Message-Id: <200811191610.mAJGAe4a029928@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:39 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, hvm: Implement interrupt routing to least priority processor. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111017 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, hvm: Implement interrupt routing to least priority processor. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227006996 0 # Node ID ae891977a4d3f5d8d8330ed3796881867b4d88a8 # Parent 2604400f75e318dc9f5201e3626213290a89862a x86, hvm: Implement interrupt routing to least priority processor. Instead of round robin the vcpu with the lowest processor priority is selected for the interrupt. If multiple vcpus share the same low priority then interrupts are distributed between those round robin. Signed-off-by: Juergen Gross Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vioapic.c | 4 +-- xen/arch/x86/hvm/vlapic.c | 42 +++++++++++++++++++++------------------ xen/arch/x86/hvm/vmsi.c | 2 - xen/include/asm-x86/hvm/vlapic.h | 3 -- 4 files changed, 27 insertions(+), 24 deletions(-) diff -r 2604400f75e3 -r ae891977a4d3 xen/arch/x86/hvm/vioapic.c --- a/xen/arch/x86/hvm/vioapic.c Tue Nov 18 10:52:42 2008 +0000 +++ b/xen/arch/x86/hvm/vioapic.c Tue Nov 18 11:16:36 2008 +0000 @@ -344,8 +344,8 @@ static void vioapic_deliver(struct hvm_h } else #endif - target = apic_round_robin(vioapic_domain(vioapic), - vector, deliver_bitmask); + target = apic_lowest_prio(vioapic_domain(vioapic), + deliver_bitmask); if ( target != NULL ) { ioapic_inj_irq(vioapic, target, vector, trig_mode, delivery_mode); diff -r 2604400f75e3 -r ae891977a4d3 xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Tue Nov 18 10:52:42 2008 +0000 +++ b/xen/arch/x86/hvm/vlapic.c Tue Nov 18 11:16:36 2008 +0000 @@ -377,26 +377,30 @@ static int vlapic_accept_irq(struct vcpu } /* This function is used by both ioapic and lapic.The bitmap is for vcpu_id. */ -struct vlapic *apic_round_robin( - struct domain *d, uint8_t vector, uint32_t bitmap) -{ - int next, old; - struct vlapic *target = NULL; - - old = next = d->arch.hvm_domain.irq.round_robin_prev_vcpu; +struct vlapic *apic_lowest_prio(struct domain *d, uint32_t bitmap) +{ + int old = d->arch.hvm_domain.irq.round_robin_prev_vcpu; + uint32_t ppr, target_ppr = UINT_MAX; + struct vlapic *vlapic, *target = NULL; + struct vcpu *v; + + if ( unlikely((v = d->vcpu[old]) == NULL) ) + return NULL; do { - if ( ++next == MAX_VIRT_CPUS ) - next = 0; - if ( (d->vcpu[next] == NULL) || !test_bit(next, &bitmap) ) - continue; - target = vcpu_vlapic(d->vcpu[next]); - if ( vlapic_enabled(target) ) - break; - target = NULL; - } while ( next != old ); - - d->arch.hvm_domain.irq.round_robin_prev_vcpu = next; + v = v->next_in_list ? : d->vcpu[0]; + vlapic = vcpu_vlapic(v); + if ( test_bit(v->vcpu_id, &bitmap) && vlapic_enabled(vlapic) && + ((ppr = vlapic_get_ppr(vlapic)) < target_ppr) ) + { + target = vlapic; + target_ppr = ppr; + } + } while ( v->vcpu_id != old ); + + if ( target != NULL ) + d->arch.hvm_domain.irq.round_robin_prev_vcpu = + vlapic_vcpu(target)->vcpu_id; return target; } @@ -456,7 +460,7 @@ int vlapic_ipi( if ( delivery_mode == APIC_DM_LOWEST ) { - target = apic_round_robin(vlapic_domain(v), vector, lpr_map); + target = apic_lowest_prio(vlapic_domain(v), lpr_map); if ( target != NULL ) rc = vlapic_accept_irq(vlapic_vcpu(target), delivery_mode, vector, level, trig_mode); diff -r 2604400f75e3 -r ae891977a4d3 xen/arch/x86/hvm/vmsi.c --- a/xen/arch/x86/hvm/vmsi.c Tue Nov 18 10:52:42 2008 +0000 +++ b/xen/arch/x86/hvm/vmsi.c Tue Nov 18 11:16:36 2008 +0000 @@ -152,7 +152,7 @@ int vmsi_deliver(struct domain *d, int p { case dest_LowestPrio: { - target = apic_round_robin(d, vector, deliver_bitmask); + target = apic_lowest_prio(d, deliver_bitmask); if ( target != NULL ) vmsi_inj_irq(d, target, vector, trig_mode, delivery_mode); else diff -r 2604400f75e3 -r ae891977a4d3 xen/include/asm-x86/hvm/vlapic.h --- a/xen/include/asm-x86/hvm/vlapic.h Tue Nov 18 10:52:42 2008 +0000 +++ b/xen/include/asm-x86/hvm/vlapic.h Tue Nov 18 11:16:36 2008 +0000 @@ -93,8 +93,7 @@ void vlapic_msr_set(struct vlapic *vlapi int vlapic_accept_pic_intr(struct vcpu *v); -struct vlapic *apic_round_robin( - struct domain *d, uint8_t vector, uint32_t bitmap); +struct vlapic *apic_lowest_prio(struct domain *d, uint32_t bitmap); int vlapic_match_logical_addr(struct vlapic *vlapic, uint8_t mda); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:05 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:05 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pft-0002Jl-Dy; Wed, 19 Nov 2008 08:13:05 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdE-0000jH-Mw for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:20 -0800 X-ASG-Debug-ID: 1227111002-0dd70001000d-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id C9164E65A0 for ; Wed, 19 Nov 2008 08:10:18 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id OVjf6OKd5fdtd4iX for ; Wed, 19 Nov 2008 08:10:18 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690546 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690546" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:17 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAHA5004367 for ; Wed, 19 Nov 2008 08:10:17 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAfPi029946 for ; Wed, 19 Nov 2008 08:10:41 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAfJQ029945 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:41 -0800 Message-Id: <200811191610.mAJGAfJQ029945@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:40 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, time: Clean up platform timer initialisation. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111018 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, time: Clean up platform timer initialisation. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227022771 0 # Node ID 85fda344dba7cf9d22ff0a792d70e032ce6c1b40 # Parent ae891977a4d3f5d8d8330ed3796881867b4d88a8 x86, time: Clean up platform timer initialisation. Signed-off-by: Guanqun Lu Signed-off-by: Kevin Tian Signed-off-by: Keir Fraser --- xen/arch/x86/time.c | 106 +++++++++++++++++++++++++++++++++------------------- 1 files changed, 68 insertions(+), 38 deletions(-) diff -r ae891977a4d3 -r 85fda344dba7 xen/arch/x86/time.c --- a/xen/arch/x86/time.c Tue Nov 18 11:16:36 2008 +0000 +++ b/xen/arch/x86/time.c Tue Nov 18 15:39:31 2008 +0000 @@ -59,6 +59,7 @@ struct platform_timesource { char *name; u64 frequency; u64 (*read_counter)(void); + int (*init)(struct platform_timesource *); int counter_bits; }; @@ -360,14 +361,20 @@ static u64 read_pit_count(void) return count32; } -static void init_pit(struct platform_timesource *pts) -{ - pts->name = "PIT"; - pts->frequency = CLOCK_TICK_RATE; - pts->read_counter = read_pit_count; - pts->counter_bits = 32; +static int init_pit(struct platform_timesource *pts) +{ using_pit = 1; -} + return 1; +} + +static struct platform_timesource plt_pit = +{ + .name = "PIT", + .frequency = CLOCK_TICK_RATE, + .read_counter = read_pit_count, + .counter_bits = 32, + .init = init_pit +}; /************************************************************ * PLATFORM TIMER 2: HIGH PRECISION EVENT TIMER (HPET) @@ -385,13 +392,17 @@ static int init_hpet(struct platform_tim if ( hpet_rate == 0 ) return 0; - pts->name = "HPET"; pts->frequency = hpet_rate; - pts->read_counter = read_hpet_count; - pts->counter_bits = 32; - return 1; } + +static struct platform_timesource plt_hpet = +{ + .name = "HPET", + .read_counter = read_hpet_count, + .counter_bits = 32, + .init = init_hpet +}; /************************************************************ * PLATFORM TIMER 3: IBM 'CYCLONE' TIMER @@ -440,19 +451,22 @@ static int init_cyclone(struct platform_ printk(KERN_ERR "Cyclone: Could not find valid CBAR value.\n"); return 0; } - + /* Enable timer and map the counter register. */ *(map_cyclone_reg(base + CYCLONE_PMCC_OFFSET)) = 1; *(map_cyclone_reg(base + CYCLONE_MPCS_OFFSET)) = 1; cyclone_timer = map_cyclone_reg(base + CYCLONE_MPMC_OFFSET); - - pts->name = "IBM Cyclone"; - pts->frequency = CYCLONE_TIMER_FREQ; - pts->read_counter = read_cyclone_count; - pts->counter_bits = 32; - return 1; } + +static struct platform_timesource plt_cyclone = +{ + .name = "IBM Cyclone", + .frequency = CYCLONE_TIMER_FREQ, + .read_counter = read_cyclone_count, + .counter_bits = 32, + .init = init_cyclone +}; /************************************************************ * PLATFORM TIMER 4: ACPI PM TIMER @@ -473,13 +487,17 @@ static int init_pmtimer(struct platform_ if ( pmtmr_ioport == 0 ) return 0; - pts->name = "ACPI PM Timer"; - pts->frequency = ACPI_PM_FREQUENCY; - pts->read_counter = read_pmtimer_count; - pts->counter_bits = 24; - return 1; } + +static struct platform_timesource plt_pmtimer = +{ + .name = "ACPI PM Timer", + .frequency = ACPI_PM_FREQUENCY, + .read_counter = read_pmtimer_count, + .counter_bits = 24, + .init = init_pmtimer +}; /************************************************************ * GENERIC PLATFORM TIMER INFRASTRUCTURE @@ -555,19 +573,24 @@ static void resume_platform_timer(void) static void init_platform_timer(void) { - struct platform_timesource *pts = &plt_src; - int rc = -1; + static struct platform_timesource * const plt_timers[] = { + &plt_cyclone, &plt_hpet, &plt_pmtimer, &plt_pit + }; + + struct platform_timesource *pts; + int i, rc = -1; if ( opt_clocksource[0] != '\0' ) { - if ( !strcmp(opt_clocksource, "pit") ) - rc = (init_pit(pts), 1); - else if ( !strcmp(opt_clocksource, "hpet") ) - rc = init_hpet(pts); - else if ( !strcmp(opt_clocksource, "cyclone") ) - rc = init_cyclone(pts); - else if ( !strcmp(opt_clocksource, "acpi") ) - rc = init_pmtimer(pts); + for ( i = 0; i < ARRAY_SIZE(plt_timers); i++ ) + { + pts = plt_timers[i]; + if ( !strcmp(opt_clocksource, pts->name) ) + { + rc = pts->init(pts); + break; + } + } if ( rc <= 0 ) printk("WARNING: %s clocksource '%s'.\n", @@ -575,11 +598,17 @@ static void init_platform_timer(void) opt_clocksource); } - if ( (rc <= 0) && - !init_cyclone(pts) && - !init_hpet(pts) && - !init_pmtimer(pts) ) - init_pit(pts); + if ( rc <= 0 ) + { + for ( i = 0; i < ARRAY_SIZE(plt_timers); i++ ) + { + pts = plt_timers[i]; + if ( (rc = pts->init(pts)) > 0 ) + break; + } + } + + BUG_ON(rc <= 0); plt_mask = (u64)~0ull >> (64 - pts->counter_bits); @@ -588,6 +617,7 @@ static void init_platform_timer(void) plt_overflow_period = scale_delta( 1ull << (pts->counter_bits-1), &plt_scale); init_timer(&plt_overflow_timer, plt_overflow, NULL, 0); + plt_src = *pts; plt_overflow(NULL); platform_timer_stamp = plt_stamp64; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:11 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:11 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pfz-0002NU-Fa; Wed, 19 Nov 2008 08:13:11 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdE-0000jT-Tx for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:21 -0800 X-ASG-Debug-ID: 1227111002-0dd70001000e-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 87B8DE659A for ; Wed, 19 Nov 2008 08:10:19 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id oE2tOcneVPQPDS3C for ; Wed, 19 Nov 2008 08:10:19 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690547 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690547" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:18 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAI36004370 for ; Wed, 19 Nov 2008 08:10:18 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAgUX029963 for ; Wed, 19 Nov 2008 08:10:42 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAf3I029962 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:41 -0800 Message-Id: <200811191610.mAJGAf3I029962@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:41 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Re-initialise HPET on resume from S3 X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111019 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Re-initialise HPET on resume from S3 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227023714 0 # Node ID ed8524f4a044efbd6d30f9340c6ddfb00f972407 # Parent 85fda344dba7cf9d22ff0a792d70e032ce6c1b40 x86: Re-initialise HPET on resume from S3 Signed-off-by: Guanqun Lu Signed-off-by: Kevin Tian Signed-off-by: Keir Fraser --- xen/arch/x86/hpet.c | 7 +------ xen/arch/x86/time.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff -r 85fda344dba7 -r ed8524f4a044 xen/arch/x86/hpet.c --- a/xen/arch/x86/hpet.c Tue Nov 18 15:39:31 2008 +0000 +++ b/xen/arch/x86/hpet.c Tue Nov 18 15:55:14 2008 +0000 @@ -264,14 +264,9 @@ int hpet_legacy_irq_tick(void) u64 hpet_setup(void) { - static u64 hpet_rate; - static int initialised; + u64 hpet_rate; u32 hpet_id, hpet_period, cfg; int i; - - if ( initialised ) - return hpet_rate; - initialised = 1; if ( hpet_address == 0 ) return 0; diff -r 85fda344dba7 -r ed8524f4a044 xen/arch/x86/time.c --- a/xen/arch/x86/time.c Tue Nov 18 15:39:31 2008 +0000 +++ b/xen/arch/x86/time.c Tue Nov 18 15:55:14 2008 +0000 @@ -60,6 +60,7 @@ struct platform_timesource { u64 frequency; u64 (*read_counter)(void); int (*init)(struct platform_timesource *); + void (*resume)(struct platform_timesource *); int counter_bits; }; @@ -396,12 +397,21 @@ static int init_hpet(struct platform_tim return 1; } +static void resume_hpet(struct platform_timesource *pts) +{ + u64 hpet_rate = hpet_setup(); + + BUG_ON(hpet_rate == 0); + pts->frequency = hpet_rate; +} + static struct platform_timesource plt_hpet = { .name = "HPET", .read_counter = read_hpet_count, .counter_bits = 32, - .init = init_hpet + .init = init_hpet, + .resume = resume_hpet }; /************************************************************ @@ -566,6 +576,10 @@ static void platform_time_calibration(vo static void resume_platform_timer(void) { + /* Timer source can be reset when backing from S3 to S0 */ + if ( plt_src.resume ) + plt_src.resume(&plt_src); + /* No change in platform_stime across suspend/resume. */ platform_timer_stamp = plt_stamp64; plt_stamp = plt_src.read_counter(); @@ -1214,12 +1228,12 @@ int time_resume(void) { /*u64 tmp = */init_pit_and_calibrate_tsc(); - disable_pit_irq(); - /* Disable this while calibrate_tsc_ap() also is skipped. */ /*set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);*/ resume_platform_timer(); + + disable_pit_irq(); init_percpu_time(); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:17 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:17 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pg5-0002RG-DI; Wed, 19 Nov 2008 08:13:17 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdG-0000kE-C9 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:22 -0800 X-ASG-Debug-ID: 1227111021-0dd700020000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id C0C5DE65A2 for ; Wed, 19 Nov 2008 08:10:21 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id GbFkDkqfbhSM5pAy for ; Wed, 19 Nov 2008 08:10:21 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690549 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690549" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:20 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAKCu004376 for ; Wed, 19 Nov 2008 08:10:20 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAiDS029997 for ; Wed, 19 Nov 2008 08:10:44 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAh3d029996 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:43 -0800 Message-Id: <200811191610.mAJGAh3d029996@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:43 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Fix the clocksource= boot parameter after c/s 18786. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111021 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: Fix the clocksource= boot parameter after c/s 18786. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227098423 0 # Node ID 9958ef441af035913f5c595350c5dfe1196f206b # Parent f09a1d5d4338eab9c593b63b8ae89ddf481a3681 x86: Fix the clocksource= boot parameter after c/s 18786. Signed-off-by: Keir Fraser --- xen/arch/x86/time.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) diff -r f09a1d5d4338 -r 9958ef441af0 xen/arch/x86/time.c --- a/xen/arch/x86/time.c Tue Nov 18 15:59:26 2008 +0000 +++ b/xen/arch/x86/time.c Wed Nov 19 12:40:23 2008 +0000 @@ -56,6 +56,7 @@ struct cpu_time { }; struct platform_timesource { + char *id; char *name; u64 frequency; u64 (*read_counter)(void); @@ -370,6 +371,7 @@ static int init_pit(struct platform_time static struct platform_timesource plt_pit = { + .id = "pit", .name = "PIT", .frequency = CLOCK_TICK_RATE, .read_counter = read_pit_count, @@ -407,6 +409,7 @@ static void resume_hpet(struct platform_ static struct platform_timesource plt_hpet = { + .id = "hpet", .name = "HPET", .read_counter = read_hpet_count, .counter_bits = 32, @@ -471,6 +474,7 @@ static int init_cyclone(struct platform_ static struct platform_timesource plt_cyclone = { + .id = "cyclone", .name = "IBM Cyclone", .frequency = CYCLONE_TIMER_FREQ, .read_counter = read_cyclone_count, @@ -502,6 +506,7 @@ static int init_pmtimer(struct platform_ static struct platform_timesource plt_pmtimer = { + .id = "acpi", .name = "ACPI PM Timer", .frequency = ACPI_PM_FREQUENCY, .read_counter = read_pmtimer_count, @@ -599,7 +604,7 @@ static void init_platform_timer(void) for ( i = 0; i < ARRAY_SIZE(plt_timers); i++ ) { pts = plt_timers[i]; - if ( !strcmp(opt_clocksource, pts->name) ) + if ( !strcmp(opt_clocksource, pts->id) ) { rc = pts->init(pts); break; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:24 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:24 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pgB-0002V8-Ox; Wed, 19 Nov 2008 08:13:23 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdG-0000ki-S0 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:22 -0800 X-ASG-Debug-ID: 1227111021-0dd700020001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 6F4F2E65A2 for ; Wed, 19 Nov 2008 08:10:22 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id vMR3FnPErLcOUGfW for ; Wed, 19 Nov 2008 08:10:22 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690550 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690550" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:21 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGALGB004379 for ; Wed, 19 Nov 2008 08:10:21 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAiq5030014 for ; Wed, 19 Nov 2008 08:10:44 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAihE030013 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:44 -0800 Message-Id: <200811191610.mAJGAihE030013@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:44 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, hpet: Avoud double initialisation on boot or after S3. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111022 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, hpet: Avoud double initialisation on boot or after S3. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227098911 0 # Node ID 876bffced2b8d9102bcba20d154f72ffbdeb7ac5 # Parent 9958ef441af035913f5c595350c5dfe1196f206b x86, hpet: Avoud double initialisation on boot or after S3. Signed-off-by: Keir Fraser --- xen/arch/x86/acpi/power.c | 3 +++ xen/arch/x86/hpet.c | 8 +++++--- xen/include/asm-x86/acpi.h | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff -r 9958ef441af0 -r 876bffced2b8 xen/arch/x86/acpi/power.c --- a/xen/arch/x86/acpi/power.c Wed Nov 19 12:40:23 2008 +0000 +++ b/xen/arch/x86/acpi/power.c Wed Nov 19 12:48:31 2008 +0000 @@ -30,6 +30,8 @@ #include +uint32_t system_reset_counter = 1; + static char opt_acpi_sleep[20]; string_param("acpi_sleep", opt_acpi_sleep); @@ -163,6 +165,7 @@ static int enter_state(u32 state) { case ACPI_STATE_S3: do_suspend_lowlevel(); + system_reset_counter++; break; case ACPI_STATE_S5: acpi_enter_sleep_state(ACPI_STATE_S5); diff -r 9958ef441af0 -r 876bffced2b8 xen/arch/x86/hpet.c --- a/xen/arch/x86/hpet.c Wed Nov 19 12:40:23 2008 +0000 +++ b/xen/arch/x86/hpet.c Wed Nov 19 12:48:31 2008 +0000 @@ -264,12 +264,14 @@ int hpet_legacy_irq_tick(void) u64 hpet_setup(void) { - u64 hpet_rate; + static u64 hpet_rate; + static u32 system_reset_latch; u32 hpet_id, hpet_period, cfg; int i; - if ( hpet_address == 0 ) - return 0; + if ( system_reset_latch == system_reset_counter ) + return hpet_rate; + system_reset_latch = system_reset_counter; set_fixmap_nocache(FIX_HPET_BASE, hpet_address); diff -r 9958ef441af0 -r 876bffced2b8 xen/include/asm-x86/acpi.h --- a/xen/include/asm-x86/acpi.h Wed Nov 19 12:40:23 2008 +0000 +++ b/xen/include/asm-x86/acpi.h Wed Nov 19 12:48:31 2008 +0000 @@ -166,4 +166,7 @@ extern u8 x86_acpiid_to_apicid[]; extern int acpi_dmar_init(void); +/* Incremented whenever we transition through S3. Value is 1 during boot. */ +extern uint32_t system_reset_counter; + #endif /*__X86_ASM_ACPI_H*/ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:30 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:30 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pgH-0002Yv-SM; Wed, 19 Nov 2008 08:13:29 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdH-0000l6-Of for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:23 -0800 X-ASG-Debug-ID: 1227111021-0dd700020002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 6ABABE65AC for ; Wed, 19 Nov 2008 08:10:23 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 4AoELASqgz6qgIlY for ; Wed, 19 Nov 2008 08:10:23 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690551 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690551" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:22 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAMNd004382 for ; Wed, 19 Nov 2008 08:10:22 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAjfs030031 for ; Wed, 19 Nov 2008 08:10:45 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAjct030030 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:45 -0800 Message-Id: <200811191610.mAJGAjct030030@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:45 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] xen s3, No need to check idle vcpu before update_vcpu_system_time(). X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111023 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] xen s3, No need to check idle vcpu before update_vcpu_system_time(). X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227099123 0 # Node ID 2f8b0e14143c0838b4ce19e2f45b55993662d775 # Parent 876bffced2b8d9102bcba20d154f72ffbdeb7ac5 xen s3, No need to check idle vcpu before update_vcpu_system_time(). Signed-off-by: Kevin Tian --- xen/arch/x86/time.c | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) diff -r 876bffced2b8 -r 2f8b0e14143c xen/arch/x86/time.c --- a/xen/arch/x86/time.c Wed Nov 19 12:48:31 2008 +0000 +++ b/xen/arch/x86/time.c Wed Nov 19 12:52:03 2008 +0000 @@ -1244,8 +1244,7 @@ int time_resume(void) do_settime(get_cmos_time() + cmos_utc_offset, 0, NOW()); - if ( !is_idle_vcpu(current) ) - update_vcpu_system_time(current); + update_vcpu_system_time(current); return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:35 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:35 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pgN-0002cl-K8; Wed, 19 Nov 2008 08:13:35 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdI-0000lv-V5 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:24 -0800 X-ASG-Debug-ID: 1227111021-0dd700020003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 6309EE65AF for ; Wed, 19 Nov 2008 08:10:24 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id bsoAcbSEElE0du6C for ; Wed, 19 Nov 2008 08:10:24 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690552 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690552" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:23 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGANqW004385 for ; Wed, 19 Nov 2008 08:10:23 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAksk030048 for ; Wed, 19 Nov 2008 08:10:46 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAkXR030047 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:46 -0800 Message-Id: <200811191610.mAJGAkXR030047@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:46 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] Remove Xen-private definitions from kexec public header. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111024 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] Remove Xen-private definitions from kexec public header. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227100419 0 # Node ID 390ef36eb5962f61de0c8200a83f7c3d05a505d4 # Parent 2f8b0e14143c0838b4ce19e2f45b55993662d775 Remove Xen-private definitions from kexec public header. Signed-off-by: Keir Fraser --- xen/include/public/kexec.h | 21 --------------------- xen/include/xen/kexec.h | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff -r 2f8b0e14143c -r 390ef36eb596 xen/include/public/kexec.h --- a/xen/include/public/kexec.h Wed Nov 19 12:52:03 2008 +0000 +++ b/xen/include/public/kexec.h Wed Nov 19 13:13:39 2008 +0000 @@ -155,27 +155,6 @@ typedef struct xen_kexec_range { unsigned long start; } xen_kexec_range_t; -/* vmcoreinfo stuff */ -#define VMCOREINFO_BYTES (4096) -#define VMCOREINFO_NOTE_NAME "VMCOREINFO_XEN" -void arch_crash_save_vmcoreinfo(void); -void vmcoreinfo_append_str(const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); -#define VMCOREINFO_PAGESIZE(value) \ - vmcoreinfo_append_str("PAGESIZE=%ld\n", value) -#define VMCOREINFO_SYMBOL(name) \ - vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name) -#define VMCOREINFO_SYMBOL_ALIAS(alias, name) \ - vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #alias, (unsigned long)&name) -#define VMCOREINFO_STRUCT_SIZE(name) \ - vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(struct name)) -#define VMCOREINFO_OFFSET(name, field) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ - (unsigned long)offsetof(struct name, field)) -#define VMCOREINFO_OFFSET_ALIAS(name, field, alias) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #alias, \ - (unsigned long)offsetof(struct name, field)) - #endif /* _XEN_PUBLIC_KEXEC_H */ /* diff -r 2f8b0e14143c -r 390ef36eb596 xen/include/xen/kexec.h --- a/xen/include/xen/kexec.h Wed Nov 19 12:52:03 2008 +0000 +++ b/xen/include/xen/kexec.h Wed Nov 19 13:13:39 2008 +0000 @@ -33,6 +33,27 @@ void machine_crash_shutdown(void); void machine_crash_shutdown(void); int machine_kexec_get(xen_kexec_range_t *range); +/* vmcoreinfo stuff */ +#define VMCOREINFO_BYTES (4096) +#define VMCOREINFO_NOTE_NAME "VMCOREINFO_XEN" +void arch_crash_save_vmcoreinfo(void); +void vmcoreinfo_append_str(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))); +#define VMCOREINFO_PAGESIZE(value) \ + vmcoreinfo_append_str("PAGESIZE=%ld\n", value) +#define VMCOREINFO_SYMBOL(name) \ + vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name) +#define VMCOREINFO_SYMBOL_ALIAS(alias, name) \ + vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #alias, (unsigned long)&name) +#define VMCOREINFO_STRUCT_SIZE(name) \ + vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(struct name)) +#define VMCOREINFO_OFFSET(name, field) \ + vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ + (unsigned long)offsetof(struct name, field)) +#define VMCOREINFO_OFFSET_ALIAS(name, field, alias) \ + vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #alias, \ + (unsigned long)offsetof(struct name, field)) + #endif /* __XEN_KEXEC_H__ */ /* _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:43 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:43 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pgV-0002hN-53; Wed, 19 Nov 2008 08:13:43 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdJ-0000mP-ON for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:25 -0800 X-ASG-Debug-ID: 1227111021-0dd700020004-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 63CE9E65B1 for ; Wed, 19 Nov 2008 08:10:25 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id onTq6RF7akOACvlj for ; Wed, 19 Nov 2008 08:10:25 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690553 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690553" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:24 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAOR3004388 for ; Wed, 19 Nov 2008 08:10:24 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAl7d030065 for ; Wed, 19 Nov 2008 08:10:47 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAlnW030064 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:47 -0800 Message-Id: <200811191610.mAJGAlnW030064@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:47 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, s3: Sync platform stamps at time suspend. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111025 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86, s3: Sync platform stamps at time suspend. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227100651 0 # Node ID 4c67985c552e88c03b0d446f34c47bd382d2d702 # Parent 390ef36eb5962f61de0c8200a83f7c3d05a505d4 x86, s3: Sync platform stamps at time suspend. platform_timer_stamp and stime_platform_stamp are synced to platform timer in time calibration (1s interval), and thus doesn't reflect the latest value. If they're not synced at time suspend, the offset can be lost after S3 resume. Average 0.8s lag-behind is observed for each S3 action, which accumulates to TOD inaccuracy. Signed-off-by Kevin Tian --- xen/arch/x86/time.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff -r 390ef36eb596 -r 4c67985c552e xen/arch/x86/time.c --- a/xen/arch/x86/time.c Wed Nov 19 13:13:39 2008 +0000 +++ b/xen/arch/x86/time.c Wed Nov 19 13:17:31 2008 +0000 @@ -585,8 +585,7 @@ static void resume_platform_timer(void) if ( plt_src.resume ) plt_src.resume(&plt_src); - /* No change in platform_stime across suspend/resume. */ - platform_timer_stamp = plt_stamp64; + plt_stamp64 = platform_timer_stamp; plt_stamp = plt_src.read_counter(); } @@ -1221,6 +1220,9 @@ int time_suspend(void) cmos_utc_offset = -get_cmos_time(); cmos_utc_offset += (wc_sec + (wc_nsec + NOW()) / 1000000000ULL); kill_timer(&calibration_timer); + + /* Sync platform timer stamps. */ + platform_time_calibration(); } /* Better to cancel calibration timer for accuracy. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:48 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:48 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pga-0002l3-KS; Wed, 19 Nov 2008 08:13:48 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdL-0000mt-Ft for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:27 -0800 X-ASG-Debug-ID: 1227111021-0dd700020005-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 16FB8E65B3 for ; Wed, 19 Nov 2008 08:10:26 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id NplNGbNE153LsAgk for ; Wed, 19 Nov 2008 08:10:26 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690554 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690554" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:26 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAQc1004391 for ; Wed, 19 Nov 2008 08:10:26 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAn6E030136 for ; Wed, 19 Nov 2008 08:10:49 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAn4T030135 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:49 -0800 Message-Id: <200811191610.mAJGAn4T030135@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:48 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] linux, S3: dom0 doesn't need save ioapic state X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111027 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] linux, S3: dom0 doesn't need save ioapic state X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227024244 0 # Node ID 69694615aebb8663d2e92125193aca7cb5b89f6b # Parent d31b6ccf10e41bfc3c1af4b0ff75deb8e2d5b9d8 linux, S3: dom0 doesn't need save ioapic state Dom0 doesn't need to save/restore ioapic state across S3 suspend/resume, as Xen already does it. The more important is to avoid warnings on some platforms which may have uninitialized RTEs to be weird value (like smi mode) but masked. When dom0 saves those entries and then write back later, it's easy to trigger Xen's sanity check from ioapic_guest_write. Signed-off-by: Kevin Tian --- arch/i386/kernel/io_apic-xen.c | 2 ++ arch/x86_64/kernel/io_apic-xen.c | 2 ++ 2 files changed, 4 insertions(+) diff -r d31b6ccf10e4 -r 69694615aebb arch/i386/kernel/io_apic-xen.c --- a/arch/i386/kernel/io_apic-xen.c Fri Nov 07 17:04:20 2008 +0000 +++ b/arch/i386/kernel/io_apic-xen.c Tue Nov 18 16:04:04 2008 +0000 @@ -2570,8 +2570,10 @@ static int ioapic_resume(struct sys_devi static struct sysdev_class ioapic_sysdev_class = { set_kset_name("ioapic"), +#ifndef CONFIG_XEN .suspend = ioapic_suspend, .resume = ioapic_resume, +#endif }; static int __init ioapic_init_sysfs(void) diff -r d31b6ccf10e4 -r 69694615aebb arch/x86_64/kernel/io_apic-xen.c --- a/arch/x86_64/kernel/io_apic-xen.c Fri Nov 07 17:04:20 2008 +0000 +++ b/arch/x86_64/kernel/io_apic-xen.c Tue Nov 18 16:04:04 2008 +0000 @@ -2107,8 +2107,10 @@ static int ioapic_resume(struct sys_devi static struct sysdev_class ioapic_sysdev_class = { set_kset_name("ioapic"), +#ifndef CONFIG_XEN .suspend = ioapic_suspend, .resume = ioapic_resume, +#endif }; static int __init ioapic_init_sysfs(void) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:13:54 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:13:54 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pgg-0002ow-DA; Wed, 19 Nov 2008 08:13:54 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdM-0000no-SH for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:28 -0800 X-ASG-Debug-ID: 1227111021-0dd700020006-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 65193E65B5 for ; Wed, 19 Nov 2008 08:10:28 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id q7xwMhQ2mL7Zy43i for ; Wed, 19 Nov 2008 08:10:28 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690555 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690555" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:27 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGARDm004394 for ; Wed, 19 Nov 2008 08:10:27 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAo0a030156 for ; Wed, 19 Nov 2008 08:10:50 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAobn030155 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:50 -0800 Message-Id: <200811191610.mAJGAobn030155@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:49 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] Sync Xen public headers. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111028 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] Sync Xen public headers. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227100451 0 # Node ID 69fc220cd737b67e7bd3eca3ab5b84ae7dcbdcdd # Parent 69694615aebb8663d2e92125193aca7cb5b89f6b Sync Xen public headers. Signed-off-by: Keir Fraser --- include/xen/interface/features.h | 6 ++++++ include/xen/interface/grant_table.h | 9 ++++++++- include/xen/interface/kexec.h | 21 --------------------- include/xen/interface/trace.h | 2 ++ 4 files changed, 16 insertions(+), 22 deletions(-) diff -r 69694615aebb -r 69fc220cd737 include/xen/interface/features.h --- a/include/xen/interface/features.h Tue Nov 18 16:04:04 2008 +0000 +++ b/include/xen/interface/features.h Wed Nov 19 13:14:11 2008 +0000 @@ -62,6 +62,12 @@ /* x86: Does this Xen host support the MMU_{CLEAR,COPY}_PAGE hypercall? */ #define XENFEAT_highmem_assist 6 +/* + * If set, GNTTABOP_map_grant_ref honors flags to be placed into guest kernel + * available pte bits. + */ +#define XENFEAT_gnttab_map_avail_bits 7 + #define XENFEAT_NR_SUBMAPS 1 #endif /* __XEN_PUBLIC_FEATURES_H__ */ diff -r 69694615aebb -r 69fc220cd737 include/xen/interface/grant_table.h --- a/include/xen/interface/grant_table.h Tue Nov 18 16:04:04 2008 +0000 +++ b/include/xen/interface/grant_table.h Wed Nov 19 13:14:11 2008 +0000 @@ -360,7 +360,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and /* - * Bitfield values for update_pin_status.flags. + * Bitfield values for gnttab_map_grant_ref.flags. */ /* Map the grant entry for access by I/O devices. */ #define _GNTMAP_device_map (0) @@ -388,6 +388,13 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and #define GNTMAP_contains_pte (1<<_GNTMAP_contains_pte) /* + * Bits to be placed in guest kernel available PTE bits (architecture + * dependent; only supported when XENFEAT_gnttab_map_avail_bits is set). + */ +#define _GNTMAP_guest_avail0 (16) +#define GNTMAP_guest_avail_mask ((uint32_t)~0 << _GNTMAP_guest_avail0) + +/* * Values for error status returns. All errors are -ve. */ #define GNTST_okay (0) /* Normal return. */ diff -r 69694615aebb -r 69fc220cd737 include/xen/interface/kexec.h --- a/include/xen/interface/kexec.h Tue Nov 18 16:04:04 2008 +0000 +++ b/include/xen/interface/kexec.h Wed Nov 19 13:14:11 2008 +0000 @@ -155,27 +155,6 @@ typedef struct xen_kexec_range { unsigned long start; } xen_kexec_range_t; -/* vmcoreinfo stuff */ -#define VMCOREINFO_BYTES (4096) -#define VMCOREINFO_NOTE_NAME "VMCOREINFO_XEN" -void arch_crash_save_vmcoreinfo(void); -void vmcoreinfo_append_str(const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); -#define VMCOREINFO_PAGESIZE(value) \ - vmcoreinfo_append_str("PAGESIZE=%ld\n", value) -#define VMCOREINFO_SYMBOL(name) \ - vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name) -#define VMCOREINFO_SYMBOL_ALIAS(alias, name) \ - vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #alias, (unsigned long)&name) -#define VMCOREINFO_STRUCT_SIZE(name) \ - vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(struct name)) -#define VMCOREINFO_OFFSET(name, field) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ - (unsigned long)offsetof(struct name, field)) -#define VMCOREINFO_OFFSET_ALIAS(name, field, alias) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #alias, \ - (unsigned long)offsetof(struct name, field)) - #endif /* _XEN_PUBLIC_KEXEC_H */ /* diff -r 69694615aebb -r 69fc220cd737 include/xen/interface/trace.h --- a/include/xen/interface/trace.h Tue Nov 18 16:04:04 2008 +0000 +++ b/include/xen/interface/trace.h Wed Nov 19 13:14:11 2008 +0000 @@ -142,7 +142,9 @@ #define TRC_HVM_INVLPG64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x14) #define TRC_HVM_MCE (TRC_HVM_HANDLER + 0x15) #define TRC_HVM_IO_ASSIST (TRC_HVM_HANDLER + 0x16) +#define TRC_HVM_IO_ASSIST64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x16) #define TRC_HVM_MMIO_ASSIST (TRC_HVM_HANDLER + 0x17) +#define TRC_HVM_MMIO_ASSIST64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x17) #define TRC_HVM_CLTS (TRC_HVM_HANDLER + 0x18) #define TRC_HVM_LMSW (TRC_HVM_HANDLER + 0x19) #define TRC_HVM_LMSW64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x19) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:14:00 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:14:00 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pgm-0002sj-FH; Wed, 19 Nov 2008 08:14:00 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdN-0000oO-NB for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:29 -0800 X-ASG-Debug-ID: 1227111021-0dd700020007-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 59930E65B7 for ; Wed, 19 Nov 2008 08:10:29 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id U1yq7Y3kFmngy8bT for ; Wed, 19 Nov 2008 08:10:29 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690556 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690556" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:28 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGASoI004397 for ; Wed, 19 Nov 2008 08:10:28 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGApcq030174 for ; Wed, 19 Nov 2008 08:10:51 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGApc4030173 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:51 -0800 Message-Id: <200811191610.mAJGApc4030173@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:50 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] linux: re-order fbfront initialization X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111029 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] linux: re-order fbfront initialization X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227100508 0 # Node ID f29bf0bf3e97e882dc3ea6cf83efdee3bd1c1c31 # Parent 69fc220cd737b67e7bd3eca3ab5b84ae7dcbdcdd linux: re-order fbfront initialization The helper thread shouldn't be started before xenfb_connect_backend(), to avoid the thread using the potentially not yet initialized irq. Signed-off-by: Jan Beulich --- drivers/xen/fbfront/xenfb.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff -r 69fc220cd737 -r f29bf0bf3e97 drivers/xen/fbfront/xenfb.c --- a/drivers/xen/fbfront/xenfb.c Wed Nov 19 13:14:11 2008 +0000 +++ b/drivers/xen/fbfront/xenfb.c Wed Nov 19 13:15:08 2008 +0000 @@ -662,6 +662,10 @@ static int __devinit xenfb_probe(struct } info->fb_info = fb_info; + ret = xenfb_connect_backend(dev, info); + if (ret < 0) + goto error; + /* FIXME should this be delayed until backend XenbusStateConnected? */ info->kthread = kthread_run(xenfb_thread, info, "xenfb thread"); if (IS_ERR(info->kthread)) { @@ -670,10 +674,6 @@ static int __devinit xenfb_probe(struct xenbus_dev_fatal(dev, ret, "register_framebuffer"); goto error; } - - ret = xenfb_connect_backend(dev, info); - if (ret < 0) - goto error; return 0; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:14:06 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:14:06 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pgs-0002x3-P9; Wed, 19 Nov 2008 08:14:06 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdO-0000p8-O8 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:30 -0800 X-ASG-Debug-ID: 1227111021-0dd700020008-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 3D881E65BB for ; Wed, 19 Nov 2008 08:10:29 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id jEnrmcBklsFjNOVi for ; Wed, 19 Nov 2008 08:10:29 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690557 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690557" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:29 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGATDI004400 for ; Wed, 19 Nov 2008 08:10:29 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAqFF030191 for ; Wed, 19 Nov 2008 08:10:52 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAqns030190 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:52 -0800 Message-Id: <200811191610.mAJGAqns030190@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:51 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] linux/x86: remove broken HYPERVISOR_acm_op() X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111030 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] linux/x86: remove broken HYPERVISOR_acm_op() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227100546 0 # Node ID 832aac894efda66206ee6db43666d108a8d5c2b5 # Parent f29bf0bf3e97e882dc3ea6cf83efdee3bd1c1c31 linux/x86: remove broken HYPERVISOR_acm_op() That hypercall apparently never really worked (it's being passed two arguments, but the hypercall entry point code only loaded one, while do_acm_op() again consumed two), appears to be pointless in the kernel anyway, and there's been no __HYPERVISOR_acm_op for quite a while. Signed-off-by: Jan Beulich --- include/asm-i386/mach-xen/asm/hypercall.h | 7 ------- include/asm-x86_64/mach-xen/asm/hypercall.h | 7 ------- 2 files changed, 14 deletions(-) diff -r f29bf0bf3e97 -r 832aac894efd include/asm-i386/mach-xen/asm/hypercall.h --- a/include/asm-i386/mach-xen/asm/hypercall.h Wed Nov 19 13:15:08 2008 +0000 +++ b/include/asm-i386/mach-xen/asm/hypercall.h Wed Nov 19 13:15:46 2008 +0000 @@ -280,13 +280,6 @@ HYPERVISOR_event_channel_op( } static inline int __must_check -HYPERVISOR_acm_op( - int cmd, void *arg) -{ - return _hypercall2(int, acm_op, cmd, arg); -} - -static inline int __must_check HYPERVISOR_xen_version( int cmd, void *arg) { diff -r f29bf0bf3e97 -r 832aac894efd include/asm-x86_64/mach-xen/asm/hypercall.h --- a/include/asm-x86_64/mach-xen/asm/hypercall.h Wed Nov 19 13:15:08 2008 +0000 +++ b/include/asm-x86_64/mach-xen/asm/hypercall.h Wed Nov 19 13:15:46 2008 +0000 @@ -278,13 +278,6 @@ HYPERVISOR_event_channel_op( } static inline int __must_check -HYPERVISOR_acm_op( - int cmd, void *arg) -{ - return _hypercall2(int, acm_op, cmd, arg); -} - -static inline int __must_check HYPERVISOR_xen_version( int cmd, void *arg) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:14:12 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:14:12 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pgy-00030m-8A; Wed, 19 Nov 2008 08:14:12 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2pdw-0001A7-VA for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:11:04 -0800 X-ASG-Debug-ID: 1227111063-109700010000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 74644E65C7 for ; Wed, 19 Nov 2008 08:11:04 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id CULmHNK3r4UDuHhs for ; Wed, 19 Nov 2008 08:11:04 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690530 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690530" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:01 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGA0pW004325 for ; Wed, 19 Nov 2008 08:10:01 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAOuP029689 for ; Wed, 19 Nov 2008 08:10:24 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAO2R029688 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:24 -0800 Message-Id: <200811191610.mAJGAO2R029688@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:23 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: add SSE-based copy_page() X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111064 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: add SSE-based copy_page() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1226491455 0 # Node ID 8de4b4e9a435cea9b8e85863fcb832c213281076 # Parent 8e18dd41c6c7bb0980b29393b275c564cfb96437 x86: add SSE-based copy_page() In top of the highmem asstance hypercalls added earlier, this provides a performance improvement of another 12% (measured on Xeon E5345) for the page copying case. Signed-off-by: Jan Beulich --- xen/arch/x86/Makefile | 1 xen/arch/x86/copy_page.S | 66 ++++++++++++++++++++++++++++++++++++++++++++ xen/arch/x86/domain.c | 3 +- xen/arch/x86/domain_build.c | 5 ++- xen/include/asm-x86/page.h | 5 ++- 5 files changed, 76 insertions(+), 4 deletions(-) diff -r 8e18dd41c6c7 -r 8de4b4e9a435 xen/arch/x86/Makefile --- a/xen/arch/x86/Makefile Wed Nov 12 12:01:35 2008 +0000 +++ b/xen/arch/x86/Makefile Wed Nov 12 12:04:15 2008 +0000 @@ -11,6 +11,7 @@ obj-y += apic.o obj-y += apic.o obj-y += bitops.o obj-y += clear_page.o +obj-y += copy_page.o obj-y += compat.o obj-y += delay.o obj-y += dmi_scan.o diff -r 8e18dd41c6c7 -r 8de4b4e9a435 xen/arch/x86/copy_page.S --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/copy_page.S Wed Nov 12 12:04:15 2008 +0000 @@ -0,0 +1,66 @@ +#include +#include + +#ifdef __i386__ +#define src_reg %esi +#define dst_reg %edi +#define WORD_SIZE 4 +#define tmp1_reg %eax +#define tmp2_reg %edx +#define tmp3_reg %ebx +#define tmp4_reg %ebp +#else +#define src_reg %rsi +#define dst_reg %rdi +#define WORD_SIZE 8 +#define tmp1_reg %r8 +#define tmp2_reg %r9 +#define tmp3_reg %r10 +#define tmp4_reg %r11 +#endif + +ENTRY(copy_page_sse2) +#ifdef __i386__ + push %ebx + push %ebp + push %esi + push %edi + mov 6*4(%esp), src_reg + mov 5*4(%esp), dst_reg +#endif + mov $PAGE_SIZE/(4*WORD_SIZE)-3, %ecx + + prefetchnta 2*4*WORD_SIZE(src_reg) + mov (src_reg), tmp1_reg + mov WORD_SIZE(src_reg), tmp2_reg + mov 2*WORD_SIZE(src_reg), tmp3_reg + mov 3*WORD_SIZE(src_reg), tmp4_reg + +0: prefetchnta 3*4*WORD_SIZE(src_reg) +1: add $4*WORD_SIZE, src_reg + movnti tmp1_reg, (dst_reg) + mov (src_reg), tmp1_reg + dec %ecx + movnti tmp2_reg, WORD_SIZE(dst_reg) + mov WORD_SIZE(src_reg), tmp2_reg + movnti tmp3_reg, 2*WORD_SIZE(dst_reg) + mov 2*WORD_SIZE(src_reg), tmp3_reg + movnti tmp4_reg, 3*WORD_SIZE(dst_reg) + lea 4*WORD_SIZE(dst_reg), dst_reg + mov 3*WORD_SIZE(src_reg), tmp4_reg + jg 0b + jpe 1b + + movnti tmp1_reg, (dst_reg) + movnti tmp2_reg, WORD_SIZE(dst_reg) + movnti tmp3_reg, 2*WORD_SIZE(dst_reg) + movnti tmp4_reg, 3*WORD_SIZE(dst_reg) + +#ifdef __i386__ + pop %edi + pop %esi + pop %ebp + pop %ebx +#endif + sfence + ret diff -r 8e18dd41c6c7 -r 8de4b4e9a435 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Wed Nov 12 12:01:35 2008 +0000 +++ b/xen/arch/x86/domain.c Wed Nov 12 12:04:15 2008 +0000 @@ -184,7 +184,8 @@ static int setup_compat_l4(struct vcpu * /* This page needs to look like a pagetable so that it can be shadowed */ pg->u.inuse.type_info = PGT_l4_page_table|PGT_validated|1; - l4tab = copy_page(page_to_virt(pg), idle_pg_table); + l4tab = page_to_virt(pg); + copy_page(l4tab, idle_pg_table); l4tab[0] = l4e_empty(); l4tab[l4_table_offset(LINEAR_PT_VIRT_START)] = l4e_from_page(pg, __PAGE_HYPERVISOR); diff -r 8e18dd41c6c7 -r 8de4b4e9a435 xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Wed Nov 12 12:01:35 2008 +0000 +++ b/xen/arch/x86/domain_build.c Wed Nov 12 12:04:15 2008 +0000 @@ -455,8 +455,9 @@ int __init construct_dom0( /* WARNING: The new domain must have its 'processor' field filled in! */ l3start = l3tab = (l3_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE; l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += 4*PAGE_SIZE; - memcpy(l2tab, idle_pg_table_l2, 4*PAGE_SIZE); - for (i = 0; i < 4; i++) { + for (i = 0; i < L3_PAGETABLE_ENTRIES; i++) { + copy_page(l2tab + i * L2_PAGETABLE_ENTRIES, + idle_pg_table_l2 + i * L2_PAGETABLE_ENTRIES); l3tab[i] = l3e_from_paddr((u32)l2tab + i*PAGE_SIZE, L3_PROT); l2tab[(LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT)+i] = l2e_from_paddr((u32)l2tab + i*PAGE_SIZE, __PAGE_HYPERVISOR); diff -r 8e18dd41c6c7 -r 8de4b4e9a435 xen/include/asm-x86/page.h --- a/xen/include/asm-x86/page.h Wed Nov 12 12:01:35 2008 +0000 +++ b/xen/include/asm-x86/page.h Wed Nov 12 12:04:15 2008 +0000 @@ -215,7 +215,10 @@ void clear_page_sse2(void *); #define clear_page(_p) (cpu_has_xmm2 ? \ clear_page_sse2((void *)(_p)) : \ (void)memset((void *)(_p), 0, PAGE_SIZE)) -#define copy_page(_t,_f) memcpy((void *)(_t), (void *)(_f), PAGE_SIZE) +void copy_page_sse2(void *, const void *); +#define copy_page(_t,_f) (cpu_has_xmm2 ? \ + copy_page_sse2(_t, _f) : \ + (void)memcpy(_t, _f, PAGE_SIZE)) #define mfn_valid(mfn) ((mfn) < max_page) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 08:14:19 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 08:14:19 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2ph5-00035B-L3; Wed, 19 Nov 2008 08:14:19 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2peE-0001KV-Ox for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:11:22 -0800 X-ASG-Debug-ID: 1227111081-109700030000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 6767DE65D4 for ; Wed, 19 Nov 2008 08:11:22 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id AtzkjHX8QsxYNGD2 for ; Wed, 19 Nov 2008 08:11:22 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2690548 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,631,1220241600"; d="scan'208";a="2690548" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 11:10:19 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAJrd004373 for ; Wed, 19 Nov 2008 08:10:19 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJGAhOo029980 for ; Wed, 19 Nov 2008 08:10:43 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJGAgxB029979 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 08:10:42 -0800 Message-Id: <200811191610.mAJGAgxB029979@xenbits.xensource.com> Date: Wed, 19 Nov 2008 08:10:42 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86, hvm: Fix domain restore bug with Intel VLAPIC acceleration. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227111082 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10633 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86, hvm: Fix domain restore bug with Intel VLAPIC acceleration. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227023966 0 # Node ID f09a1d5d4338eab9c593b63b8ae89ddf481a3681 # Parent ed8524f4a044efbd6d30f9340c6ddfb00f972407 x86, hvm: Fix domain restore bug with Intel VLAPIC acceleration. r18383 mark video memory as ram, and make all valid pages migrated, including vlapic page (0xFEE00), and share page(0xFFFFF). An extra memory population for lapic page would override previous mapping then cause HVM guest with vlapic acceleration hang. Signed-off-by: Keir Fraser --- xen/arch/x86/mm.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r ed8524f4a044 -r f09a1d5d4338 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Tue Nov 18 15:55:14 2008 +0000 +++ b/xen/arch/x86/mm.c Tue Nov 18 15:59:26 2008 +0000 @@ -1604,6 +1604,7 @@ static int mod_l1_entry(l1_pgentry_t *pl struct domain *d = curr->domain; unsigned long mfn; struct page_info *l1pg = mfn_to_page(gl1mfn); + p2m_type_t p2mt; int rc = 1; page_lock(l1pg); @@ -1621,8 +1622,8 @@ static int mod_l1_entry(l1_pgentry_t *pl if ( l1e_get_flags(nl1e) & _PAGE_PRESENT ) { /* Translate foreign guest addresses. */ - mfn = gmfn_to_mfn(FOREIGNDOM, l1e_get_pfn(nl1e)); - if ( unlikely(mfn == INVALID_MFN) ) + mfn = mfn_x(gfn_to_mfn(FOREIGNDOM, l1e_get_pfn(nl1e), &p2mt)); + if ( !p2m_is_ram(p2mt) || unlikely(mfn == INVALID_MFN) ) return page_unlock(l1pg), 0; ASSERT((mfn & ~(PADDR_MASK >> PAGE_SHIFT)) == 0); nl1e = l1e_from_pfn(mfn, l1e_get_flags(nl1e)); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 11:20:03 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 11:20:03 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2sam-0002uD-Oa; Wed, 19 Nov 2008 11:20:00 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2sak-0002td-Bu for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 11:19:58 -0800 X-ASG-Debug-ID: 1227122397-7c81000b0000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 9D751E64DA for ; Wed, 19 Nov 2008 11:19:57 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id f9TnOnj0z3G2WqZ4 for ; Wed, 19 Nov 2008 11:19:57 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2692050 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,633,1220241600"; d="scan'208";a="2692050" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 14:19:56 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJJJuGL005207 for ; Wed, 19 Nov 2008 11:19:56 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJJKJNH009490 for ; Wed, 19 Nov 2008 11:20:19 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJJKJZD009489 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 11:20:19 -0800 Message-Id: <200811191920.mAJJKJZD009489@xenbits.xensource.com> Date: Wed, 19 Nov 2008 11:20:18 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: support CPUID hypervisor feature bit X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227122397 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10639 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86: support CPUID hypervisor feature bit X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227111039 0 # Node ID 4107618ee0d8aceb517f43ffa79197a041ed4bcf # Parent 4c67985c552e88c03b0d446f34c47bd382d2d702 x86: support CPUID hypervisor feature bit Signed-off-by: Jan Beulich Signed-off-by: Keir Fraser --- tools/libxc/xc_cpufeature.h | 1 + tools/libxc/xc_cpuid_x86.c | 3 +++ xen/arch/x86/traps.c | 1 + xen/include/asm-x86/cpufeature.h | 1 + 4 files changed, 6 insertions(+) diff -r 4c67985c552e -r 4107618ee0d8 tools/libxc/xc_cpufeature.h --- a/tools/libxc/xc_cpufeature.h Wed Nov 19 13:17:31 2008 +0000 +++ b/tools/libxc/xc_cpufeature.h Wed Nov 19 16:10:39 2008 +0000 @@ -83,6 +83,7 @@ #define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */ #define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */ #define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */ +#define X86_FEATURE_HYPERVISOR (4*32+31) /* Running under some hypervisor */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ #define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */ diff -r 4c67985c552e -r 4107618ee0d8 tools/libxc/xc_cpuid_x86.c --- a/tools/libxc/xc_cpuid_x86.c Wed Nov 19 13:17:31 2008 +0000 +++ b/tools/libxc/xc_cpuid_x86.c Wed Nov 19 16:10:39 2008 +0000 @@ -193,6 +193,8 @@ static void xc_cpuid_hvm_policy( bitmaskof(X86_FEATURE_SSE4_1) | bitmaskof(X86_FEATURE_SSE4_2) | bitmaskof(X86_FEATURE_POPCNT)); + + regs[2] |= bitmaskof(X86_FEATURE_HYPERVISOR); regs[3] &= (bitmaskof(X86_FEATURE_FPU) | bitmaskof(X86_FEATURE_VME) | @@ -309,6 +311,7 @@ static void xc_cpuid_pv_policy( clear_bit(X86_FEATURE_XTPR, regs[2]); clear_bit(X86_FEATURE_PDCM, regs[2]); clear_bit(X86_FEATURE_DCA, regs[2]); + set_bit(X86_FEATURE_HYPERVISOR, regs[2]); break; case 0x80000001: if ( !guest_64bit ) diff -r 4c67985c552e -r 4107618ee0d8 xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Wed Nov 19 13:17:31 2008 +0000 +++ b/xen/arch/x86/traps.c Wed Nov 19 16:10:39 2008 +0000 @@ -755,6 +755,7 @@ static void pv_cpuid(struct cpu_user_reg __clear_bit(X86_FEATURE_XTPR % 32, &c); __clear_bit(X86_FEATURE_PDCM % 32, &c); __clear_bit(X86_FEATURE_DCA % 32, &c); + __set_bit(X86_FEATURE_HYPERVISOR % 32, &c); break; case 0x80000001: /* Modify Feature Information. */ diff -r 4c67985c552e -r 4107618ee0d8 xen/include/asm-x86/cpufeature.h --- a/xen/include/asm-x86/cpufeature.h Wed Nov 19 13:17:31 2008 +0000 +++ b/xen/include/asm-x86/cpufeature.h Wed Nov 19 16:10:39 2008 +0000 @@ -94,6 +94,7 @@ #define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */ #define X86_FEATURE_X2APIC (4*32+21) /* Extended xAPIC */ #define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */ +#define X86_FEATURE_HYPERVISOR (4*32+31) /* Running under some hypervisor */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ #define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 11:20:06 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 11:20:06 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2sas-0002y9-0S; Wed, 19 Nov 2008 11:20:06 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2sak-0002tj-SM for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 11:19:58 -0800 X-ASG-Debug-ID: 1227122397-7c81000b0001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 46664E6507 for ; Wed, 19 Nov 2008 11:19:58 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id Rvg2xqtwXdJnnq5W for ; Wed, 19 Nov 2008 11:19:58 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2692051 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,633,1220241600"; d="scan'208";a="2692051" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 14:19:57 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJJJvh8005210 for ; Wed, 19 Nov 2008 11:19:57 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJJKKIu009507 for ; Wed, 19 Nov 2008 11:20:20 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJJKKpr009506 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 11:20:20 -0800 Message-Id: <200811191920.mAJJKKpr009506@xenbits.xensource.com> Date: Wed, 19 Nov 2008 11:20:20 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: secure ioapic_guest_write() against FREE_TO_ASSIGN irq values X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227122398 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10639 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-unstable] x86: secure ioapic_guest_write() against FREE_TO_ASSIGN irq values X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227111099 0 # Node ID bddd2d344c5425bfd25564bc20f90c3776552c6e # Parent 4107618ee0d8aceb517f43ffa79197a041ed4bcf x86: secure ioapic_guest_write() against FREE_TO_ASSIGN irq values Signed-off-by: Jan Beulich --- xen/arch/x86/io_apic.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 4107618ee0d8 -r bddd2d344c54 xen/arch/x86/io_apic.c --- a/xen/arch/x86/io_apic.c Wed Nov 19 16:10:39 2008 +0000 +++ b/xen/arch/x86/io_apic.c Wed Nov 19 16:11:39 2008 +0000 @@ -2196,7 +2196,7 @@ int ioapic_guest_write(unsigned long phy if ( new_rte.vector >= FIRST_DYNAMIC_VECTOR ) new_irq = vector_irq[new_rte.vector]; - if ( (old_irq != new_irq) && (old_irq != -1) && IO_APIC_IRQ(old_irq) ) + if ( (old_irq != new_irq) && (old_irq >= 0) && IO_APIC_IRQ(old_irq) ) { if ( irq_desc[IO_APIC_VECTOR(old_irq)].action ) { @@ -2208,7 +2208,7 @@ int ioapic_guest_write(unsigned long phy remove_pin_at_irq(old_irq, apic, pin); } - if ( (new_irq != -1) && IO_APIC_IRQ(new_irq) ) + if ( (new_irq >= 0) && IO_APIC_IRQ(new_irq) ) { if ( irq_desc[IO_APIC_VECTOR(new_irq)].action ) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 19 11:20:12 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 19 Nov 2008 11:20:12 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L2say-00032E-8S; Wed, 19 Nov 2008 11:20:12 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L2sal-0002tr-Om for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 11:19:59 -0800 X-ASG-Debug-ID: 1227122397-7c81000b0002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 5A857E6507 for ; Wed, 19 Nov 2008 11:19:59 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id RpFEcOBMWZYUFQLg for ; Wed, 19 Nov 2008 11:19:59 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2692052 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,633,1220241600"; d="scan'208";a="2692052" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 Nov 2008 14:19:58 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAJJJwb8005213 for ; Wed, 19 Nov 2008 11:19:58 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAJJKLcp009524 for ; Wed, 19 Nov 2008 11:20:21 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAJJKLtR009523 for xen-changelog@lists.xensource.com; Wed, 19 Nov 2008 11:20:21 -0800 Message-Id: <200811191920.mAJJKLtR009523@xenbits.xensource.com> Date: Wed, 19 Nov 2008 11:20:21 -0800 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-unstable] x86: Fix build for some versions of gcc. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227122399 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.10639 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-unstable] x86: Fix build for some versions of gcc. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227122002 0 # Node ID 98d48f7680dbed3f788ede174f47b27825f0dd45 # Parent bddd2d344c5425bfd25564bc20f90c3776552c6e x86: Fix build for some versions of gcc. Signed-off-by: Keir Fraser --- xen/arch/x86/time.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r bddd2d344c54 -r 98d48f7680db xen/arch/x86/time.c --- a/xen/arch/x86/time.c Wed Nov 19 16:11:39 2008 +0000 +++ b/xen/arch/x86/time.c Wed Nov 19 19:13:22 2008 +0000 @@ -595,7 +595,7 @@ static void init_platform_timer(void) &plt_cyclone, &plt_hpet, &plt_pmtimer, &plt_pit }; - struct platform_timesource *pts; + struct platform_timesource *pts = NULL; int i, rc = -1; if ( opt_clocksource[0] != '\0' ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 11:59:54 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 11:59:54 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYE-0002yx-KJ; Wed, 26 Nov 2008 11:59:54 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYA-0002yF-Jt for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:50 -0800 X-ASG-Debug-ID: 1227729589-36a900090000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id C0380EA13A for ; Wed, 26 Nov 2008 11:59:49 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id VmJLJG8L3g3MI7i2 for ; Wed, 26 Nov 2008 11:59:49 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738313 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738313" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:48 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxlGo016047 for ; Wed, 26 Nov 2008 11:59:47 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0BvU019842 for ; Wed, 26 Nov 2008 12:00:11 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0A0M019841 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:10 -0800 Message-Id: <200811262000.mAQK0A0M019841@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:08 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] PCI-Express AER implemetation: aer howto document X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729589 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 1.00 X-Barracuda-Spam-Status: No, SCORE=1.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M, BSF_RULE_7582B X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M 0.50 BSF_RULE_7582B Custom Rule 7582B Subject: [Xen-changelog] [linux-2.6.18-xen] PCI-Express AER implemetation: aer howto document X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227524447 0 # Node ID 69e10455038e61f0515f7b2d0ca692b1c19c46db # Parent 832aac894efda66206ee6db43666d108a8d5c2b5 PCI-Express AER implemetation: aer howto document Backported from upstream Linux. Signed-off-by: Zhang Yanmin Signed-off-by: Greg Kroah-Hartman --- Documentation/pcieaer-howto.txt | 252 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 252 insertions(+) diff -r 832aac894efd -r 69e10455038e Documentation/pcieaer-howto.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Documentation/pcieaer-howto.txt Mon Nov 24 11:00:47 2008 +0000 @@ -0,0 +1,253 @@ + The PCI Express Advanced Error Reporting Driver Guide HOWTO + T. Long Nguyen + Yanmin Zhang + 07/29/2006 + + +1. Overview + +1.1 About this guide + +This guide describes the basics of the PCI Express Advanced Error +Reporting (AER) driver and provides information on how to use it, as +well as how to enable the drivers of endpoint devices to conform with +PCI Express AER driver. + +1.2 Copyright © Intel Corporation 2006. + +1.3 What is the PCI Express AER Driver? + +PCI Express error signaling can occur on the PCI Express link itself +or on behalf of transactions initiated on the link. PCI Express +defines two error reporting paradigms: the baseline capability and +the Advanced Error Reporting capability. The baseline capability is +required of all PCI Express components providing a minimum defined +set of error reporting requirements. Advanced Error Reporting +capability is implemented with a PCI Express advanced error reporting +extended capability structure providing more robust error reporting. + +The PCI Express AER driver provides the infrastructure to support PCI +Express Advanced Error Reporting capability. The PCI Express AER +driver provides three basic functions: + +- Gathers the comprehensive error information if errors occurred. +- Reports error to the users. +- Performs error recovery actions. + +AER driver only attaches root ports which support PCI-Express AER +capability. + + +2. User Guide + +2.1 Include the PCI Express AER Root Driver into the Linux Kernel + +The PCI Express AER Root driver is a Root Port service driver attached +to the PCI Express Port Bus driver. If a user wants to use it, the driver +has to be compiled. Option CONFIG_PCIEAER supports this capability. It +depends on CONFIG_PCIEPORTBUS, so pls. set CONFIG_PCIEPORTBUS=y and +CONFIG_PCIEAER = y. + +2.2 Load PCI Express AER Root Driver +There is a case where a system has AER support in BIOS. Enabling the AER +Root driver and having AER support in BIOS may result unpredictable +behavior. To avoid this conflict, a successful load of the AER Root driver +requires ACPI _OSC support in the BIOS to allow the AER Root driver to +request for native control of AER. See the PCI FW 3.0 Specification for +details regarding OSC usage. Currently, lots of firmwares don't provide +_OSC support while they use PCI Express. To support such firmwares, +forceload, a parameter of type bool, could enable AER to continue to +be initiated although firmwares have no _OSC support. To enable the +walkaround, pls. add aerdriver.forceload=y to kernel boot parameter line +when booting kernel. Note that forceload=n by default. + +2.3 AER error output +When a PCI-E AER error is captured, an error message will be outputed to +console. If it's a correctable error, it is outputed as a warning. +Otherwise, it is printed as an error. So users could choose different +log level to filter out correctable error messages. + +Below shows an example. ++------ PCI-Express Device Error -----+ +Error Severity : Uncorrected (Fatal) +PCIE Bus Error type : Transaction Layer +Unsupported Request : First +Requester ID : 0500 +VendorID=8086h, DeviceID=0329h, Bus=05h, Device=00h, Function=00h +TLB Header: +04000001 00200a03 05010000 00050100 + +In the example, 'Requester ID' means the ID of the device who sends +the error message to root port. Pls. refer to pci express specs for +other fields. + + +3. Developer Guide + +To enable AER aware support requires a software driver to configure +the AER capability structure within its device and to provide callbacks. + +To support AER better, developers need understand how AER does work +firstly. + +PCI Express errors are classified into two types: correctable errors +and uncorrectable errors. This classification is based on the impacts +of those errors, which may result in degraded performance or function +failure. + +Correctable errors pose no impacts on the functionality of the +interface. The PCI Express protocol can recover without any software +intervention or any loss of data. These errors are detected and +corrected by hardware. Unlike correctable errors, uncorrectable +errors impact functionality of the interface. Uncorrectable errors +can cause a particular transaction or a particular PCI Express link +to be unreliable. Depending on those error conditions, uncorrectable +errors are further classified into non-fatal errors and fatal errors. +Non-fatal errors cause the particular transaction to be unreliable, +but the PCI Express link itself is fully functional. Fatal errors, on +the other hand, cause the link to be unreliable. + +When AER is enabled, a PCI Express device will automatically send an +error message to the PCIE root port above it when the device captures +an error. The Root Port, upon receiving an error reporting message, +internally processes and logs the error message in its PCI Express +capability structure. Error information being logged includes storing +the error reporting agent's requestor ID into the Error Source +Identification Registers and setting the error bits of the Root Error +Status Register accordingly. If AER error reporting is enabled in Root +Error Command Register, the Root Port generates an interrupt if an +error is detected. + +Note that the errors as described above are related to the PCI Express +hierarchy and links. These errors do not include any device specific +errors because device specific errors will still get sent directly to +the device driver. + +3.1 Configure the AER capability structure + +AER aware drivers of PCI Express component need change the device +control registers to enable AER. They also could change AER registers, +including mask and severity registers. Helper function +pci_enable_pcie_error_reporting could be used to enable AER. See +section 3.3. + +3.2. Provide callbacks + +3.2.1 callback reset_link to reset pci express link + +This callback is used to reset the pci express physical link when a +fatal error happens. The root port aer service driver provides a +default reset_link function, but different upstream ports might +have different specifications to reset pci express link, so all +upstream ports should provide their own reset_link functions. + +In struct pcie_port_service_driver, a new pointer, reset_link, is +added. + +pci_ers_result_t (*reset_link) (struct pci_dev *dev); + +Section 3.2.2.2 provides more detailed info on when to call +reset_link. + +3.2.2 PCI error-recovery callbacks + +The PCI Express AER Root driver uses error callbacks to coordinate +with downstream device drivers associated with a hierarchy in question +when performing error recovery actions. + +Data struct pci_driver has a pointer, err_handler, to point to +pci_error_handlers who consists of a couple of callback function +pointers. AER driver follows the rules defined in +pci-error-recovery.txt except pci express specific parts (e.g. +reset_link). Pls. refer to pci-error-recovery.txt for detailed +definitions of the callbacks. + +Below sections specify when to call the error callback functions. + +3.2.2.1 Correctable errors + +Correctable errors pose no impacts on the functionality of +the interface. The PCI Express protocol can recover without any +software intervention or any loss of data. These errors do not +require any recovery actions. The AER driver clears the device's +correctable error status register accordingly and logs these errors. + +3.2.2.2 Non-correctable (non-fatal and fatal) errors + +If an error message indicates a non-fatal error, performing link reset +at upstream is not required. The AER driver calls error_detected(dev, +pci_channel_io_normal) to all drivers associated within a hierarchy in +question. for example, +EndPoint<==>DownstreamPort B<==>UpstreamPort A<==>RootPort. +If Upstream port A captures an AER error, the hierarchy consists of +Downstream port B and EndPoint. + +A driver may return PCI_ERS_RESULT_CAN_RECOVER, +PCI_ERS_RESULT_DISCONNECT, or PCI_ERS_RESULT_NEED_RESET, depending on +whether it can recover or the AER driver calls mmio_enabled as next. + +If an error message indicates a fatal error, kernel will broadcast +error_detected(dev, pci_channel_io_frozen) to all drivers within +a hierarchy in question. Then, performing link reset at upstream is +necessary. As different kinds of devices might use different approaches +to reset link, AER port service driver is required to provide the +function to reset link. Firstly, kernel looks for if the upstream +component has an aer driver. If it has, kernel uses the reset_link +callback of the aer driver. If the upstream component has no aer driver +and the port is downstream port, we will use the aer driver of the +root port who reports the AER error. As for upstream ports, +they should provide their own aer service drivers with reset_link +function. If error_detected returns PCI_ERS_RESULT_CAN_RECOVER and +reset_link returns PCI_ERS_RESULT_RECOVERED, the error handling goes +to mmio_enabled. + +3.3 helper functions + +3.3.1 int pci_find_aer_capability(struct pci_dev *dev); +pci_find_aer_capability locates the PCI Express AER capability +in the device configuration space. If the device doesn't support +PCI-Express AER, the function returns 0. + +3.3.2 int pci_enable_pcie_error_reporting(struct pci_dev *dev); +pci_enable_pcie_error_reporting enables the device to send error +messages to root port when an error is detected. Note that devices +don't enable the error reporting by default, so device drivers need +call this function to enable it. + +3.3.3 int pci_disable_pcie_error_reporting(struct pci_dev *dev); +pci_disable_pcie_error_reporting disables the device to send error +messages to root port when an error is detected. + +3.3.4 int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); +pci_cleanup_aer_uncorrect_error_status cleanups the uncorrectable +error status register. + +3.4 Frequent Asked Questions + +Q: What happens if a PCI Express device driver does not provide an +error recovery handler (pci_driver->err_handler is equal to NULL)? + +A: The devices attached with the driver won't be recovered. If the +error is fatal, kernel will print out warning messages. Please refer +to section 3 for more information. + +Q: What happens if an upstream port service driver does not provide +callback reset_link? + +A: Fatal error recovery will fail if the errors are reported by the +upstream ports who are attached by the service driver. + +Q: How does this infrastructure deal with driver that is not PCI +Express aware? + +A: This infrastructure calls the error callback functions of the +driver when an error happens. But if the driver is not aware of +PCI Express, the device might not report its own errors to root +port. + +Q: What modifications will that driver need to make it compatible +with the PCI Express AER Root driver? + +A: It could call the helper functions to enable AER in devices and +cleanup uncorrectable status register. Pls. refer to section 3.3. + _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:00:08 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:00:08 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYS-00035L-BI; Wed, 26 Nov 2008 12:00:08 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYB-0002yO-58 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:51 -0800 X-ASG-Debug-ID: 1227729589-36a900090001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 97999EB89A for ; Wed, 26 Nov 2008 11:59:50 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id dNvJcCSSUoBHebG3 for ; Wed, 26 Nov 2008 11:59:50 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738314 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738314" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:49 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxn7X016050 for ; Wed, 26 Nov 2008 11:59:49 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0D6B019859 for ; Wed, 26 Nov 2008 12:00:13 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0Cr6019858 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:12 -0800 Message-Id: <200811262000.mAQK0Cr6019858@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:12 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] PCI-Express AER implementation: export pcie_port_bus_type X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729590 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 1.00 X-Barracuda-Spam-Status: No, SCORE=1.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M, BSF_RULE_7582B X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M 0.50 BSF_RULE_7582B Custom Rule 7582B Subject: [Xen-changelog] [linux-2.6.18-xen] PCI-Express AER implementation: export pcie_port_bus_type X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227524481 0 # Node ID 5f10331cb88b2ae5114f450325021e697f5ce2ec # Parent 69e10455038e61f0515f7b2d0ca692b1c19c46db PCI-Express AER implementation: export pcie_port_bus_type Signed-off-by: Zhang Yanmin Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pcie/portdrv_bus.c | 1 + 1 files changed, 1 insertion(+) diff -r 69e10455038e -r 5f10331cb88b drivers/pci/pcie/portdrv_bus.c --- a/drivers/pci/pcie/portdrv_bus.c Mon Nov 24 11:00:47 2008 +0000 +++ b/drivers/pci/pcie/portdrv_bus.c Mon Nov 24 11:01:21 2008 +0000 @@ -24,6 +24,7 @@ struct bus_type pcie_port_bus_type = { .suspend = pcie_port_bus_suspend, .resume = pcie_port_bus_resume, }; +EXPORT_SYMBOL_GPL(pcie_port_bus_type); static int pcie_port_bus_match(struct device *dev, struct device_driver *drv) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:00:15 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:00:15 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYZ-000397-Di; Wed, 26 Nov 2008 12:00:15 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYE-0002z1-6T for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:54 -0800 X-ASG-Debug-ID: 1227729592-372f00000000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 4B273EB89A for ; Wed, 26 Nov 2008 11:59:52 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id DJAH3jGmbOIAhhlE for ; Wed, 26 Nov 2008 11:59:52 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738316 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738316" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:51 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxpb5016056 for ; Wed, 26 Nov 2008 11:59:51 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0Fs4019893 for ; Wed, 26 Nov 2008 12:00:15 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0Fhq019892 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:15 -0800 Message-Id: <200811262000.mAQK0Fhq019892@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:14 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] PCI-Express AER implemetation: pcie_portdrv error handler. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729593 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] PCI-Express AER implemetation: pcie_portdrv error handler. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227524563 0 # Node ID df84c4c22a0a692ef8da7d31108b2d6055fef675 # Parent 30524c484bbb93c696f5c848614748c83b24ca55 PCI-Express AER implemetation: pcie_portdrv error handler. Signed-off-by: Zhang Yanmin Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pcie/portdrv_pci.c | 224 ++++++++++++++++++++++++++++++++++------- 1 files changed, 189 insertions(+), 35 deletions(-) diff -r 30524c484bbb -r df84c4c22a0a drivers/pci/pcie/portdrv_pci.c --- a/drivers/pci/pcie/portdrv_pci.c Mon Nov 24 11:02:14 2008 +0000 +++ b/drivers/pci/pcie/portdrv_pci.c Mon Nov 24 11:02:43 2008 +0000 @@ -14,8 +14,10 @@ #include #include #include +#include #include "portdrv.h" +#include "aer/aerdrv.h" /* * Version Information @@ -29,6 +31,43 @@ MODULE_LICENSE("GPL"); /* global data */ static const char device_name[] = "pcieport-driver"; + +static int pcie_portdrv_save_config(struct pci_dev *dev) +{ + return pci_save_state(dev); +} + +#ifdef CONFIG_PM +static int pcie_portdrv_restore_config(struct pci_dev *dev) +{ + int retval; + + pci_restore_state(dev); + retval = pci_enable_device(dev); + if (retval) + return retval; + pci_set_master(dev); + return 0; +} + +static int pcie_portdrv_suspend(struct pci_dev *dev, pm_message_t state) +{ + int ret = pcie_port_device_suspend(dev, state); + + if (!ret) + ret = pcie_portdrv_save_config(dev); + return ret; +} + +static int pcie_portdrv_resume(struct pci_dev *dev) +{ + pcie_portdrv_restore_config(dev); + return pcie_port_device_resume(dev); +} +#else +#define pcie_portdrv_suspend NULL +#define pcie_portdrv_resume NULL +#endif /* * pcie_portdrv_probe - Probe PCI-Express port devices @@ -61,6 +100,10 @@ static int __devinit pcie_portdrv_probe return -ENOMEM; } + pcie_portdrv_save_config(dev); + + pci_enable_pcie_error_reporting(dev); + return 0; } @@ -70,39 +113,143 @@ static void pcie_portdrv_remove (struct kfree(pci_get_drvdata(dev)); } -#ifdef CONFIG_PM -static int pcie_portdrv_save_config(struct pci_dev *dev) -{ - return pci_save_state(dev); -} - -static int pcie_portdrv_restore_config(struct pci_dev *dev) -{ - int retval; - - pci_restore_state(dev); - retval = pci_enable_device(dev); - if (retval) - return retval; - pci_set_master(dev); - return 0; -} - -static int pcie_portdrv_suspend (struct pci_dev *dev, pm_message_t state) -{ - int ret = pcie_port_device_suspend(dev, state); - - if (!ret) - ret = pcie_portdrv_save_config(dev); - return ret; -} - -static int pcie_portdrv_resume (struct pci_dev *dev) -{ - pcie_portdrv_restore_config(dev); - return pcie_port_device_resume(dev); -} -#endif +static int error_detected_iter(struct device *device, void *data) +{ + struct pcie_device *pcie_device; + struct pcie_port_service_driver *driver; + struct aer_broadcast_data *result_data; + pci_ers_result_t status; + + result_data = (struct aer_broadcast_data *) data; + + if (device->bus == &pcie_port_bus_type && device->driver) { + driver = to_service_driver(device->driver); + if (!driver || + !driver->err_handler || + !driver->err_handler->error_detected) + return 0; + + pcie_device = to_pcie_device(device); + + /* Forward error detected message to service drivers */ + status = driver->err_handler->error_detected( + pcie_device->port, + result_data->state); + result_data->result = + merge_result(result_data->result, status); + } + + return 0; +} + +static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev, + enum pci_channel_state error) +{ + struct aer_broadcast_data result_data = + {error, PCI_ERS_RESULT_CAN_RECOVER}; + + device_for_each_child(&dev->dev, &result_data, error_detected_iter); + + return result_data.result; +} + +static int mmio_enabled_iter(struct device *device, void *data) +{ + struct pcie_device *pcie_device; + struct pcie_port_service_driver *driver; + pci_ers_result_t status, *result; + + result = (pci_ers_result_t *) data; + + if (device->bus == &pcie_port_bus_type && device->driver) { + driver = to_service_driver(device->driver); + if (driver && + driver->err_handler && + driver->err_handler->mmio_enabled) { + pcie_device = to_pcie_device(device); + + /* Forward error message to service drivers */ + status = driver->err_handler->mmio_enabled( + pcie_device->port); + *result = merge_result(*result, status); + } + } + + return 0; +} + +static pci_ers_result_t pcie_portdrv_mmio_enabled(struct pci_dev *dev) +{ + pci_ers_result_t status = PCI_ERS_RESULT_RECOVERED; + + device_for_each_child(&dev->dev, &status, mmio_enabled_iter); + return status; +} + +static int slot_reset_iter(struct device *device, void *data) +{ + struct pcie_device *pcie_device; + struct pcie_port_service_driver *driver; + pci_ers_result_t status, *result; + + result = (pci_ers_result_t *) data; + + if (device->bus == &pcie_port_bus_type && device->driver) { + driver = to_service_driver(device->driver); + if (driver && + driver->err_handler && + driver->err_handler->slot_reset) { + pcie_device = to_pcie_device(device); + + /* Forward error message to service drivers */ + status = driver->err_handler->slot_reset( + pcie_device->port); + *result = merge_result(*result, status); + } + } + + return 0; +} + +static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) +{ + pci_ers_result_t status; + + /* If fatal, restore cfg space for possible link reset at upstream */ + if (dev->error_state == pci_channel_io_frozen) { + pcie_portdrv_restore_config(dev); + pci_enable_pcie_error_reporting(dev); + } + + device_for_each_child(&dev->dev, &status, slot_reset_iter); + + return status; +} + +static int resume_iter(struct device *device, void *data) +{ + struct pcie_device *pcie_device; + struct pcie_port_service_driver *driver; + + if (device->bus == &pcie_port_bus_type && device->driver) { + driver = to_service_driver(device->driver); + if (driver && + driver->err_handler && + driver->err_handler->resume) { + pcie_device = to_pcie_device(device); + + /* Forward error message to service drivers */ + driver->err_handler->resume(pcie_device->port); + } + } + + return 0; +} + +static void pcie_portdrv_err_resume(struct pci_dev *dev) +{ + device_for_each_child(&dev->dev, NULL, resume_iter); +} /* * LINUX Device Driver Model @@ -114,6 +261,13 @@ static const struct pci_device_id port_p }; MODULE_DEVICE_TABLE(pci, port_pci_ids); +static struct pci_error_handlers pcie_portdrv_err_handler = { + .error_detected = pcie_portdrv_error_detected, + .mmio_enabled = pcie_portdrv_mmio_enabled, + .slot_reset = pcie_portdrv_slot_reset, + .resume = pcie_portdrv_err_resume, +}; + static struct pci_driver pcie_portdrv = { .name = (char *)device_name, .id_table = &port_pci_ids[0], @@ -121,10 +275,10 @@ static struct pci_driver pcie_portdrv = .probe = pcie_portdrv_probe, .remove = pcie_portdrv_remove, -#ifdef CONFIG_PM .suspend = pcie_portdrv_suspend, .resume = pcie_portdrv_resume, -#endif /* PM */ + + .err_handler = &pcie_portdrv_err_handler, }; static int __init pcie_portdrv_init(void) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:00:22 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:00:22 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYg-0003D5-75; Wed, 26 Nov 2008 12:00:22 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYE-0002zW-WF for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:55 -0800 X-ASG-Debug-ID: 1227729593-372f00010000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 33ED6EA13D for ; Wed, 26 Nov 2008 11:59:53 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id IN17lYXCNUqqigHz for ; Wed, 26 Nov 2008 11:59:53 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738317 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738317" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:53 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxqUL016059 for ; Wed, 26 Nov 2008 11:59:52 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0GdY019910 for ; Wed, 26 Nov 2008 12:00:16 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0GFV019909 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:16 -0800 Message-Id: <200811262000.mAQK0GFV019909@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:15 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] pci: small fix of aerdrv_core, add one new function of get_device by BDF X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729594 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] pci: small fix of aerdrv_core, add one new function of get_device by BDF X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227524601 0 # Node ID 5888ffa4b252f11749b3fde82eeb5ab68bb2e537 # Parent df84c4c22a0a692ef8da7d31108b2d6055fef675 pci: small fix of aerdrv_core, add one new function of get_device by BDF Signed-off-by: Jiang Yunhong Signed-off-by: Ke Liping --- drivers/pci/pcie/aer/aerdrv_core.c | 2 +- drivers/pci/search.c | 31 +++++++++++++++++++++++++++++++ include/linux/pci.h | 6 ++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff -r df84c4c22a0a -r 5888ffa4b252 drivers/pci/pcie/aer/aerdrv_core.c --- a/drivers/pci/pcie/aer/aerdrv_core.c Mon Nov 24 11:02:43 2008 +0000 +++ b/drivers/pci/pcie/aer/aerdrv_core.c Mon Nov 24 11:03:21 2008 +0000 @@ -263,7 +263,7 @@ static void report_resume(struct pci_dev if (!dev->driver || !dev->driver->err_handler || - !dev->driver->err_handler->slot_reset) + !dev->driver->err_handler->resume) return; err_handler = dev->driver->err_handler; diff -r df84c4c22a0a -r 5888ffa4b252 drivers/pci/search.c --- a/drivers/pci/search.c Mon Nov 24 11:02:43 2008 +0000 +++ b/drivers/pci/search.c Mon Nov 24 11:03:21 2008 +0000 @@ -380,6 +380,36 @@ exit: up_read(&pci_bus_sem); return found; } + +/** + * pci_get_bus_and_slot - locate PCI device from a given PCI bus & slot + * @bus: number of PCI bus on which desired PCI device resides + * @devfn: encodes number of PCI slot in which the desired PCI + * device resides and the logical device number within that slot + * in case of multi-function devices. + * + * Note: the bus/slot search is limited to PCI domain (segment) 0. + * + * Given a PCI bus and slot/function number, the desired PCI device + * is located in system global list of PCI devices. If the device + * is found, a pointer to its data structure is returned. If no + * device is found, %NULL is returned. The returned device has its + * reference count bumped by one. + */ + +struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) +{ + struct pci_dev *dev = NULL; + + while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + if (pci_domain_nr(dev->bus) == 0 && + (dev->bus->number == bus && dev->devfn == devfn)) + return dev; + } + return NULL; +} + + EXPORT_SYMBOL(pci_dev_present); EXPORT_SYMBOL(pci_find_bus); @@ -390,4 +420,5 @@ EXPORT_SYMBOL(pci_get_device); EXPORT_SYMBOL(pci_get_device); EXPORT_SYMBOL(pci_get_subsys); EXPORT_SYMBOL(pci_get_slot); +EXPORT_SYMBOL(pci_get_bus_and_slot); EXPORT_SYMBOL(pci_get_class); diff -r df84c4c22a0a -r 5888ffa4b252 include/linux/pci.h --- a/include/linux/pci.h Mon Nov 24 11:02:43 2008 +0000 +++ b/include/linux/pci.h Mon Nov 24 11:03:21 2008 +0000 @@ -456,6 +456,7 @@ struct pci_dev *pci_get_subsys (unsigned unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from); struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); +struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); int pci_dev_present(const struct pci_device_id *ids); @@ -655,6 +656,11 @@ static inline struct pci_dev *pci_find_s static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) { return NULL; } + +static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) +{ + return NULL; +} static inline struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from) { return NULL; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:00:31 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:00:31 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYo-0003Hd-S3; Wed, 26 Nov 2008 12:00:31 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYF-0002zs-Kc for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:55 -0800 X-ASG-Debug-ID: 1227729589-36a900090002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id D7A9EEA133 for ; Wed, 26 Nov 2008 11:59:51 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id D2kqF0YpzQehxynl for ; Wed, 26 Nov 2008 11:59:51 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738315 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738315" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:50 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxoDI016053 for ; Wed, 26 Nov 2008 11:59:50 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0EBv019876 for ; Wed, 26 Nov 2008 12:00:14 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0EGH019875 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:14 -0800 Message-Id: <200811262000.mAQK0EGH019875@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:13 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] PCI-Express AER implemetation: AER core and aerdriver X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729592 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] PCI-Express AER implemetation: AER core and aerdriver X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227524534 0 # Node ID 30524c484bbb93c696f5c848614748c83b24ca55 # Parent 5f10331cb88b2ae5114f450325021e697f5ce2ec PCI-Express AER implemetation: AER core and aerdriver Signed-off-by: Zhang Yanmin Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pcie/Kconfig | 1 drivers/pci/pcie/Makefile | 3 drivers/pci/pcie/aer/Kconfig | 12 drivers/pci/pcie/aer/Makefile | 8 drivers/pci/pcie/aer/aerdrv.c | 346 +++++++++++++++ drivers/pci/pcie/aer/aerdrv.h | 125 +++++ drivers/pci/pcie/aer/aerdrv_acpi.c | 68 ++ drivers/pci/pcie/aer/aerdrv_core.c | 757 +++++++++++++++++++++++++++++++++ drivers/pci/pcie/aer/aerdrv_errprint.c | 248 ++++++++++ include/linux/aer.h | 24 + include/linux/pcieport_if.h | 6 11 files changed, 1598 insertions(+) diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/Kconfig --- a/drivers/pci/pcie/Kconfig Mon Nov 24 11:01:21 2008 +0000 +++ b/drivers/pci/pcie/Kconfig Mon Nov 24 11:02:14 2008 +0000 @@ -34,3 +34,4 @@ config HOTPLUG_PCI_PCIE_POLL_EVENT_MODE When in doubt, say N. +source "drivers/pci/pcie/aer/Kconfig" diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/Makefile --- a/drivers/pci/pcie/Makefile Mon Nov 24 11:01:21 2008 +0000 +++ b/drivers/pci/pcie/Makefile Mon Nov 24 11:02:14 2008 +0000 @@ -5,3 +5,6 @@ pcieportdrv-y := portdrv_core.o portdr pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o + +# Build PCI Express AER if needed +obj-$(CONFIG_PCIEAER) += aer/ diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/aer/Kconfig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/Kconfig Mon Nov 24 11:02:14 2008 +0000 @@ -0,0 +1,12 @@ +# +# PCI Express Root Port Device AER Configuration +# + +config PCIEAER + boolean "Root Port Advanced Error Reporting support" + depends on PCIEPORTBUS && ACPI + default y + help + This enables PCI Express Root Port Advanced Error Reporting + (AER) driver support. Error reporting messages sent to Root + Port will be handled by PCI Express AER driver. diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/aer/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/Makefile Mon Nov 24 11:02:14 2008 +0000 @@ -0,0 +1,8 @@ +# +# Makefile for PCI-Express Root Port Advanced Error Reporting Driver +# + +obj-$(CONFIG_PCIEAER) += aerdriver.o + +aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o aerdrv_acpi.o + diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/aer/aerdrv.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv.c Mon Nov 24 11:02:14 2008 +0000 @@ -0,0 +1,346 @@ +/* + * drivers/pci/pcie/aer/aerdrv.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * This file implements the AER root port service driver. The driver will + * register an irq handler. When root port triggers an AER interrupt, the irq + * handler will collect root port status and schedule a work. + * + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "aerdrv.h" + +/* + * Version Information + */ +#define DRIVER_VERSION "v1.0" +#define DRIVER_AUTHOR "tom.l.nguyen@intel.com" +#define DRIVER_DESC "Root Port Advanced Error Reporting Driver" +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL"); + +static int __devinit aer_probe (struct pcie_device *dev, + const struct pcie_port_service_id *id ); +static void aer_remove(struct pcie_device *dev); +static int aer_suspend(struct pcie_device *dev, pm_message_t state) +{return 0;} +static int aer_resume(struct pcie_device *dev) {return 0;} +static pci_ers_result_t aer_error_detected(struct pci_dev *dev, + enum pci_channel_state error); +static void aer_error_resume(struct pci_dev *dev); +static pci_ers_result_t aer_root_reset(struct pci_dev *dev); + +/* + * PCI Express bus's AER Root service driver data structure + */ +static struct pcie_port_service_id aer_id[] = { + { + .vendor = PCI_ANY_ID, + .device = PCI_ANY_ID, + .port_type = PCIE_RC_PORT, + .service_type = PCIE_PORT_SERVICE_AER, + }, + { /* end: all zeroes */ } +}; + +static struct pci_error_handlers aer_error_handlers = { + .error_detected = aer_error_detected, + .resume = aer_error_resume, +}; + +static struct pcie_port_service_driver aerdrv = { + .name = "aer", + .id_table = &aer_id[0], + + .probe = aer_probe, + .remove = aer_remove, + + .suspend = aer_suspend, + .resume = aer_resume, + + .err_handler = &aer_error_handlers, + + .reset_link = aer_root_reset, +}; + +/** + * aer_irq - Root Port's ISR + * @irq: IRQ assigned to Root Port + * @context: pointer to Root Port data structure + * @r: pointer struct pt_regs + * + * Invoked when Root Port detects AER messages. + **/ +static irqreturn_t aer_irq(int irq, void *context, struct pt_regs * r) +{ + unsigned int status, id; + struct pcie_device *pdev = (struct pcie_device *)context; + struct aer_rpc *rpc = get_service_data(pdev); + int next_prod_idx; + unsigned long flags; + int pos; + + pos = pci_find_aer_capability(pdev->port); + /* + * Must lock access to Root Error Status Reg, Root Error ID Reg, + * and Root error producer/consumer index + */ + spin_lock_irqsave(&rpc->e_lock, flags); + + /* Read error status */ + pci_read_config_dword(pdev->port, pos + PCI_ERR_ROOT_STATUS, &status); + if (!(status & ROOT_ERR_STATUS_MASKS)) { + spin_unlock_irqrestore(&rpc->e_lock, flags); + return IRQ_NONE; + } + + /* Read error source and clear error status */ + pci_read_config_dword(pdev->port, pos + PCI_ERR_ROOT_COR_SRC, &id); + pci_write_config_dword(pdev->port, pos + PCI_ERR_ROOT_STATUS, status); + + /* Store error source for later DPC handler */ + next_prod_idx = rpc->prod_idx + 1; + if (next_prod_idx == AER_ERROR_SOURCES_MAX) + next_prod_idx = 0; + if (next_prod_idx == rpc->cons_idx) { + /* + * Error Storm Condition - possibly the same error occurred. + * Drop the error. + */ + spin_unlock_irqrestore(&rpc->e_lock, flags); + return IRQ_HANDLED; + } + rpc->e_sources[rpc->prod_idx].status = status; + rpc->e_sources[rpc->prod_idx].id = id; + rpc->prod_idx = next_prod_idx; + spin_unlock_irqrestore(&rpc->e_lock, flags); + + /* Invoke DPC handler */ + schedule_work(&rpc->dpc_handler); + + return IRQ_HANDLED; +} + +/** + * aer_alloc_rpc - allocate Root Port data structure + * @dev: pointer to the pcie_dev data structure + * + * Invoked when Root Port's AER service is loaded. + **/ +static struct aer_rpc* aer_alloc_rpc(struct pcie_device *dev) +{ + struct aer_rpc *rpc; + + if (!(rpc = (struct aer_rpc *)kmalloc(sizeof(struct aer_rpc), + GFP_KERNEL))) + return NULL; + + memset(rpc, 0, sizeof(struct aer_rpc)); + /* + * Initialize Root lock access, e_lock, to Root Error Status Reg, + * Root Error ID Reg, and Root error producer/consumer index. + */ + rpc->e_lock = SPIN_LOCK_UNLOCKED; + + rpc->rpd = dev; + INIT_WORK(&rpc->dpc_handler, aer_isr, (void *)dev); + rpc->prod_idx = rpc->cons_idx = 0; + mutex_init(&rpc->rpc_mutex); + init_waitqueue_head(&rpc->wait_release); + + /* Use PCIE bus function to store rpc into PCIE device */ + set_service_data(dev, rpc); + + return rpc; +} + +/** + * aer_remove - clean up resources + * @dev: pointer to the pcie_dev data structure + * + * Invoked when PCI Express bus unloads or AER probe fails. + **/ +static void aer_remove(struct pcie_device *dev) +{ + struct aer_rpc *rpc = get_service_data(dev); + + if (rpc) { + /* If register interrupt service, it must be free. */ + if (rpc->isr) + free_irq(dev->irq, dev); + + wait_event(rpc->wait_release, rpc->prod_idx == rpc->cons_idx); + + aer_delete_rootport(rpc); + set_service_data(dev, NULL); + } +} + +/** + * aer_probe - initialize resources + * @dev: pointer to the pcie_dev data structure + * @id: pointer to the service id data structure + * + * Invoked when PCI Express bus loads AER service driver. + **/ +static int __devinit aer_probe (struct pcie_device *dev, + const struct pcie_port_service_id *id ) +{ + int status; + struct aer_rpc *rpc; + struct device *device = &dev->device; + + /* Init */ + if ((status = aer_init(dev))) + return status; + + /* Alloc rpc data structure */ + if (!(rpc = aer_alloc_rpc(dev))) { + printk(KERN_DEBUG "%s: Alloc rpc fails on PCIE device[%s]\n", + __FUNCTION__, device->bus_id); + aer_remove(dev); + return -ENOMEM; + } + + /* Request IRQ ISR */ + if ((status = request_irq(dev->irq, aer_irq, SA_SHIRQ, "aerdrv", + dev))) { + printk(KERN_DEBUG "%s: Request ISR fails on PCIE device[%s]\n", + __FUNCTION__, device->bus_id); + aer_remove(dev); + return status; + } + + rpc->isr = 1; + + aer_enable_rootport(rpc); + + return status; +} + +/** + * aer_root_reset - reset link on Root Port + * @dev: pointer to Root Port's pci_dev data structure + * + * Invoked by Port Bus driver when performing link reset at Root Port. + **/ +static pci_ers_result_t aer_root_reset(struct pci_dev *dev) +{ + u16 p2p_ctrl; + u32 status; + int pos; + + pos = pci_find_aer_capability(dev); + + /* Disable Root's interrupt in response to error messages */ + pci_write_config_dword(dev, pos + PCI_ERR_ROOT_COMMAND, 0); + + /* Assert Secondary Bus Reset */ + pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &p2p_ctrl); + p2p_ctrl |= PCI_CB_BRIDGE_CTL_CB_RESET; + pci_write_config_word(dev, PCI_BRIDGE_CONTROL, p2p_ctrl); + + /* De-assert Secondary Bus Reset */ + p2p_ctrl &= ~PCI_CB_BRIDGE_CTL_CB_RESET; + pci_write_config_word(dev, PCI_BRIDGE_CONTROL, p2p_ctrl); + + /* + * System software must wait for at least 100ms from the end + * of a reset of one or more device before it is permitted + * to issue Configuration Requests to those devices. + */ + msleep(200); + printk(KERN_DEBUG "Complete link reset at Root[%s]\n", dev->dev.bus_id); + + /* Enable Root Port's interrupt in response to error messages */ + pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &status); + pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, status); + pci_write_config_dword(dev, + pos + PCI_ERR_ROOT_COMMAND, + ROOT_PORT_INTR_ON_MESG_MASK); + + return PCI_ERS_RESULT_RECOVERED; +} + +/** + * aer_error_detected - update severity status + * @dev: pointer to Root Port's pci_dev data structure + * @error: error severity being notified by port bus + * + * Invoked by Port Bus driver during error recovery. + **/ +static pci_ers_result_t aer_error_detected(struct pci_dev *dev, + enum pci_channel_state error) +{ + /* Root Port has no impact. Always recovers. */ + return PCI_ERS_RESULT_CAN_RECOVER; +} + +/** + * aer_error_resume - clean up corresponding error status bits + * @dev: pointer to Root Port's pci_dev data structure + * + * Invoked by Port Bus driver during nonfatal recovery. + **/ +static void aer_error_resume(struct pci_dev *dev) +{ + int pos; + u32 status, mask; + u16 reg16; + + /* Clean up Root device status */ + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, ®16); + pci_write_config_word(dev, pos + PCI_EXP_DEVSTA, reg16); + + /* Clean AER Root Error Status */ + pos = pci_find_aer_capability(dev); + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status); + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, &mask); + if (dev->error_state == pci_channel_io_normal) + status &= ~mask; /* Clear corresponding nonfatal bits */ + else + status &= mask; /* Clear corresponding fatal bits */ + pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); +} + +/** + * aer_service_init - register AER root service driver + * + * Invoked when AER root service driver is loaded. + **/ +static int __init aer_service_init(void) +{ + return pcie_port_service_register(&aerdrv); +} + +/** + * aer_service_exit - unregister AER root service driver + * + * Invoked when AER root service driver is unloaded. + **/ +static void __exit aer_service_exit(void) +{ + pcie_port_service_unregister(&aerdrv); +} + +module_init(aer_service_init); +module_exit(aer_service_exit); diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/aer/aerdrv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv.h Mon Nov 24 11:02:14 2008 +0000 @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#ifndef _AERDRV_H_ +#define _AERDRV_H_ + +#include +#include + +#define AER_NONFATAL 0 +#define AER_FATAL 1 +#define AER_CORRECTABLE 2 +#define AER_UNCORRECTABLE 4 +#define AER_ERROR_MASK 0x001fffff +#define AER_ERROR(d) (d & AER_ERROR_MASK) + +#define OSC_METHOD_RUN_SUCCESS 0 +#define OSC_METHOD_NOT_SUPPORTED 1 +#define OSC_METHOD_RUN_FAILURE 2 + +/* Root Error Status Register Bits */ +#define ROOT_ERR_STATUS_MASKS 0x0f + +#define SYSTEM_ERROR_INTR_ON_MESG_MASK (PCI_EXP_RTCTL_SECEE| \ + PCI_EXP_RTCTL_SENFEE| \ + PCI_EXP_RTCTL_SEFEE) +#define ROOT_PORT_INTR_ON_MESG_MASK (PCI_ERR_ROOT_CMD_COR_EN| \ + PCI_ERR_ROOT_CMD_NONFATAL_EN| \ + PCI_ERR_ROOT_CMD_FATAL_EN) +#define ERR_COR_ID(d) (d & 0xffff) +#define ERR_UNCOR_ID(d) (d >> 16) + +#define AER_SUCCESS 0 +#define AER_UNSUCCESS 1 +#define AER_ERROR_SOURCES_MAX 100 + +#define AER_LOG_TLP_MASKS (PCI_ERR_UNC_POISON_TLP| \ + PCI_ERR_UNC_ECRC| \ + PCI_ERR_UNC_UNSUP| \ + PCI_ERR_UNC_COMP_ABORT| \ + PCI_ERR_UNC_UNX_COMP| \ + PCI_ERR_UNC_MALF_TLP) + +/* AER Error Info Flags */ +#define AER_TLP_HEADER_VALID_FLAG 0x00000001 +#define AER_MULTI_ERROR_VALID_FLAG 0x00000002 + +#define ERR_CORRECTABLE_ERROR_MASK 0x000031c1 +#define ERR_UNCORRECTABLE_ERROR_MASK 0x001ff010 + +struct header_log_regs { + unsigned int dw0; + unsigned int dw1; + unsigned int dw2; + unsigned int dw3; +}; + +struct aer_err_info { + int severity; /* 0:NONFATAL | 1:FATAL | 2:COR */ + int flags; + unsigned int status; /* COR/UNCOR Error Status */ + struct header_log_regs tlp; /* TLP Header */ +}; + +struct aer_err_source { + unsigned int status; + unsigned int id; +}; + +struct aer_rpc { + struct pcie_device *rpd; /* Root Port device */ + struct work_struct dpc_handler; + struct aer_err_source e_sources[AER_ERROR_SOURCES_MAX]; + unsigned short prod_idx; /* Error Producer Index */ + unsigned short cons_idx; /* Error Consumer Index */ + int isr; + spinlock_t e_lock; /* + * Lock access to Error Status/ID Regs + * and error producer/consumer index + */ + struct mutex rpc_mutex; /* + * only one thread could do + * recovery on the same + * root port hierachy + */ + wait_queue_head_t wait_release; +}; + +struct aer_broadcast_data { + enum pci_channel_state state; + enum pci_ers_result result; +}; + +static inline pci_ers_result_t merge_result(enum pci_ers_result orig, + enum pci_ers_result new) +{ + switch (orig) { + case PCI_ERS_RESULT_CAN_RECOVER: + case PCI_ERS_RESULT_RECOVERED: + orig = new; + break; + case PCI_ERS_RESULT_DISCONNECT: + if (new == PCI_ERS_RESULT_NEED_RESET) + orig = new; + break; + default: + break; + } + + return orig; +} + +extern struct bus_type pcie_port_bus_type; +extern void aer_enable_rootport(struct aer_rpc *rpc); +extern void aer_delete_rootport(struct aer_rpc *rpc); +extern int aer_init(struct pcie_device *dev); +extern void aer_isr(void *context); +extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); +extern int aer_osc_setup(struct pci_dev *dev); + +#endif //_AERDRV_H_ diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/aer/aerdrv_acpi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c Mon Nov 24 11:02:14 2008 +0000 @@ -0,0 +1,68 @@ +/* + * Access ACPI _OSC method + * + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "aerdrv.h" + +/** + * aer_osc_setup - run ACPI _OSC method + * + * Return: + * Zero if success. Nonzero for otherwise. + * + * Invoked when PCIE bus loads AER service driver. To avoid conflict with + * BIOS AER support requires BIOS to yield AER control to OS native driver. + **/ +int aer_osc_setup(struct pci_dev *dev) +{ + int retval = OSC_METHOD_RUN_SUCCESS; + acpi_status status; + acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); + struct pci_dev *pdev = dev; + struct pci_bus *parent; + + while (!handle) { + if (!pdev || !pdev->bus->parent) + break; + parent = pdev->bus->parent; + if (!parent->self) + /* Parent must be a host bridge */ + handle = acpi_get_pci_rootbridge_handle( + pci_domain_nr(parent), + parent->number); + else + handle = DEVICE_ACPI_HANDLE( + &(parent->self->dev)); + pdev = parent->self; + } + + if (!handle) + return OSC_METHOD_NOT_SUPPORTED; + + pci_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT); + status = pci_osc_control_set(handle, OSC_PCI_EXPRESS_AER_CONTROL | + OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); + if (ACPI_FAILURE(status)) { + if (status == AE_SUPPORT) + retval = OSC_METHOD_NOT_SUPPORTED; + else + retval = OSC_METHOD_RUN_FAILURE; + } + + return retval; +} + diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/aer/aerdrv_core.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv_core.c Mon Nov 24 11:02:14 2008 +0000 @@ -0,0 +1,757 @@ +/* + * drivers/pci/pcie/aer/aerdrv_core.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * This file implements the core part of PCI-Express AER. When an pci-express + * error is delivered, an error message will be collected and printed to + * console, then, an error recovery procedure will be executed by following + * the pci error recovery rules. + * + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "aerdrv.h" + +static int forceload; +module_param(forceload, bool, 0); + +#define PCI_CFG_SPACE_SIZE (0x100) +int pci_find_aer_capability(struct pci_dev *dev) +{ + int pos; + u32 reg32 = 0; + + /* Check if it's a pci-express device */ + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return 0; + + /* Check if it supports pci-express AER */ + pos = PCI_CFG_SPACE_SIZE; + while (pos) { + if (pci_read_config_dword(dev, pos, ®32)) + return 0; + + /* some broken boards return ~0 */ + if (reg32 == 0xffffffff) + return 0; + + if (PCI_EXT_CAP_ID(reg32) == PCI_EXT_CAP_ID_ERR) + break; + + pos = reg32 >> 20; + } + + return pos; +} + +int pci_enable_pcie_error_reporting(struct pci_dev *dev) +{ + u16 reg16 = 0; + int pos; + + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return -EIO; + + pci_read_config_word(dev, pos+PCI_EXP_DEVCTL, ®16); + reg16 = reg16 | + PCI_EXP_DEVCTL_CERE | + PCI_EXP_DEVCTL_NFERE | + PCI_EXP_DEVCTL_FERE | + PCI_EXP_DEVCTL_URRE; + pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, + reg16); + return 0; +} + +int pci_disable_pcie_error_reporting(struct pci_dev *dev) +{ + u16 reg16 = 0; + int pos; + + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return -EIO; + + pci_read_config_word(dev, pos+PCI_EXP_DEVCTL, ®16); + reg16 = reg16 & ~(PCI_EXP_DEVCTL_CERE | + PCI_EXP_DEVCTL_NFERE | + PCI_EXP_DEVCTL_FERE | + PCI_EXP_DEVCTL_URRE); + pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, + reg16); + return 0; +} + +int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) +{ + int pos; + u32 status, mask; + + pos = pci_find_aer_capability(dev); + if (!pos) + return -EIO; + + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status); + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, &mask); + if (dev->error_state == pci_channel_io_normal) + status &= ~mask; /* Clear corresponding nonfatal bits */ + else + status &= mask; /* Clear corresponding fatal bits */ + pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); + + return 0; +} + +static int find_device_iter(struct device *device, void *data) +{ + struct pci_dev *dev; + u16 id = *(unsigned long *)data; + u8 secondary, subordinate, d_bus = id >> 8; + + if (device->bus == &pci_bus_type) { + dev = to_pci_dev(device); + if (id == ((dev->bus->number << 8) | dev->devfn)) { + /* + * Device ID match + */ + *(unsigned long*)data = (unsigned long)device; + return 1; + } + + /* + * If device is P2P, check if it is an upstream? + */ + if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE) { + pci_read_config_byte(dev, PCI_SECONDARY_BUS, + &secondary); + pci_read_config_byte(dev, PCI_SUBORDINATE_BUS, + &subordinate); + if (d_bus >= secondary && d_bus <= subordinate) { + *(unsigned long*)data = (unsigned long)device; + return 1; + } + } + } + + return 0; +} + +/** + * find_source_device - search through device hierarchy for source device + * @p_dev: pointer to Root Port pci_dev data structure + * @id: device ID of agent who sends an error message to this Root Port + * + * Invoked when error is detected at the Root Port. + **/ +static struct device* find_source_device(struct pci_dev *parent, u16 id) +{ + struct pci_dev *dev = parent; + struct device *device; + unsigned long device_addr; + int status; + + /* Is Root Port an agent that sends error message? */ + if (id == ((dev->bus->number << 8) | dev->devfn)) + return &dev->dev; + + do { + device_addr = id; + if ((status = device_for_each_child(&dev->dev, + &device_addr, find_device_iter))) { + device = (struct device*)device_addr; + dev = to_pci_dev(device); + if (id == ((dev->bus->number << 8) | dev->devfn)) + return device; + } + }while (status); + + return NULL; +} + +static void report_error_detected(struct pci_dev *dev, void *data) +{ + pci_ers_result_t vote; + struct pci_error_handlers *err_handler; + struct aer_broadcast_data *result_data; + result_data = (struct aer_broadcast_data *) data; + + dev->error_state = result_data->state; + + if (!dev->driver || + !dev->driver->err_handler || + !dev->driver->err_handler->error_detected) { + if (result_data->state == pci_channel_io_frozen && + !(dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)) { + /* + * In case of fatal recovery, if one of down- + * stream device has no driver. We might be + * unable to recover because a later insmod + * of a driver for this device is unaware of + * its hw state. + */ + printk(KERN_DEBUG "Device ID[%s] has %s\n", + dev->dev.bus_id, (dev->driver) ? + "no AER-aware driver" : "no driver"); + } + return; + } + + err_handler = dev->driver->err_handler; + vote = err_handler->error_detected(dev, result_data->state); + result_data->result = merge_result(result_data->result, vote); + return; +} + +static void report_mmio_enabled(struct pci_dev *dev, void *data) +{ + pci_ers_result_t vote; + struct pci_error_handlers *err_handler; + struct aer_broadcast_data *result_data; + result_data = (struct aer_broadcast_data *) data; + + if (!dev->driver || + !dev->driver->err_handler || + !dev->driver->err_handler->mmio_enabled) + return; + + err_handler = dev->driver->err_handler; + vote = err_handler->mmio_enabled(dev); + result_data->result = merge_result(result_data->result, vote); + return; +} + +static void report_slot_reset(struct pci_dev *dev, void *data) +{ + pci_ers_result_t vote; + struct pci_error_handlers *err_handler; + struct aer_broadcast_data *result_data; + result_data = (struct aer_broadcast_data *) data; + + if (!dev->driver || + !dev->driver->err_handler || + !dev->driver->err_handler->slot_reset) + return; + + err_handler = dev->driver->err_handler; + vote = err_handler->slot_reset(dev); + result_data->result = merge_result(result_data->result, vote); + return; +} + +static void report_resume(struct pci_dev *dev, void *data) +{ + struct pci_error_handlers *err_handler; + + dev->error_state = pci_channel_io_normal; + + if (!dev->driver || + !dev->driver->err_handler || + !dev->driver->err_handler->slot_reset) + return; + + err_handler = dev->driver->err_handler; + err_handler->resume(dev); + return; +} + +/** + * broadcast_error_message - handle message broadcast to downstream drivers + * @device: pointer to from where in a hierarchy message is broadcasted down + * @api: callback to be broadcasted + * @state: error state + * + * Invoked during error recovery process. Once being invoked, the content + * of error severity will be broadcasted to all downstream drivers in a + * hierarchy in question. + **/ +static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, + enum pci_channel_state state, + char *error_mesg, + void (*cb)(struct pci_dev *, void *)) +{ + struct aer_broadcast_data result_data; + + printk(KERN_DEBUG "Broadcast %s message\n", error_mesg); + result_data.state = state; + if (cb == report_error_detected) + result_data.result = PCI_ERS_RESULT_CAN_RECOVER; + else + result_data.result = PCI_ERS_RESULT_RECOVERED; + + if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE) { + /* + * If the error is reported by a bridge, we think this error + * is related to the downstream link of the bridge, so we + * do error recovery on all subordinates of the bridge instead + * of the bridge and clear the error status of the bridge. + */ + if (cb == report_error_detected) + dev->error_state = state; + pci_walk_bus(dev->subordinate, cb, &result_data); + if (cb == report_resume) { + pci_cleanup_aer_uncorrect_error_status(dev); + dev->error_state = pci_channel_io_normal; + } + } + else { + /* + * If the error is reported by an end point, we think this + * error is related to the upstream link of the end point. + */ + pci_walk_bus(dev->bus, cb, &result_data); + } + + return result_data.result; +} + +struct find_aer_service_data { + struct pcie_port_service_driver *aer_driver; + int is_downstream; +}; + +static int find_aer_service_iter(struct device *device, void *data) +{ + struct device_driver *driver; + struct pcie_port_service_driver *service_driver; + struct pcie_device *pcie_dev; + struct find_aer_service_data *result; + + result = (struct find_aer_service_data *) data; + + if (device->bus == &pcie_port_bus_type) { + pcie_dev = to_pcie_device(device); + if (pcie_dev->id.port_type == PCIE_SW_DOWNSTREAM_PORT) + result->is_downstream = 1; + + driver = device->driver; + if (driver) { + service_driver = to_service_driver(driver); + if (service_driver->id_table->service_type == + PCIE_PORT_SERVICE_AER) { + result->aer_driver = service_driver; + return 1; + } + } + } + + return 0; +} + +static void find_aer_service(struct pci_dev *dev, + struct find_aer_service_data *data) +{ + device_for_each_child(&dev->dev, data, find_aer_service_iter); +} + +static pci_ers_result_t reset_link(struct pcie_device *aerdev, + struct pci_dev *dev) +{ + struct pci_dev *udev; + pci_ers_result_t status; + struct find_aer_service_data data; + + if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE) + udev = dev; + else + udev= dev->bus->self; + + data.is_downstream = 0; + data.aer_driver = NULL; + find_aer_service(udev, &data); + + /* + * Use the aer driver of the error agent firstly. + * If it hasn't the aer driver, use the root port's + */ + if (!data.aer_driver || !data.aer_driver->reset_link) { + if (data.is_downstream && + aerdev->device.driver && + to_service_driver(aerdev->device.driver)->reset_link) { + data.aer_driver = + to_service_driver(aerdev->device.driver); + } else { + printk(KERN_DEBUG "No link-reset support to Device ID" + "[%s]\n", + dev->dev.bus_id); + return PCI_ERS_RESULT_DISCONNECT; + } + } + + status = data.aer_driver->reset_link(udev); + if (status != PCI_ERS_RESULT_RECOVERED) { + printk(KERN_DEBUG "Link reset at upstream Device ID" + "[%s] failed\n", + udev->dev.bus_id); + return PCI_ERS_RESULT_DISCONNECT; + } + + return status; +} + +/** + * do_recovery - handle nonfatal/fatal error recovery process + * @aerdev: pointer to a pcie_device data structure of root port + * @dev: pointer to a pci_dev data structure of agent detecting an error + * @severity: error severity type + * + * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast + * error detected message to all downstream drivers within a hierarchy in + * question and return the returned code. + **/ +static pci_ers_result_t do_recovery(struct pcie_device *aerdev, + struct pci_dev *dev, + int severity) +{ + pci_ers_result_t status, result = PCI_ERS_RESULT_RECOVERED; + enum pci_channel_state state; + + if (severity == AER_FATAL) + state = pci_channel_io_frozen; + else + state = pci_channel_io_normal; + + status = broadcast_error_message(dev, + state, + "error_detected", + report_error_detected); + + if (severity == AER_FATAL) { + result = reset_link(aerdev, dev); + if (result != PCI_ERS_RESULT_RECOVERED) { + /* TODO: Should panic here? */ + return result; + } + } + + if (status == PCI_ERS_RESULT_CAN_RECOVER) + status = broadcast_error_message(dev, + state, + "mmio_enabled", + report_mmio_enabled); + + if (status == PCI_ERS_RESULT_NEED_RESET) { + /* + * TODO: Should call platform-specific + * functions to reset slot before calling + * drivers' slot_reset callbacks? + */ + status = broadcast_error_message(dev, + state, + "slot_reset", + report_slot_reset); + } + + if (status == PCI_ERS_RESULT_RECOVERED) + broadcast_error_message(dev, + state, + "resume", + report_resume); + + return status; +} + +/** + * handle_error_source - handle logging error into an event log + * @aerdev: pointer to pcie_device data structure of the root port + * @dev: pointer to pci_dev data structure of error source device + * @info: comprehensive error information + * + * Invoked when an error being detected by Root Port. + **/ +static void handle_error_source(struct pcie_device * aerdev, + struct pci_dev *dev, + struct aer_err_info info) +{ + pci_ers_result_t status = 0; + int pos; + + if (info.severity == AER_CORRECTABLE) { + /* + * Correctable error does not need software intevention. + * No need to go through error recovery process. + */ + pos = pci_find_aer_capability(dev); + if (pos) + pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS, + info.status); + } else { + status = do_recovery(aerdev, dev, info.severity); + if (status == PCI_ERS_RESULT_RECOVERED) { + printk(KERN_DEBUG "AER driver successfully recovered\n"); + } else { + /* TODO: Should kernel panic here? */ + printk(KERN_DEBUG "AER driver didn't recover\n"); + } + } +} + +/** + * aer_enable_rootport - enable Root Port's interrupts when receiving messages + * @rpc: pointer to a Root Port data structure + * + * Invoked when PCIE bus loads AER service driver. + **/ +void aer_enable_rootport(struct aer_rpc *rpc) +{ + struct pci_dev *pdev = rpc->rpd->port; + int pos, aer_pos; + u16 reg16; + u32 reg32; + + pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); + /* Clear PCIE Capability's Device Status */ + pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, ®16); + pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16); + + /* Disable system error generation in response to error messages */ + pci_read_config_word(pdev, pos + PCI_EXP_RTCTL, ®16); + reg16 &= ~(SYSTEM_ERROR_INTR_ON_MESG_MASK); + pci_write_config_word(pdev, pos + PCI_EXP_RTCTL, reg16); + + aer_pos = pci_find_aer_capability(pdev); + /* Clear error status */ + pci_read_config_dword(pdev, aer_pos + PCI_ERR_ROOT_STATUS, ®32); + pci_write_config_dword(pdev, aer_pos + PCI_ERR_ROOT_STATUS, reg32); + pci_read_config_dword(pdev, aer_pos + PCI_ERR_COR_STATUS, ®32); + pci_write_config_dword(pdev, aer_pos + PCI_ERR_COR_STATUS, reg32); + pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, ®32); + pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32); + + /* Enable Root Port device reporting error itself */ + pci_read_config_word(pdev, pos+PCI_EXP_DEVCTL, ®16); + reg16 = reg16 | + PCI_EXP_DEVCTL_CERE | + PCI_EXP_DEVCTL_NFERE | + PCI_EXP_DEVCTL_FERE | + PCI_EXP_DEVCTL_URRE; + pci_write_config_word(pdev, pos+PCI_EXP_DEVCTL, + reg16); + + /* Enable Root Port's interrupt in response to error messages */ + pci_write_config_dword(pdev, + aer_pos + PCI_ERR_ROOT_COMMAND, + ROOT_PORT_INTR_ON_MESG_MASK); +} + +/** + * disable_root_aer - disable Root Port's interrupts when receiving messages + * @rpc: pointer to a Root Port data structure + * + * Invoked when PCIE bus unloads AER service driver. + **/ +static void disable_root_aer(struct aer_rpc *rpc) +{ + struct pci_dev *pdev = rpc->rpd->port; + u32 reg32; + int pos; + + pos = pci_find_aer_capability(pdev); + /* Disable Root's interrupt in response to error messages */ + pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0); + + /* Clear Root's error status reg */ + pci_read_config_dword(pdev, pos + PCI_ERR_ROOT_STATUS, ®32); + pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_STATUS, reg32); +} + +/** + * get_e_source - retrieve an error source + * @rpc: pointer to the root port which holds an error + * + * Invoked by DPC handler to consume an error. + **/ +static struct aer_err_source* get_e_source(struct aer_rpc *rpc) +{ + struct aer_err_source *e_source; + unsigned long flags; + + /* Lock access to Root error producer/consumer index */ + spin_lock_irqsave(&rpc->e_lock, flags); + if (rpc->prod_idx == rpc->cons_idx) { + spin_unlock_irqrestore(&rpc->e_lock, flags); + return NULL; + } + e_source = &rpc->e_sources[rpc->cons_idx]; + rpc->cons_idx++; + if (rpc->cons_idx == AER_ERROR_SOURCES_MAX) + rpc->cons_idx = 0; + spin_unlock_irqrestore(&rpc->e_lock, flags); + + return e_source; +} + +static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) +{ + int pos; + + pos = pci_find_aer_capability(dev); + + /* The device might not support AER */ + if (!pos) + return AER_SUCCESS; + + if (info->severity == AER_CORRECTABLE) { + pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, + &info->status); + if (!(info->status & ERR_CORRECTABLE_ERROR_MASK)) + return AER_UNSUCCESS; + } else if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE || + info->severity == AER_NONFATAL) { + + /* Link is still healthy for IO reads */ + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, + &info->status); + if (!(info->status & ERR_UNCORRECTABLE_ERROR_MASK)) + return AER_UNSUCCESS; + + if (info->status & AER_LOG_TLP_MASKS) { + info->flags |= AER_TLP_HEADER_VALID_FLAG; + pci_read_config_dword(dev, + pos + PCI_ERR_HEADER_LOG, &info->tlp.dw0); + pci_read_config_dword(dev, + pos + PCI_ERR_HEADER_LOG + 4, &info->tlp.dw1); + pci_read_config_dword(dev, + pos + PCI_ERR_HEADER_LOG + 8, &info->tlp.dw2); + pci_read_config_dword(dev, + pos + PCI_ERR_HEADER_LOG + 12, &info->tlp.dw3); + } + } + + return AER_SUCCESS; +} + +/** + * aer_isr_one_error - consume an error detected by root port + * @p_device: pointer to error root port service device + * @e_src: pointer to an error source + **/ +static void aer_isr_one_error(struct pcie_device *p_device, + struct aer_err_source *e_src) +{ + struct device *s_device; + struct aer_err_info e_info = {0, 0, 0,}; + int i; + u16 id; + + /* + * There is a possibility that both correctable error and + * uncorrectable error being logged. Report correctable error first. + */ + for (i = 1; i & ROOT_ERR_STATUS_MASKS ; i <<= 2) { + if (i > 4) + break; + if (!(e_src->status & i)) + continue; + + /* Init comprehensive error information */ + if (i & PCI_ERR_ROOT_COR_RCV) { + id = ERR_COR_ID(e_src->id); + e_info.severity = AER_CORRECTABLE; + } else { + id = ERR_UNCOR_ID(e_src->id); + e_info.severity = ((e_src->status >> 6) & 1); + } + if (e_src->status & + (PCI_ERR_ROOT_MULTI_COR_RCV | + PCI_ERR_ROOT_MULTI_UNCOR_RCV)) + e_info.flags |= AER_MULTI_ERROR_VALID_FLAG; + if (!(s_device = find_source_device(p_device->port, id))) { + printk(KERN_DEBUG "%s->can't find device of ID%04x\n", + __FUNCTION__, id); + continue; + } + if (get_device_error_info(to_pci_dev(s_device), &e_info) == + AER_SUCCESS) { + aer_print_error(to_pci_dev(s_device), &e_info); + handle_error_source(p_device, + to_pci_dev(s_device), + e_info); + } + } +} + +/** + * aer_isr - consume errors detected by root port + * @context: pointer to a private data of pcie device + * + * Invoked, as DPC, when root port records new detected error + **/ +void aer_isr(void *context) +{ + struct pcie_device *p_device = (struct pcie_device *) context; + struct aer_rpc *rpc = get_service_data(p_device); + struct aer_err_source *e_src; + + mutex_lock(&rpc->rpc_mutex); + e_src = get_e_source(rpc); + while (e_src) { + aer_isr_one_error(p_device, e_src); + e_src = get_e_source(rpc); + } + mutex_unlock(&rpc->rpc_mutex); + + wake_up(&rpc->wait_release); +} + +/** + * aer_delete_rootport - disable root port aer and delete service data + * @rpc: pointer to a root port device being deleted + * + * Invoked when AER service unloaded on a specific Root Port + **/ +void aer_delete_rootport(struct aer_rpc *rpc) +{ + /* Disable root port AER itself */ + disable_root_aer(rpc); + + kfree(rpc); +} + +/** + * aer_init - provide AER initialization + * @dev: pointer to AER pcie device + * + * Invoked when AER service driver is loaded. + **/ +int aer_init(struct pcie_device *dev) +{ + int status; + + /* Run _OSC Method */ + status = aer_osc_setup(dev->port); + + if(status != OSC_METHOD_RUN_SUCCESS) { + printk(KERN_DEBUG "%s: AER service init fails - %s\n", + __FUNCTION__, + (status == OSC_METHOD_NOT_SUPPORTED) ? + "No ACPI _OSC support" : "Run ACPI _OSC fails"); + + if (!forceload) + return status; + } + + return AER_SUCCESS; +} + +EXPORT_SYMBOL_GPL(pci_find_aer_capability); +EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting); +EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting); +EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); + diff -r 5f10331cb88b -r 30524c484bbb drivers/pci/pcie/aer/aerdrv_errprint.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c Mon Nov 24 11:02:14 2008 +0000 @@ -0,0 +1,248 @@ +/* + * drivers/pci/pcie/aer/aerdrv_errprint.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Format error messages and print them to console. + * + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#include +#include +#include +#include +#include +#include + +#include "aerdrv.h" + +#define AER_AGENT_RECEIVER 0 +#define AER_AGENT_REQUESTER 1 +#define AER_AGENT_COMPLETER 2 +#define AER_AGENT_TRANSMITTER 3 + +#define AER_AGENT_REQUESTER_MASK (PCI_ERR_UNC_COMP_TIME| \ + PCI_ERR_UNC_UNSUP) + +#define AER_AGENT_COMPLETER_MASK PCI_ERR_UNC_COMP_ABORT + +#define AER_AGENT_TRANSMITTER_MASK(t, e) (e & (PCI_ERR_COR_REP_ROLL| \ + ((t == AER_CORRECTABLE) ? PCI_ERR_COR_REP_TIMER: 0))) + +#define AER_GET_AGENT(t, e) \ + ((e & AER_AGENT_COMPLETER_MASK) ? AER_AGENT_COMPLETER : \ + (e & AER_AGENT_REQUESTER_MASK) ? AER_AGENT_REQUESTER : \ + (AER_AGENT_TRANSMITTER_MASK(t, e)) ? AER_AGENT_TRANSMITTER : \ + AER_AGENT_RECEIVER) + +#define AER_PHYSICAL_LAYER_ERROR_MASK PCI_ERR_COR_RCVR +#define AER_DATA_LINK_LAYER_ERROR_MASK(t, e) \ + (PCI_ERR_UNC_DLP| \ + PCI_ERR_COR_BAD_TLP| \ + PCI_ERR_COR_BAD_DLLP| \ + PCI_ERR_COR_REP_ROLL| \ + ((t == AER_CORRECTABLE) ? \ + PCI_ERR_COR_REP_TIMER: 0)) + +#define AER_PHYSICAL_LAYER_ERROR 0 +#define AER_DATA_LINK_LAYER_ERROR 1 +#define AER_TRANSACTION_LAYER_ERROR 2 + +#define AER_GET_LAYER_ERROR(t, e) \ + ((e & AER_PHYSICAL_LAYER_ERROR_MASK) ? \ + AER_PHYSICAL_LAYER_ERROR : \ + (e & AER_DATA_LINK_LAYER_ERROR_MASK(t, e)) ? \ + AER_DATA_LINK_LAYER_ERROR : \ + AER_TRANSACTION_LAYER_ERROR) + +/* + * AER error strings + */ +static char* aer_error_severity_string[] = { + "Uncorrected (Non-Fatal)", + "Uncorrected (Fatal)", + "Corrected" +}; + +static char* aer_error_layer[] = { + "Physical Layer", + "Data Link Layer", + "Transaction Layer" +}; +static char* aer_correctable_error_string[] = { + "Receiver Error ", /* Bit Position 0 */ + NULL, + NULL, + NULL, + NULL, + NULL, + "Bad TLP ", /* Bit Position 6 */ + "Bad DLLP ", /* Bit Position 7 */ + "RELAY_NUM Rollover ", /* Bit Position 8 */ + NULL, + NULL, + NULL, + "Replay Timer Timeout ", /* Bit Position 12 */ + "Advisory Non-Fatal ", /* Bit Position 13 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +static char* aer_uncorrectable_error_string[] = { + NULL, + NULL, + NULL, + NULL, + "Data Link Protocol ", /* Bit Position 4 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Poisoned TLP ", /* Bit Position 12 */ + "Flow Control Protocol ", /* Bit Position 13 */ + "Completion Timeout ", /* Bit Position 14 */ + "Completer Abort ", /* Bit Position 15 */ + "Unexpected Completion ", /* Bit Position 16 */ + "Receiver Overflow ", /* Bit Position 17 */ + "Malformed TLP ", /* Bit Position 18 */ + "ECRC ", /* Bit Position 19 */ + "Unsupported Request ", /* Bit Position 20 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +static char* aer_agent_string[] = { + "Receiver ID", + "Requester ID", + "Completer ID", + "Transmitter ID" +}; + +static char * aer_get_error_source_name(int severity, + unsigned int status, + char errmsg_buff[]) +{ + int i; + char * errmsg = NULL; + + for (i = 0; i < 32; i++) { + if (!(status & (1 << i))) + continue; + + if (severity == AER_CORRECTABLE) + errmsg = aer_correctable_error_string[i]; + else + errmsg = aer_uncorrectable_error_string[i]; + + if (!errmsg) { + sprintf(errmsg_buff, "Unknown Error Bit %2d ", i); + errmsg = errmsg_buff; + } + + break; + } + + return errmsg; +} + +static DEFINE_SPINLOCK(logbuf_lock); +static char errmsg_buff[100]; +void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) +{ + char * errmsg; + int err_layer, agent; + char * loglevel; + + if (info->severity == AER_CORRECTABLE) + loglevel = KERN_WARNING; + else + loglevel = KERN_ERR; + + printk("%s+------ PCI-Express Device Error ------+\n", loglevel); + printk("%sError Severity\t\t: %s\n", loglevel, + aer_error_severity_string[info->severity]); + + if ( info->status == 0) { + printk("%sPCIE Bus Error type\t: (Unaccessible)\n", loglevel); + printk("%sUnaccessible Received\t: %s\n", loglevel, + info->flags & AER_MULTI_ERROR_VALID_FLAG ? + "Multiple" : "First"); + printk("%sUnregistered Agent ID\t: %04x\n", loglevel, + (dev->bus->number << 8) | dev->devfn); + } else { + err_layer = AER_GET_LAYER_ERROR(info->severity, info->status); + printk("%sPCIE Bus Error type\t: %s\n", loglevel, + aer_error_layer[err_layer]); + + spin_lock(&logbuf_lock); + errmsg = aer_get_error_source_name(info->severity, + info->status, + errmsg_buff); + printk("%s%s\t: %s\n", loglevel, errmsg, + info->flags & AER_MULTI_ERROR_VALID_FLAG ? + "Multiple" : "First"); + spin_unlock(&logbuf_lock); + + agent = AER_GET_AGENT(info->severity, info->status); + printk("%s%s\t\t: %04x\n", loglevel, + aer_agent_string[agent], + (dev->bus->number << 8) | dev->devfn); + + printk("%sVendorID=%04xh, DeviceID=%04xh," + " Bus=%02xh, Device=%02xh, Function=%02xh\n", + loglevel, + dev->vendor, + dev->device, + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + + if (info->flags & AER_TLP_HEADER_VALID_FLAG) { + unsigned char *tlp = (unsigned char *) &info->tlp; + printk("%sTLB Header:\n", loglevel); + printk("%s%02x%02x%02x%02x %02x%02x%02x%02x" + " %02x%02x%02x%02x %02x%02x%02x%02x\n", + loglevel, + *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, + *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), + *(tlp + 11), *(tlp + 10), *(tlp + 9), + *(tlp + 8), *(tlp + 15), *(tlp + 14), + *(tlp + 13), *(tlp + 12)); + } + } +} + diff -r 5f10331cb88b -r 30524c484bbb include/linux/aer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/linux/aer.h Mon Nov 24 11:02:14 2008 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + */ + +#ifndef _AER_H_ +#define _AER_H_ + +#if defined(CONFIG_PCIEAER) +/* pci-e port driver needs this function to enable aer */ +extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); +extern int pci_find_aer_capability(struct pci_dev *dev); +extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); +extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); +#else +#define pci_enable_pcie_error_reporting(dev) do { } while (0) +#define pci_find_aer_capability(dev) do { } while (0) +#define pci_disable_pcie_error_reporting(dev) do { } while (0) +#define pci_cleanup_aer_uncorrect_error_status(dev) do { } while (0) +#endif + +#endif //_AER_H_ + diff -r 5f10331cb88b -r 30524c484bbb include/linux/pcieport_if.h --- a/include/linux/pcieport_if.h Mon Nov 24 11:01:21 2008 +0000 +++ b/include/linux/pcieport_if.h Mon Nov 24 11:02:14 2008 +0000 @@ -62,6 +62,12 @@ struct pcie_port_service_driver { int (*suspend) (struct pcie_device *dev, pm_message_t state); int (*resume) (struct pcie_device *dev); + /* Service Error Recovery Handler */ + struct pci_error_handlers *err_handler; + + /* Link Reset Capability - AER service driver specific */ + pci_ers_result_t (*reset_link) (struct pci_dev *dev); + const struct pcie_port_service_id *id_table; struct device_driver driver; }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:00:42 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:00:42 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QZ0-0003NA-Mz; Wed, 26 Nov 2008 12:00:42 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYH-00030W-9p for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:57 -0800 X-ASG-Debug-ID: 1227729593-372f00010002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id B4405EB8A8 for ; Wed, 26 Nov 2008 11:59:56 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id sS5vJB4UxchWDfnd for ; Wed, 26 Nov 2008 11:59:56 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738320 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738320" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:55 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxtSf016065 for ; Wed, 26 Nov 2008 11:59:55 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0JJa019944 for ; Wed, 26 Nov 2008 12:00:19 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0JG9019943 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:19 -0800 Message-Id: <200811262000.mAQK0JG9019943@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:18 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] linux: remove sysfs files during balloon module exit X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729596 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] linux: remove sysfs files during balloon module exit X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227525200 0 # Node ID 163a3807cb1fb4f35304a99c63f4deac322df2da # Parent 412b24a36929b7cbedc793b4aad06b334bea021b linux: remove sysfs files during balloon module exit Relevant when building pv drivers. Also adjust some section attributes of the sysfs code. Signed-off-by: Jan Beulich --- drivers/xen/balloon/balloon.c | 4 ++-- drivers/xen/balloon/sysfs.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff -r 412b24a36929 -r 163a3807cb1f drivers/xen/balloon/balloon.c --- a/drivers/xen/balloon/balloon.c Mon Nov 24 11:04:54 2008 +0000 +++ b/drivers/xen/balloon/balloon.c Mon Nov 24 11:13:20 2008 +0000 @@ -577,8 +577,8 @@ subsys_initcall(balloon_init); static void __exit balloon_exit(void) { - /* XXX - release balloon here */ - return; + balloon_sysfs_exit(); + /* XXX - release balloon here */ } module_exit(balloon_exit); diff -r 412b24a36929 -r 163a3807cb1f drivers/xen/balloon/sysfs.c --- a/drivers/xen/balloon/sysfs.c Mon Nov 24 11:04:54 2008 +0000 +++ b/drivers/xen/balloon/sysfs.c Mon Nov 24 11:13:20 2008 +0000 @@ -111,7 +111,7 @@ static struct sysdev_class balloon_sysde static struct sys_device balloon_sysdev; -static int register_balloon(struct sys_device *sysdev) +static int __init register_balloon(struct sys_device *sysdev) { int i, error; @@ -148,7 +148,7 @@ static int register_balloon(struct sys_d return error; } -static void unregister_balloon(struct sys_device *sysdev) +static __exit void unregister_balloon(struct sys_device *sysdev) { int i; @@ -159,12 +159,12 @@ static void unregister_balloon(struct sy sysdev_class_unregister(&balloon_sysdev_class); } -int balloon_sysfs_init(void) +int __init balloon_sysfs_init(void) { return register_balloon(&balloon_sysdev); } -void balloon_sysfs_exit(void) +void __exit balloon_sysfs_exit(void) { unregister_balloon(&balloon_sysdev); } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:00:48 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:00:48 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QZ6-0003Qh-Hh; Wed, 26 Nov 2008 12:00:48 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYH-00030s-RU for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:57 -0800 X-ASG-Debug-ID: 1227729593-372f00010001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 16560EB89A for ; Wed, 26 Nov 2008 11:59:55 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id Q1DDPTG1eLI4m6A7 for ; Wed, 26 Nov 2008 11:59:55 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738318 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738318" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:54 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxsPw016062 for ; Wed, 26 Nov 2008 11:59:54 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0HXt019927 for ; Wed, 26 Nov 2008 12:00:17 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0H6f019926 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:17 -0800 Message-Id: <200811262000.mAQK0H6f019926@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:16 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] pciback: error handler for PCIE_AER. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729596 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] pciback: error handler for PCIE_AER. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227524694 0 # Node ID 412b24a36929b7cbedc793b4aad06b334bea021b # Parent 5888ffa4b252f11749b3fde82eeb5ab68bb2e537 pciback: error handler for PCIE_AER. This patch is the main implementation for enabling PCIE_AER handling, adding related pci error handler in pciback and pcifront. When a device sends a PCIE error message to the root port, it will trigger an interrupt. The irq handler will then collect roor error status register, then schedule a work to process the error based on the error type. If the error is non-correctable error (fatal or non-fatal), AER service driver will call the callback funtions of the endpoint's driver. For bridge, it will broadcast the error to the downstream ports. Pciback error handler will be called accordingly. Pciback then ask pcifront help to call the end-device driver for finally completing the related pci error handling jobs. Signed-off-by: Jiang Yunhong Signed-off-by: Ke Liping --- drivers/xen/pciback/controller.c | 35 ++++ drivers/xen/pciback/passthrough.c | 10 + drivers/xen/pciback/pci_stub.c | 319 ++++++++++++++++++++++++++++++++++++++ drivers/xen/pciback/pciback.h | 15 + drivers/xen/pciback/pciback_ops.c | 25 ++ drivers/xen/pciback/slot.c | 30 +++ drivers/xen/pciback/vpci.c | 30 +++ drivers/xen/pciback/xenbus.c | 9 - drivers/xen/pcifront/pci_op.c | 115 +++++++++++++ drivers/xen/pcifront/pcifront.h | 13 + drivers/xen/pcifront/xenbus.c | 14 + include/xen/interface/io/pciif.h | 35 +++- 12 files changed, 639 insertions(+), 11 deletions(-) diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pciback/controller.c --- a/drivers/xen/pciback/controller.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pciback/controller.c Mon Nov 24 11:04:54 2008 +0000 @@ -406,3 +406,38 @@ void pciback_release_devices(struct pcib kfree(dev_data); pdev->pci_dev_data = NULL; } + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, + struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn) +{ + struct controller_dev_data *dev_data = pdev->pci_dev_data; + struct controller_dev_entry *dev_entry; + struct controller_list_entry *cntrl_entry; + unsigned long flags; + int found = 0; + spin_lock_irqsave(&dev_data->lock, flags); + + list_for_each_entry(cntrl_entry, &dev_data->list, list) { + list_for_each_entry(dev_entry, &cntrl_entry->dev_list, list) { + if ( (dev_entry->dev->bus->number == + pcidev->bus->number) && + (dev_entry->dev->devfn == + pcidev->devfn) && + (pci_domain_nr(dev_entry->dev->bus) == + pci_domain_nr(pcidev->bus))) + { + found = 1; + *domain = cntrl_entry->domain; + *bus = cntrl_entry->bus; + *devfn = dev_entry->devfn; + goto out; + } + } + } +out: + spin_unlock_irqrestore(&dev_data->lock, flags); + return found; + +} + diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pciback/passthrough.c --- a/drivers/xen/pciback/passthrough.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pciback/passthrough.c Mon Nov 24 11:04:54 2008 +0000 @@ -164,3 +164,13 @@ void pciback_release_devices(struct pcib kfree(dev_data); pdev->pci_dev_data = NULL; } + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn) + +{ + *domain = pci_domain_nr(pcidev->bus); + *bus = pcidev->bus->number; + *devfn = pcidev->devfn; + return 1; +} diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pciback/pci_stub.c --- a/drivers/xen/pciback/pci_stub.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pciback/pci_stub.c Mon Nov 24 11:04:54 2008 +0000 @@ -6,15 +6,24 @@ */ #include #include +#include #include #include #include +#include +#include #include +#include #include "pciback.h" #include "conf_space.h" #include "conf_space_quirks.h" static char *pci_devs_to_hide = NULL; +wait_queue_head_t aer_wait_queue; +/*Add sem for sync AER handling and pciback remove/reconfigue ops, +* We want to avoid in middle of AER ops, pciback devices is being removed +*/ +static DECLARE_RWSEM(pcistub_sem); module_param_named(hide, pci_devs_to_hide, charp, 0444); struct pcistub_device_id { @@ -207,6 +216,10 @@ void pcistub_put_pci_dev(struct pci_dev spin_unlock_irqrestore(&pcistub_devices_lock, flags); + /*hold this lock for avoiding breaking link between + * pcistub and pciback when AER is in processing + */ + down_write(&pcistub_sem); /* Cleanup our device * (so it's ready for the next domain) */ @@ -219,6 +232,7 @@ void pcistub_put_pci_dev(struct pci_dev spin_unlock_irqrestore(&found_psdev->lock, flags); pcistub_device_put(found_psdev); + up_write(&pcistub_sem); } static int __devinit pcistub_match_one(struct pci_dev *dev, @@ -279,6 +293,8 @@ static int __devinit pcistub_init_device pci_set_drvdata(dev, dev_data); dev_dbg(&dev->dev, "initializing config\n"); + + init_waitqueue_head(&aer_wait_queue); err = pciback_config_init_dev(dev); if (err) goto out; @@ -477,6 +493,308 @@ static const struct pci_device_id pcistu {0,}, }; +static void kill_domain_by_device(struct pcistub_device *psdev) +{ + struct xenbus_transaction xbt; + int err; + char nodename[1024]; + + if (!psdev) + dev_err(&psdev->dev->dev, + "device is NULL when do AER recovery/kill_domain\n"); + sprintf(nodename, "/local/domain/0/backend/pci/%d/0", + psdev->pdev->xdev->otherend_id); + nodename[strlen(nodename)] = '\0'; + +again: + err = xenbus_transaction_start(&xbt); + if (err) + { + dev_err(&psdev->dev->dev, + "error %d when start xenbus transaction\n", err); + return; + } + /*PV AER handlers will set this flag*/ + xenbus_printf(xbt, nodename, "aerState" , "aerfail" ); + err = xenbus_transaction_end(xbt, 0); + if (err) + { + if (err == -EAGAIN) + goto again; + dev_err(&psdev->dev->dev, + "error %d when end xenbus transaction\n", err); + return; + } +} + +/* For each aer recovery step error_detected, mmio_enabled, etc, front_end and + * backend need to have cooperation. In pciback, those steps will do similar + * jobs: send service request and waiting for front_end response. +*/ +static pci_ers_result_t common_process(struct pcistub_device *psdev, + pci_channel_state_t state, int aer_cmd, pci_ers_result_t result) +{ + pci_ers_result_t res = result; + struct xen_pcie_aer_op *aer_op; + int ret; + + /*with PV AER drivers*/ + aer_op = &(psdev->pdev->sh_info->aer_op); + aer_op->cmd = aer_cmd ; + /*useful for error_detected callback*/ + aer_op->err = state; + /*pcifront_end BDF*/ + ret = pciback_get_pcifront_dev(psdev->dev, psdev->pdev, + &aer_op->domain, &aer_op->bus, &aer_op->devfn); + if (!ret) { + dev_err(&psdev->dev->dev, + "pciback: failed to get pcifront device\n"); + return PCI_ERS_RESULT_NONE; + } + wmb(); + + dev_dbg(&psdev->dev->dev, + "pciback: aer_op %x dom %x bus %x devfn %x\n", + aer_cmd, aer_op->domain, aer_op->bus, aer_op->devfn); + /*local flag to mark there's aer request, pciback callback will use this + * flag to judge whether we need to check pci-front give aer service + * ack signal + */ + set_bit(_PCIB_op_pending, (unsigned long *)&psdev->pdev->flags); + + /*It is possible that a pcifront conf_read_write ops request invokes + * the callback which cause the spurious execution of wake_up. + * Yet it is harmless and better than a spinlock here + */ + set_bit(_XEN_PCIB_active, + (unsigned long *)&psdev->pdev->sh_info->flags); + wmb(); + notify_remote_via_irq(psdev->pdev->evtchn_irq); + + ret = wait_event_timeout(aer_wait_queue, !(test_bit(_XEN_PCIB_active, + (unsigned long *)&psdev->pdev->sh_info->flags)), 300*HZ); + + if (!ret) { + if (test_bit(_XEN_PCIB_active, + (unsigned long *)&psdev->pdev->sh_info->flags)) { + dev_err(&psdev->dev->dev, + "pcifront aer process not responding!\n"); + clear_bit(_XEN_PCIB_active, + (unsigned long *)&psdev->pdev->sh_info->flags); + aer_op->err = PCI_ERS_RESULT_NONE; + return res; + } + } + clear_bit(_PCIB_op_pending, (unsigned long *)&psdev->pdev->flags); + + if ( test_bit( _XEN_PCIF_active, + (unsigned long*)&psdev->pdev->sh_info->flags)) { + dev_dbg(&psdev->dev->dev, + "schedule pci_conf service in pciback \n"); + test_and_schedule_op(psdev->pdev); + } + + res = (pci_ers_result_t)aer_op->err; + return res; +} + +/* +* pciback_slot_reset: it will send the slot_reset request to pcifront in case +* of the device driver could provide this service, and then wait for pcifront +* ack. +* @dev: pointer to PCI devices +* return value is used by aer_core do_recovery policy +*/ +static pci_ers_result_t pciback_slot_reset(struct pci_dev *dev) +{ + struct pcistub_device *psdev; + pci_ers_result_t result; + + result = PCI_ERS_RESULT_RECOVERED; + dev_dbg(&dev->dev, "pciback_slot_reset(bus:%x,devfn:%x)\n", + dev->bus->number, dev->devfn); + + down_write(&pcistub_sem); + psdev = pcistub_device_find(pci_domain_nr(dev->bus), + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info ) + { + dev_err(&dev->dev, + "pciback device is not found/in use/connected!\n"); + goto end; + } + if ( !test_bit(_XEN_PCIB_AERHANDLER, + (unsigned long *)&psdev->pdev->sh_info->flags) ) { + dev_err(&dev->dev, + "guest with no AER driver should have been killed\n"); + goto release; + } + result = common_process(psdev, 1, XEN_PCI_OP_aer_slotreset, result); + + if (result == PCI_ERS_RESULT_NONE || + result == PCI_ERS_RESULT_DISCONNECT) { + dev_dbg(&dev->dev, + "No AER slot_reset service or disconnected!\n"); + kill_domain_by_device(psdev); + } +release: + pcistub_device_put(psdev); +end: + up_write(&pcistub_sem); + return result; + +} + + +/*pciback_mmio_enabled: it will send the mmio_enabled request to pcifront +* in case of the device driver could provide this service, and then wait +* for pcifront ack. +* @dev: pointer to PCI devices +* return value is used by aer_core do_recovery policy +*/ + +static pci_ers_result_t pciback_mmio_enabled(struct pci_dev *dev) +{ + struct pcistub_device *psdev; + pci_ers_result_t result; + + result = PCI_ERS_RESULT_RECOVERED; + dev_dbg(&dev->dev, "pciback_mmio_enabled(bus:%x,devfn:%x)\n", + dev->bus->number, dev->devfn); + + down_write(&pcistub_sem); + psdev = pcistub_device_find(pci_domain_nr(dev->bus), + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info) + { + dev_err(&dev->dev, + "pciback device is not found/in use/connected!\n"); + goto end; + } + if ( !test_bit(_XEN_PCIB_AERHANDLER, + (unsigned long *)&psdev->pdev->sh_info->flags) ) { + dev_err(&dev->dev, + "guest with no AER driver should have been killed\n"); + goto release; + } + result = common_process(psdev, 1, XEN_PCI_OP_aer_mmio, result); + + if (result == PCI_ERS_RESULT_NONE || + result == PCI_ERS_RESULT_DISCONNECT) { + dev_dbg(&dev->dev, + "No AER mmio_enabled service or disconnected!\n"); + kill_domain_by_device(psdev); + } +release: + pcistub_device_put(psdev); +end: + up_write(&pcistub_sem); + return result; +} + +/*pciback_error_detected: it will send the error_detected request to pcifront +* in case of the device driver could provide this service, and then wait +* for pcifront ack. +* @dev: pointer to PCI devices +* @error: the current PCI connection state +* return value is used by aer_core do_recovery policy +*/ + +static pci_ers_result_t pciback_error_detected(struct pci_dev *dev, + pci_channel_state_t error) +{ + struct pcistub_device *psdev; + pci_ers_result_t result; + + result = PCI_ERS_RESULT_CAN_RECOVER; + dev_dbg(&dev->dev, "pciback_error_detected(bus:%x,devfn:%x)\n", + dev->bus->number, dev->devfn); + + down_write(&pcistub_sem); + psdev = pcistub_device_find(pci_domain_nr(dev->bus), + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info) + { + dev_err(&dev->dev, + "pciback device is not found/in use/connected!\n"); + goto end; + } + /*Guest owns the device yet no aer handler regiested, kill guest*/ + if ( !test_bit(_XEN_PCIB_AERHANDLER, + (unsigned long *)&psdev->pdev->sh_info->flags) ) { + dev_dbg(&dev->dev, "guest may have no aer driver, kill it\n"); + kill_domain_by_device(psdev); + goto release; + } + result = common_process(psdev, error, XEN_PCI_OP_aer_detected, result); + + if (result == PCI_ERS_RESULT_NONE || + result == PCI_ERS_RESULT_DISCONNECT) { + dev_dbg(&dev->dev, + "No AER error_detected service or disconnected!\n"); + kill_domain_by_device(psdev); + } +release: + pcistub_device_put(psdev); +end: + up_write(&pcistub_sem); + return result; +} + +/*pciback_error_resume: it will send the error_resume request to pcifront +* in case of the device driver could provide this service, and then wait +* for pcifront ack. +* @dev: pointer to PCI devices +*/ + +static void pciback_error_resume(struct pci_dev *dev) +{ + struct pcistub_device *psdev; + + dev_dbg(&dev->dev, "pciback_error_resume(bus:%x,devfn:%x)\n", + dev->bus->number, dev->devfn); + + down_write(&pcistub_sem); + psdev = pcistub_device_find(pci_domain_nr(dev->bus), + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info) + { + dev_err(&dev->dev, + "pciback device is not found/in use/connected!\n"); + goto end; + } + + if ( !test_bit(_XEN_PCIB_AERHANDLER, + (unsigned long *)&psdev->pdev->sh_info->flags) ) { + dev_err(&dev->dev, + "guest with no AER driver should have been killed\n"); + kill_domain_by_device(psdev); + goto release; + } + common_process(psdev, 1, XEN_PCI_OP_aer_resume, PCI_ERS_RESULT_RECOVERED); +release: + pcistub_device_put(psdev); +end: + up_write(&pcistub_sem); + return; +} + +/*add pciback AER handling*/ +static struct pci_error_handlers pciback_error_handler = { + .error_detected = pciback_error_detected, + .mmio_enabled = pciback_mmio_enabled, + .slot_reset = pciback_slot_reset, + .resume = pciback_error_resume, +}; + /* * Note: There is no MODULE_DEVICE_TABLE entry here because this isn't * for a normal device. I don't want it to be loaded automatically. @@ -487,6 +805,7 @@ static struct pci_driver pciback_pci_dri .id_table = pcistub_ids, .probe = pcistub_probe, .remove = pcistub_remove, + .err_handler = &pciback_error_handler, }; static inline int str_to_slot(const char *buf, int *domain, int *bus, diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pciback/pciback.h --- a/drivers/xen/pciback/pciback.h Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pciback/pciback.h Mon Nov 24 11:04:54 2008 +0000 @@ -22,6 +22,8 @@ struct pci_dev_entry { #define _PDEVF_op_active (0) #define PDEVF_op_active (1<<(_PDEVF_op_active)) +#define _PCIB_op_pending (1) +#define PCIB_op_pending (1<<(_PCIB_op_pending)) struct pciback_device { void *pci_dev_data; @@ -81,6 +83,16 @@ struct pci_dev *pciback_get_pci_dev(stru struct pci_dev *pciback_get_pci_dev(struct pciback_device *pdev, unsigned int domain, unsigned int bus, unsigned int devfn); + +/** +* Add for domain0 PCIE-AER handling. Get guest domain/bus/devfn in pciback +* before sending aer request to pcifront, so that guest could identify +* device, coopearte with pciback to finish aer recovery job if device driver +* has the capability +*/ + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn); int pciback_init_devices(struct pciback_device *pdev); int pciback_publish_pci_roots(struct pciback_device *pdev, publish_pci_root_cb cb); @@ -108,4 +120,7 @@ int pciback_disable_msix(struct pciback_ struct pci_dev *dev, struct xen_pci_op *op); #endif extern int verbose_request; + +void test_and_schedule_op(struct pciback_device *pdev); #endif + diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pciback/pciback_ops.c --- a/drivers/xen/pciback/pciback_ops.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pciback/pciback_ops.c Mon Nov 24 11:04:54 2008 +0000 @@ -4,6 +4,7 @@ * Author: Ryan Wilson */ #include +#include #include #include #include "pciback.h" @@ -37,14 +38,29 @@ void pciback_reset_device(struct pci_dev } } } - -static inline void test_and_schedule_op(struct pciback_device *pdev) +extern wait_queue_head_t aer_wait_queue; +extern struct workqueue_struct *pciback_wq; +/* +* Now the same evtchn is used for both pcifront conf_read_write request +* as well as pcie aer front end ack. We use a new work_queue to schedule +* pciback conf_read_write service for avoiding confict with aer_core +* do_recovery job which also use the system default work_queue +*/ +void test_and_schedule_op(struct pciback_device *pdev) { /* Check that frontend is requesting an operation and that we are not * already processing a request */ if (test_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags) && !test_and_set_bit(_PDEVF_op_active, &pdev->flags)) - schedule_work(&pdev->op_work); + { + queue_work(pciback_wq, &pdev->op_work); + } + /*_XEN_PCIB_active should have been cleared by pcifront. And also make + sure pciback is waiting for ack by checking _PCIB_op_pending*/ + if (!test_bit(_XEN_PCIB_active,(unsigned long *)&pdev->sh_info->flags) + &&test_bit(_PCIB_op_pending, &pdev->flags)) { + wake_up(&aer_wait_queue); + } } /* Performing the configuration space reads/writes must not be done in atomic @@ -103,7 +119,8 @@ void pciback_do_op(void *data) smp_mb__after_clear_bit(); /* /before/ final check for work */ /* Check to see if the driver domain tried to start another request in - * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active. */ + * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active. + */ test_and_schedule_op(pdev); } diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pciback/slot.c --- a/drivers/xen/pciback/slot.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pciback/slot.c Mon Nov 24 11:04:54 2008 +0000 @@ -155,3 +155,33 @@ void pciback_release_devices(struct pcib kfree(slot_dev); pdev->pci_dev_data = NULL; } + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn) +{ + int slot, busnr; + struct slot_dev_data *slot_dev = pdev->pci_dev_data; + struct pci_dev *dev; + int found = 0; + unsigned long flags; + + spin_lock_irqsave(&slot_dev->lock, flags); + + for (busnr = 0; busnr < PCI_BUS_NBR; bus++) + for (slot = 0; slot < PCI_SLOT_MAX; slot++) { + dev = slot_dev->slots[busnr][slot]; + if (dev && dev->bus->number == pcidev->bus->number + && dev->devfn == pcidev->devfn + && pci_domain_nr(dev->bus) == pci_domain_nr(pcidev->bus)) { + found = 1; + *domain = 0; + *bus = busnr; + *devfn = PCI_DEVFN(slot,0); + goto out; + } + } +out: + spin_unlock_irqrestore(&slot_dev->lock, flags); + return found; + +} diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pciback/vpci.c --- a/drivers/xen/pciback/vpci.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pciback/vpci.c Mon Nov 24 11:04:54 2008 +0000 @@ -210,3 +210,33 @@ void pciback_release_devices(struct pcib kfree(vpci_dev); pdev->pci_dev_data = NULL; } + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn) +{ + struct pci_dev_entry *entry; + struct pci_dev *dev = NULL; + struct vpci_dev_data *vpci_dev = pdev->pci_dev_data; + unsigned long flags; + int found = 0, slot; + + spin_lock_irqsave(&vpci_dev->lock, flags); + for (slot = 0; slot < PCI_SLOT_MAX; slot++) { + list_for_each_entry(entry, + &vpci_dev->dev_list[slot], + list) { + dev = entry->dev; + if (dev && dev->bus->number == pcidev->bus->number + && pci_domain_nr(dev->bus) == pci_domain_nr(pcidev->bus) + && dev->devfn == pcidev->devfn) + { + found = 1; + *domain = 0; + *bus = 0; + *devfn = PCI_DEVFN(slot, PCI_FUNC(pcidev->devfn)); + } + } + } + spin_unlock_irqrestore(&vpci_dev->lock, flags); + return found; +} diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pciback/xenbus.c --- a/drivers/xen/pciback/xenbus.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pciback/xenbus.c Mon Nov 24 11:04:54 2008 +0000 @@ -12,6 +12,7 @@ #include "pciback.h" #define INVALID_EVTCHN_IRQ (-1) +struct workqueue_struct *pciback_wq; static struct pciback_device *alloc_pdev(struct xenbus_device *xdev) { @@ -694,11 +695,17 @@ int __init pciback_xenbus_register(void) { if (!is_running_on_xen()) return -ENODEV; - + pciback_wq = create_workqueue("pciback_workqueue"); + if (!pciback_wq) { + printk(KERN_ERR "pciback_xenbus_register: create" + "pciback_workqueue failed\n"); + return -EFAULT; + } return xenbus_register_backend(&xenbus_pciback_driver); } void __exit pciback_xenbus_unregister(void) { + destroy_workqueue(pciback_wq); xenbus_unregister_driver(&xenbus_pciback_driver); } diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pcifront/pci_op.c --- a/drivers/xen/pcifront/pci_op.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pcifront/pci_op.c Mon Nov 24 11:04:54 2008 +0000 @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include "pcifront.h" @@ -151,6 +152,15 @@ static int errno_to_pcibios_err(int errn return PCIBIOS_SET_FAILED; } return errno; +} + +static inline void schedule_pcifront_aer_op(struct pcifront_device *pdev) +{ + if (test_bit(_XEN_PCIB_active, (unsigned long *)&pdev->sh_info->flags) + && !test_and_set_bit(_PDEVB_op_active, &pdev->flags)) { + dev_dbg(&pdev->xdev->dev, "schedule aer frontend job\n"); + schedule_work(&pdev->op_work); + } } static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) @@ -199,6 +209,18 @@ static int do_pci_op(struct pcifront_dev } } + /* + * We might lose backend service request since we + * reuse same evtchn with pci_conf backend response. So re-schedule + * aer pcifront service. + */ + if (test_bit(_XEN_PCIB_active, + (unsigned long*)&pdev->sh_info->flags)) { + dev_err(&pdev->xdev->dev, + "schedule aer pcifront service\n"); + schedule_pcifront_aer_op(pdev); + } + memcpy(op, active_op, sizeof(struct xen_pci_op)); err = op->err; @@ -549,3 +571,96 @@ void pcifront_free_roots(struct pcifront kfree(bus_entry); } } + +static pci_ers_result_t pcifront_common_process( int cmd, struct pcifront_device *pdev, + pci_channel_state_t state) +{ + pci_ers_result_t result; + struct pci_driver *pdrv; + int bus = pdev->sh_info->aer_op.bus; + int devfn = pdev->sh_info->aer_op.devfn; + struct pci_dev *pcidev; + int flag = 0; + + dev_dbg(&pdev->xdev->dev, + "pcifront AER process: cmd %x (bus:%x, devfn%x)", + cmd, bus, devfn); + result = PCI_ERS_RESULT_NONE; + + pcidev = pci_get_bus_and_slot(bus, devfn); + if (!pcidev || !pcidev->driver){ + dev_err(&pcidev->dev, + "device or driver is NULL\n"); + return result; + } + pdrv = pcidev->driver; + + if (get_driver(&pdrv->driver)) { + if (pdrv->err_handler && pdrv->err_handler->error_detected) { + dev_dbg(&pcidev->dev, + "trying to call AER service\n"); + if (pcidev) { + flag = 1; + switch(cmd) { + case XEN_PCI_OP_aer_detected: + result = pdrv->err_handler->error_detected(pcidev, state); + break; + case XEN_PCI_OP_aer_mmio: + result = pdrv->err_handler->mmio_enabled(pcidev); + break; + case XEN_PCI_OP_aer_slotreset: + result = pdrv->err_handler->slot_reset(pcidev); + break; + case XEN_PCI_OP_aer_resume: + pdrv->err_handler->resume(pcidev); + break; + default: + dev_err(&pdev->xdev->dev, + "bad request in aer recovery operation!\n"); + + } + } + } + put_driver(&pdrv->driver); + } + if (!flag) + result = PCI_ERS_RESULT_NONE; + + return result; +} + + +void pcifront_do_aer(void *data) +{ + struct pcifront_device *pdev = data; + int cmd = pdev->sh_info->aer_op.cmd; + pci_channel_state_t state = + (pci_channel_state_t)pdev->sh_info->aer_op.err; + + /*If a pci_conf op is in progress, + we have to wait until it is done before service aer op*/ + dev_dbg(&pdev->xdev->dev, + "pcifront service aer bus %x devfn %x\n", pdev->sh_info->aer_op.bus, + pdev->sh_info->aer_op.devfn); + + pdev->sh_info->aer_op.err = pcifront_common_process(cmd, pdev, state); + + wmb(); + clear_bit(_XEN_PCIB_active, (unsigned long*)&pdev->sh_info->flags); + notify_remote_via_evtchn(pdev->evtchn); + + /*in case of we lost an aer request in four lines time_window*/ + smp_mb__before_clear_bit(); + clear_bit( _PDEVB_op_active, &pdev->flags); + smp_mb__after_clear_bit(); + + schedule_pcifront_aer_op(pdev); + +} + +irqreturn_t pcifront_handler_aer(int irq, void *dev, struct pt_regs *regs) +{ + struct pcifront_device *pdev = dev; + schedule_pcifront_aer_op(pdev); + return IRQ_HANDLED; +} diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pcifront/pcifront.h --- a/drivers/xen/pcifront/pcifront.h Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pcifront/pcifront.h Mon Nov 24 11:04:54 2008 +0000 @@ -10,12 +10,18 @@ #include #include #include +#include #include +#include +#include struct pci_bus_entry { struct list_head list; struct pci_bus *bus; }; + +#define _PDEVB_op_active (0) +#define PDEVB_op_active (1 << (_PDEVB_op_active)) struct pcifront_device { struct xenbus_device *xdev; @@ -28,6 +34,9 @@ struct pcifront_device { /* Lock this when doing any operations in sh_info */ spinlock_t sh_info_lock; struct xen_pci_sharedinfo *sh_info; + struct work_struct op_work; + unsigned long flags; + }; int pcifront_connect(struct pcifront_device *pdev); @@ -39,4 +48,8 @@ int pcifront_rescan_root(struct pcifront unsigned int domain, unsigned int bus); void pcifront_free_roots(struct pcifront_device *pdev); +void pcifront_do_aer( void *data); + +irqreturn_t pcifront_handler_aer(int irq, void *dev, struct pt_regs *regs); + #endif /* __XEN_PCIFRONT_H__ */ diff -r 5888ffa4b252 -r 412b24a36929 drivers/xen/pcifront/xenbus.c --- a/drivers/xen/pcifront/xenbus.c Mon Nov 24 11:03:21 2008 +0000 +++ b/drivers/xen/pcifront/xenbus.c Mon Nov 24 11:04:54 2008 +0000 @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "pcifront.h" @@ -34,6 +35,9 @@ static struct pcifront_device *alloc_pde } pdev->sh_info->flags = 0; + /*Flag for registering PV AER handler*/ + set_bit(_XEN_PCIB_AERHANDLER, (void*)&pdev->sh_info->flags); + xdev->dev.driver_data = pdev; pdev->xdev = xdev; @@ -45,6 +49,8 @@ static struct pcifront_device *alloc_pde pdev->evtchn = INVALID_EVTCHN; pdev->gnt_ref = INVALID_GRANT_REF; + INIT_WORK(&pdev->op_work, pcifront_do_aer, pdev); + dev_dbg(&xdev->dev, "Allocated pdev @ 0x%p pdev->sh_info @ 0x%p\n", pdev, pdev->sh_info); out: @@ -56,6 +62,11 @@ static void free_pdev(struct pcifront_de dev_dbg(&pdev->xdev->dev, "freeing pdev @ 0x%p\n", pdev); pcifront_free_roots(pdev); + + /*For PCIE_AER error handling job*/ + cancel_delayed_work(&pdev->op_work); + flush_scheduled_work(); + unbind_from_irqhandler(pdev->evtchn, pdev); if (pdev->evtchn != INVALID_EVTCHN) xenbus_free_evtchn(pdev->xdev, pdev->evtchn); @@ -83,6 +94,9 @@ static int pcifront_publish_info(struct err = xenbus_alloc_evtchn(pdev->xdev, &pdev->evtchn); if (err) goto out; + + bind_caller_port_to_irqhandler(pdev->evtchn, pcifront_handler_aer, + SA_SAMPLE_RANDOM, "pcifront", pdev); do_publish: err = xenbus_transaction_start(&trans); diff -r 5888ffa4b252 -r 412b24a36929 include/xen/interface/io/pciif.h --- a/include/xen/interface/io/pciif.h Mon Nov 24 11:03:21 2008 +0000 +++ b/include/xen/interface/io/pciif.h Mon Nov 24 11:04:54 2008 +0000 @@ -30,14 +30,22 @@ /* xen_pci_sharedinfo flags */ #define _XEN_PCIF_active (0) #define XEN_PCIF_active (1<<_XEN_PCI_active) +#define _XEN_PCIB_AERHANDLER (1) +#define XEN_PCIB_AERHANDLER (1<<_XEN_PCIB_AERHANDLER) +#define _XEN_PCIB_active (2) +#define XEN_PCIB_active (1<<_XEN_PCIB_active) /* xen_pci_op commands */ -#define XEN_PCI_OP_conf_read (0) -#define XEN_PCI_OP_conf_write (1) -#define XEN_PCI_OP_enable_msi (2) -#define XEN_PCI_OP_disable_msi (3) -#define XEN_PCI_OP_enable_msix (4) -#define XEN_PCI_OP_disable_msix (5) +#define XEN_PCI_OP_conf_read (0) +#define XEN_PCI_OP_conf_write (1) +#define XEN_PCI_OP_enable_msi (2) +#define XEN_PCI_OP_disable_msi (3) +#define XEN_PCI_OP_enable_msix (4) +#define XEN_PCI_OP_disable_msix (5) +#define XEN_PCI_OP_aer_detected (6) +#define XEN_PCI_OP_aer_resume (7) +#define XEN_PCI_OP_aer_mmio (8) +#define XEN_PCI_OP_aer_slotreset (9) /* xen_pci_op error numbers */ #define XEN_PCI_ERR_success (0) @@ -82,10 +90,25 @@ struct xen_pci_op { struct xen_msix_entry msix_entries[SH_INFO_MAX_VEC]; }; +/*used for pcie aer handling*/ +struct xen_pcie_aer_op +{ + + /* IN: what action to perform: XEN_PCI_OP_* */ + uint32_t cmd; + /*IN/OUT: return aer_op result or carry error_detected state as input*/ + int32_t err; + + /* IN: which device to touch */ + uint32_t domain; /* PCI Domain/Segment*/ + uint32_t bus; + uint32_t devfn; +}; struct xen_pci_sharedinfo { /* flags - XEN_PCIF_* */ uint32_t flags; struct xen_pci_op op; + struct xen_pcie_aer_op aer_op; }; #endif /* __XEN_PCI_COMMON_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:00:57 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:00:57 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QZF-0003VD-5A; Wed, 26 Nov 2008 12:00:57 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYI-00031P-SO for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:58 -0800 X-ASG-Debug-ID: 1227729593-372f00010003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 3D5E9EB8A9 for ; Wed, 26 Nov 2008 11:59:57 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 9ISy2CswJ0CLOzuT for ; Wed, 26 Nov 2008 11:59:57 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738321 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738321" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:57 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxu74016068 for ; Wed, 26 Nov 2008 11:59:56 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0KUj019961 for ; Wed, 26 Nov 2008 12:00:20 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0K0v019960 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:20 -0800 Message-Id: <200811262000.mAQK0K0v019960@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:19 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] Save/restore PCI MSI state across S3. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729598 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] Save/restore PCI MSI state across S3. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227536158 0 # Node ID 1b68d09b868fdcd724c6b86eb2790748a9fd0bb7 # Parent 163a3807cb1fb4f35304a99c63f4deac322df2da Save/restore PCI MSI state across S3. Signed-off-by: Haitao Shan --- drivers/pci/msi-xen.c | 177 ++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 128 insertions(+), 49 deletions(-) diff -r 163a3807cb1f -r 1b68d09b868f drivers/pci/msi-xen.c --- a/drivers/pci/msi-xen.c Mon Nov 24 11:13:20 2008 +0000 +++ b/drivers/pci/msi-xen.c Mon Nov 24 14:15:58 2008 +0000 @@ -48,6 +48,13 @@ struct msi_pirq_entry { struct list_head list; int pirq; int entry_nr; +#ifdef CONFIG_PM + /* PM save area for MSIX address/data */ + void __iomem *mask_base; + u32 address_hi_save; + u32 address_lo_save; + u32 data_save; +#endif }; static struct msi_dev_list *get_msi_dev_pirq_list(struct pci_dev *dev) @@ -83,7 +90,7 @@ static struct msi_dev_list *get_msi_dev_ return ret; } -static int attach_pirq_entry(int pirq, int entry_nr, +static int attach_pirq_entry(int pirq, int entry_nr, u64 table_base, struct msi_dev_list *msi_dev_entry) { struct msi_pirq_entry *entry = kmalloc(sizeof(*entry), GFP_ATOMIC); @@ -93,6 +100,9 @@ static int attach_pirq_entry(int pirq, i return -ENOMEM; entry->pirq = pirq; entry->entry_nr = entry_nr; +#ifdef COMFIG_PM + entry->mask_base = table_base; +#endif spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); list_add_tail(&entry->list, &msi_dev_entry->pirq_list_head); spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); @@ -299,104 +309,173 @@ static void enable_msi_mode(struct pci_d #ifdef CONFIG_PM int pci_save_msi_state(struct pci_dev *dev) { - int pos; + int pos, i = 0; + u16 control; + struct pci_cap_saved_state *save_state; + u32 *cap; pos = pci_find_capability(dev, PCI_CAP_ID_MSI); if (pos <= 0 || dev->no_msi) return 0; - if (!dev->msi_enabled) + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (!(control & PCI_MSI_FLAGS_ENABLE)) return 0; - /* Restore dev->irq to its default pin-assertion vector */ - msi_unmap_pirq(dev, dev->irq); - /* Disable MSI mode */ - disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); - /* Set the flags for use of restore */ - dev->msi_enabled = 1; + save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u32) * 5, + GFP_KERNEL); + if (!save_state) { + printk(KERN_ERR "Out of memory in pci_save_msi_state\n"); + return -ENOMEM; + } + cap = &save_state->data[0]; + + pci_read_config_dword(dev, pos, &cap[i++]); + control = cap[0] >> 16; + pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, &cap[i++]); + if (control & PCI_MSI_FLAGS_64BIT) { + pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, &cap[i++]); + pci_read_config_dword(dev, pos + PCI_MSI_DATA_64, &cap[i++]); + } else + pci_read_config_dword(dev, pos + PCI_MSI_DATA_32, &cap[i++]); + if (control & PCI_MSI_FLAGS_MASKBIT) + pci_read_config_dword(dev, pos + PCI_MSI_MASK_BIT, &cap[i++]); + save_state->cap_nr = PCI_CAP_ID_MSI; + pci_add_saved_cap(dev, save_state); return 0; } void pci_restore_msi_state(struct pci_dev *dev) { - int pos, pirq; - + int i = 0, pos; + u16 control; + struct pci_cap_saved_state *save_state; + u32 *cap; + + save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSI); pos = pci_find_capability(dev, PCI_CAP_ID_MSI); - if (pos <= 0) - return; - - if (!dev->msi_enabled) - return; - - pirq = msi_map_pirq_to_vector(dev, dev->irq, 0, 0); - if (pirq < 0) - return; + if (!save_state || pos <= 0) + return; + cap = &save_state->data[0]; + + control = cap[i++] >> 16; + pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, cap[i++]); + if (control & PCI_MSI_FLAGS_64BIT) { + pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, cap[i++]); + pci_write_config_dword(dev, pos + PCI_MSI_DATA_64, cap[i++]); + } else + pci_write_config_dword(dev, pos + PCI_MSI_DATA_32, cap[i++]); + if (control & PCI_MSI_FLAGS_MASKBIT) + pci_write_config_dword(dev, pos + PCI_MSI_MASK_BIT, cap[i++]); + pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); + pci_remove_saved_cap(save_state); + kfree(save_state); } int pci_save_msix_state(struct pci_dev *dev) { int pos; + u16 control; + struct pci_cap_saved_state *save_state; unsigned long flags; struct msi_dev_list *msi_dev_entry; - struct msi_pirq_entry *pirq_entry, *tmp; + struct msi_pirq_entry *pirq_entry; pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); if (pos <= 0 || dev->no_msi) return 0; + printk(KERN_CRIT "Saving MSIX cap\n"); + /* save the capability */ - if (!dev->msix_enabled) + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (!(control & PCI_MSIX_FLAGS_ENABLE)) return 0; + save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u16), + GFP_KERNEL); + if (!save_state) { + printk(KERN_ERR "Out of memory in pci_save_msix_state\n"); + return -ENOMEM; + } + *((u16 *)&save_state->data[0]) = control; msi_dev_entry = get_msi_dev_pirq_list(dev); spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - list_for_each_entry_safe(pirq_entry, tmp, - &msi_dev_entry->pirq_list_head, list) - msi_unmap_pirq(dev, pirq_entry->pirq); + list_for_each_entry(pirq_entry, &msi_dev_entry->pirq_list_head, list) { + int j; + void __iomem *base; + + /* save the table */ + base = pirq_entry->mask_base; + j = pirq_entry->entry_nr; + printk(KERN_CRIT "Save msix table entry %d pirq %x base %p\n", + j, pirq_entry->pirq, base); + + pirq_entry->address_lo_save = + readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + pirq_entry->address_hi_save = + readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); + pirq_entry->data_save = + readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_DATA_OFFSET); + } spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); - disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); - /* Set the flags for use of restore */ - dev->msix_enabled = 1; - + save_state->cap_nr = PCI_CAP_ID_MSIX; + pci_add_saved_cap(dev, save_state); return 0; } void pci_restore_msix_state(struct pci_dev *dev) { - int pos; + u16 save; + int pos, j; + void __iomem *base; + struct pci_cap_saved_state *save_state; unsigned long flags; - u64 table_base; struct msi_dev_list *msi_dev_entry; - struct msi_pirq_entry *pirq_entry, *tmp; + struct msi_pirq_entry *pirq_entry; + + save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSIX); + if (!save_state) + return; + printk(KERN_CRIT "Restoring MSIX cap\n"); + + save = *((u16 *)&save_state->data[0]); + pci_remove_saved_cap(save_state); + kfree(save_state); pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); if (pos <= 0) return; - if (!dev->msix_enabled) - return; - msi_dev_entry = get_msi_dev_pirq_list(dev); - table_base = find_table_base(dev, pos); - if (!table_base) - return; spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - list_for_each_entry_safe(pirq_entry, tmp, - &msi_dev_entry->pirq_list_head, list) { - int rc = msi_map_pirq_to_vector(dev, pirq_entry->pirq, - pirq_entry->entry_nr, table_base); - if (rc < 0) - printk(KERN_WARNING - "%s: re-mapping irq #%d (pirq%d) failed: %d\n", - pci_name(dev), pirq_entry->entry_nr, - pirq_entry->pirq, rc); + list_for_each_entry(pirq_entry, &msi_dev_entry->pirq_list_head, list) { + /* route the table */ + base = pirq_entry->mask_base; + j = pirq_entry->entry_nr; + + printk(KERN_CRIT "Restore msix table entry %d pirq %x base %p\n", + j, pirq_entry->pirq, base); + writel(pirq_entry->address_lo_save, + base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + writel(pirq_entry->address_hi_save, + base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); + writel(pirq_entry->data_save, + base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_DATA_OFFSET); } spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + pci_write_config_word(dev, msi_control_reg(pos), save); enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); } #endif @@ -475,7 +554,7 @@ static int msix_capability_init(struct p pirq = msi_map_vector(dev, entries[i].entry, table_base); if (pirq < 0) break; - attach_pirq_entry(pirq, entries[i].entry, msi_dev_entry); + attach_pirq_entry(pirq, entries[i].entry, table_base, msi_dev_entry); (entries + i)->vector = pirq; } @@ -660,7 +739,7 @@ int pci_enable_msix(struct pci_dev* dev, if (mapped) continue; irq = evtchn_map_pirq(-1, entries[i].vector); - attach_pirq_entry(irq, entries[i].entry, msi_dev_entry); + attach_pirq_entry(irq, entries[i].entry, 0, msi_dev_entry); entries[i].vector = irq; } return 0; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:01:03 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:01:03 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QZL-0003ZN-0e; Wed, 26 Nov 2008 12:01:03 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYJ-00031k-E1 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 11:59:59 -0800 X-ASG-Debug-ID: 1227729593-372f00010004-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 15F3CEB8A9 for ; Wed, 26 Nov 2008 11:59:58 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id Vlj4dCjd2Cgt5lH6 for ; Wed, 26 Nov 2008 11:59:58 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738322 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738322" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:58 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxwN0016071 for ; Wed, 26 Nov 2008 11:59:58 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0Lq5019978 for ; Wed, 26 Nov 2008 12:00:21 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0LC2019977 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:21 -0800 Message-Id: <200811262000.mAQK0LC2019977@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:20 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] kexec: Don't pass limit_pages_to_max_mfn() regions to xen_destroy_contiguous_region(). X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729599 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] kexec: Don't pass limit_pages_to_max_mfn() regions to xen_destroy_contiguous_region(). X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227611796 0 # Node ID 6bb7f500d5e4a68007607863fa7bfe0c69d6eec7 # Parent 1b68d09b868fdcd724c6b86eb2790748a9fd0bb7 kexec: Don't pass limit_pages_to_max_mfn() regions to xen_destroy_contiguous_region(). Signed-off-by: Keir Fraser --- kernel/kexec.c | 3 --- 1 files changed, 3 deletions(-) diff -r 1b68d09b868f -r 6bb7f500d5e4 kernel/kexec.c --- a/kernel/kexec.c Mon Nov 24 14:15:58 2008 +0000 +++ b/kernel/kexec.c Tue Nov 25 11:16:36 2008 +0000 @@ -368,9 +368,6 @@ static void kimage_free_pages(struct pag count = 1 << order; for (i = 0; i < count; i++) ClearPageReserved(page + i); -#ifdef CONFIG_XEN - xen_destroy_contiguous_region((unsigned long)page_address(page), order); -#endif __free_pages(page, order); } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:01:09 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:01:09 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QZR-0003dB-1K; Wed, 26 Nov 2008 12:01:09 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYL-00033Q-IG for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:01 -0800 X-ASG-Debug-ID: 1227729593-372f00010005-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 38982EB8B1 for ; Wed, 26 Nov 2008 11:59:59 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id blGVN8FDPYALBOUk for ; Wed, 26 Nov 2008 11:59:59 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738323 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738323" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 14:59:59 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQJxxum016074 for ; Wed, 26 Nov 2008 11:59:59 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0MCD019995 for ; Wed, 26 Nov 2008 12:00:22 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0Mws019994 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:22 -0800 Message-Id: <200811262000.mAQK0Mws019994@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:22 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] balloon: Fix the build by including X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729600 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] balloon: Fix the build by including X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227611981 0 # Node ID bf8b1ee634e20283bb6f874942c40cb83959f2a6 # Parent 6bb7f500d5e4a68007607863fa7bfe0c69d6eec7 balloon: Fix the build by including Signed-off-by: Keir Fraser --- drivers/xen/balloon/sysfs.c | 1 + 1 files changed, 1 insertion(+) diff -r 6bb7f500d5e4 -r bf8b1ee634e2 drivers/xen/balloon/sysfs.c --- a/drivers/xen/balloon/sysfs.c Tue Nov 25 11:16:36 2008 +0000 +++ b/drivers/xen/balloon/sysfs.c Tue Nov 25 11:19:41 2008 +0000 @@ -30,6 +30,7 @@ #include #include +#include #include #include #include _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:01:40 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:01:40 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QZw-0003wH-67; Wed, 26 Nov 2008 12:01:40 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYN-000347-QO for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:04 -0800 X-ASG-Debug-ID: 1227729593-372f00010007-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 794CCEB8B9 for ; Wed, 26 Nov 2008 12:00:02 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id RhC3hJp5y0Am1pTK for ; Wed, 26 Nov 2008 12:00:02 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738325 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738325" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:01 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK01sg016080 for ; Wed, 26 Nov 2008 12:00:01 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0P0j020029 for ; Wed, 26 Nov 2008 12:00:25 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0PT0020028 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:25 -0800 Message-Id: <200811262000.mAQK0PT0020028@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:24 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] blkback, blktap: Fix potential resource leak. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729602 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] blkback, blktap: Fix potential resource leak. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227697833 0 # Node ID 5012c470f8757e97c2e0f7eccfafcb1e2367443e # Parent f236d7def9944909bf40015ff4a08817b0803ed9 blkback, blktap: Fix potential resource leak. Signed-off-by: Keir Fraser --- drivers/xen/blkback/blkback.c | 10 +++++----- drivers/xen/blktap/blktap.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff -r f236d7def994 -r 5012c470f875 drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Tue Nov 25 11:22:04 2008 +0000 +++ b/drivers/xen/blkback/blkback.c Wed Nov 26 11:10:33 2008 +0000 @@ -317,14 +317,14 @@ static int do_block_io_op(blkif_t *blkif if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc)) break; + if (kthread_should_stop()) { + more_to_do = 1; + break; + } + pending_req = alloc_req(); if (NULL == pending_req) { blkif->st_oo_req++; - more_to_do = 1; - break; - } - - if (kthread_should_stop()) { more_to_do = 1; break; } diff -r f236d7def994 -r 5012c470f875 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Tue Nov 25 11:22:04 2008 +0000 +++ b/drivers/xen/blktap/blktap.c Wed Nov 26 11:10:33 2008 +0000 @@ -1286,14 +1286,14 @@ static int do_block_io_op(blkif_t *blkif break; } + if (kthread_should_stop()) { + more_to_do = 1; + break; + } + pending_req = alloc_req(); if (NULL == pending_req) { blkif->st_oo_req++; - more_to_do = 1; - break; - } - - if (kthread_should_stop()) { more_to_do = 1; break; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:01:48 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:01:48 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5Qa3-000411-Tf; Wed, 26 Nov 2008 12:01:47 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYO-00034F-GV for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:04 -0800 X-ASG-Debug-ID: 1227729593-372f00010008-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 5EE01EB8BF for ; Wed, 26 Nov 2008 12:00:03 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 8W0fCkxKfERUFrLm for ; Wed, 26 Nov 2008 12:00:03 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738326 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738326" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:02 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK02QQ016083 for ; Wed, 26 Nov 2008 12:00:02 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0QBD020046 for ; Wed, 26 Nov 2008 12:00:26 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0QC9020045 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:26 -0800 Message-Id: <200811262000.mAQK0QC9020045@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:25 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] [IA64] xencomm: support several domctls for VT-d. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729603 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] [IA64] xencomm: support several domctls for VT-d. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1224814922 -32400 # Node ID 45c3a3dfa5b54619676d9de026452ee062a7e8af # Parent c87adc9760134abb7275728718e44af3dacc515b [IA64] xencomm: support several domctls for VT-d. This patch adds xencomm support of several domctl hypercalls for VT-d. Signed-off-by: Anthony Xu Signed-off-by: Isaku Yamahata --- arch/ia64/xen/xcom_privcmd.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) diff -r c87adc976013 -r 45c3a3dfa5b5 arch/ia64/xen/xcom_privcmd.c --- a/arch/ia64/xen/xcom_privcmd.c Mon Oct 20 15:29:07 2008 +0100 +++ b/arch/ia64/xen/xcom_privcmd.c Fri Oct 24 11:22:02 2008 +0900 @@ -340,6 +340,20 @@ xencomm_privcmd_domctl(privcmd_hypercall return -ENOMEM; set_xen_guest_handle(kern_op.u.hvmcontext.buffer, (void*)desc); break; + case XEN_DOMCTL_get_device_group: + { + struct xen_domctl_get_device_group *get_device_group = + &kern_op.u.get_device_group; + desc = xencomm_map( + xen_guest_handle(get_device_group->sdev_array), + get_device_group->max_sdevs * sizeof(uint32_t)); + if (xen_guest_handle(get_device_group->sdev_array) != NULL && + get_device_group->max_sdevs > 0 && desc == NULL) + return -ENOMEM; + set_xen_guest_handle(kern_op.u.get_device_group.sdev_array, + (void*)desc); + break; + } case XEN_DOMCTL_max_vcpus: case XEN_DOMCTL_scheduler_op: case XEN_DOMCTL_setdomainhandle: @@ -354,6 +368,12 @@ xencomm_privcmd_domctl(privcmd_hypercall case XEN_DOMCTL_set_opt_feature: case XEN_DOMCTL_assign_device: case XEN_DOMCTL_subscribe: + case XEN_DOMCTL_test_assign_device: + case XEN_DOMCTL_deassign_device: + case XEN_DOMCTL_bind_pt_irq: + case XEN_DOMCTL_unbind_pt_irq: + case XEN_DOMCTL_memory_mapping: + case XEN_DOMCTL_ioport_mapping: break; case XEN_DOMCTL_pin_mem_cacheattr: return -ENOSYS; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:01:54 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:01:54 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QaA-00044e-7j; Wed, 26 Nov 2008 12:01:54 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYN-000342-Ca for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:03 -0800 X-ASG-Debug-ID: 1227729593-372f00010006-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 7F454EB8B4 for ; Wed, 26 Nov 2008 12:00:01 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id YzQAC9Df8DHIbCBT for ; Wed, 26 Nov 2008 12:00:01 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738324 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738324" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:00 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK00jV016077 for ; Wed, 26 Nov 2008 12:00:00 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0Oxh020012 for ; Wed, 26 Nov 2008 12:00:24 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0NSZ020011 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:23 -0800 Message-Id: <200811262000.mAQK0NSZ020011@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:23 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] Support I2C bus, and SATA IDE/AHCI modes for new Intel PCH chipset. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729601 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] Support I2C bus, and SATA IDE/AHCI modes for new Intel PCH chipset. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227612124 0 # Node ID f236d7def9944909bf40015ff4a08817b0803ed9 # Parent bf8b1ee634e20283bb6f874942c40cb83959f2a6 Support I2C bus,and SATA IDE/AHCI modes for new Intel PCH chipset. Signed-off-by: Scott Parker --- arch/i386/pci/irq.c | 9 +++++++++ drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-i801.c | 2 ++ drivers/scsi/ahci.c | 25 +++++++++++++++++++++++++ drivers/scsi/ata_piix.c | 12 ++++++++++++ include/linux/pci_ids.h | 3 +++ sound/pci/hda/hda_intel.c | 2 ++ 7 files changed, 54 insertions(+) diff -r bf8b1ee634e2 -r f236d7def994 arch/i386/pci/irq.c --- a/arch/i386/pci/irq.c Tue Nov 25 11:19:41 2008 +0000 +++ b/arch/i386/pci/irq.c Tue Nov 25 11:22:04 2008 +0000 @@ -558,6 +558,15 @@ static __init int intel_router_probe(str r->set = pirq_piix_set; return 1; } + + if ((device >= PCI_DEVICE_ID_INTEL_PCH_LPC_MIN) && + (device <= PCI_DEVICE_ID_INTEL_PCH_LPC_MAX)) { + r->name = "PIIX/ICH"; + r->get = pirq_piix_get; + r->set = pirq_piix_set; + return 1; + } + return 0; } diff -r bf8b1ee634e2 -r f236d7def994 drivers/i2c/busses/Kconfig --- a/drivers/i2c/busses/Kconfig Tue Nov 25 11:19:41 2008 +0000 +++ b/drivers/i2c/busses/Kconfig Tue Nov 25 11:22:04 2008 +0000 @@ -127,6 +127,7 @@ config I2C_I801 ICH8 ICH9 ICH10 + PCH This driver can also be built as a module. If so, the module will be called i2c-i801. diff -r bf8b1ee634e2 -r f236d7def994 drivers/i2c/busses/i2c-i801.c --- a/drivers/i2c/busses/i2c-i801.c Tue Nov 25 11:19:41 2008 +0000 +++ b/drivers/i2c/busses/i2c-i801.c Tue Nov 25 11:22:04 2008 +0000 @@ -36,6 +36,7 @@ ICH9 2930 ICH10 3A30 ICH10 3A60 + PCH 3B30 This driver supports several versions of Intel's I/O Controller Hubs (ICH). For SMBus support, they are similar to the PIIX4 and are part of Intel's '810' and other chipsets. @@ -463,6 +464,7 @@ static struct pci_device_id i801_ids[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_6) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_4) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_5) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PCH_SMBUS) }, { 0, } }; diff -r bf8b1ee634e2 -r f236d7def994 drivers/scsi/ahci.c --- a/drivers/scsi/ahci.c Tue Nov 25 11:19:41 2008 +0000 +++ b/drivers/scsi/ahci.c Tue Nov 25 11:22:04 2008 +0000 @@ -370,6 +370,31 @@ static const struct pci_device_id ahci_p board_ahci }, /* ICH10 */ { PCI_VENDOR_ID_INTEL, 0x3a25, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* ICH10 */ + /* SATA Controller AHCI (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller AHCI (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b23, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller RAID (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b24, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller RAID (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b25, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller Mobile AHCI (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b29, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller Mobile AHCI (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b2f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller Mobile RAID (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b2b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller Mobile RAID (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b2c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* JMicron */ { 0x197b, 0x2360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, diff -r bf8b1ee634e2 -r f236d7def994 drivers/scsi/ata_piix.c --- a/drivers/scsi/ata_piix.c Tue Nov 25 11:19:41 2008 +0000 +++ b/drivers/scsi/ata_piix.c Tue Nov 25 11:22:04 2008 +0000 @@ -220,6 +220,18 @@ static const struct pci_device_id piix_p { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, /* SATA Controller IDE (ICH10) */ { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b28, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, { } /* terminate list */ }; diff -r bf8b1ee634e2 -r f236d7def994 include/linux/pci_ids.h --- a/include/linux/pci_ids.h Tue Nov 25 11:19:41 2008 +0000 +++ b/include/linux/pci_ids.h Tue Nov 25 11:22:04 2008 +0000 @@ -2219,6 +2219,9 @@ #define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 +#define PCI_DEVICE_ID_INTEL_PCH_LPC_MIN 0x3b00 +#define PCI_DEVICE_ID_INTEL_PCH_LPC_MAX 0x3b1f +#define PCI_DEVICE_ID_INTEL_PCH_SMBUS 0x3b30 #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 diff -r bf8b1ee634e2 -r f236d7def994 sound/pci/hda/hda_intel.c --- a/sound/pci/hda/hda_intel.c Tue Nov 25 11:19:41 2008 +0000 +++ b/sound/pci/hda/hda_intel.c Tue Nov 25 11:22:04 2008 +0000 @@ -82,6 +82,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}, "{Intel, ICH8}," "{Intel, ICH9}," "{Intel, ICH10}," + "{Intel, PCH}," "{ATI, SB450}," "{ATI, SB600}," "{ATI, RS600}," @@ -1640,6 +1641,7 @@ static struct pci_device_id azx_ids[] = { 0x8086, 0x293f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */ { 0x8086, 0x3a3e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */ { 0x8086, 0x3a6e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */ + { 0x8086, 0x3b56, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* PCH */ { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */ { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:02:04 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:02:04 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QaK-0004BB-7P; Wed, 26 Nov 2008 12:02:04 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYV-000378-34 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:11 -0800 X-ASG-Debug-ID: 1227729609-39a800000000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id EAFBFEB8CD for ; Wed, 26 Nov 2008 12:00:09 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id RRUx8E5aG6rXqZUW for ; Wed, 26 Nov 2008 12:00:09 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738329 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738329" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:08 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK08oJ016092 for ; Wed, 26 Nov 2008 12:00:08 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0WQ1020133 for ; Wed, 26 Nov 2008 12:00:32 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0WDp020132 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:32 -0800 Message-Id: <200811262000.mAQK0WDp020132@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:30 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] Merge with ia64 tree. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729609 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] Merge with ia64 tree. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227698029 0 # Node ID 0b859c9516ba7831904d5437c7cdc0da07ecf12a # Parent 6591b4869889bdd705267c47ac855f0c4bb7d75b # Parent 5012c470f8757e97c2e0f7eccfafcb1e2367443e Merge with ia64 tree. --- drivers/xen/blkback/blkback.c | 10 +++++----- drivers/xen/blktap/blktap.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff -r 6591b4869889 -r 0b859c9516ba drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Wed Nov 26 10:24:15 2008 +0900 +++ b/drivers/xen/blkback/blkback.c Wed Nov 26 11:13:49 2008 +0000 @@ -317,14 +317,14 @@ static int do_block_io_op(blkif_t *blkif if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc)) break; + if (kthread_should_stop()) { + more_to_do = 1; + break; + } + pending_req = alloc_req(); if (NULL == pending_req) { blkif->st_oo_req++; - more_to_do = 1; - break; - } - - if (kthread_should_stop()) { more_to_do = 1; break; } diff -r 6591b4869889 -r 0b859c9516ba drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Wed Nov 26 10:24:15 2008 +0900 +++ b/drivers/xen/blktap/blktap.c Wed Nov 26 11:13:49 2008 +0000 @@ -1286,14 +1286,14 @@ static int do_block_io_op(blkif_t *blkif break; } + if (kthread_should_stop()) { + more_to_do = 1; + break; + } + pending_req = alloc_req(); if (NULL == pending_req) { blkif->st_oo_req++; - more_to_do = 1; - break; - } - - if (kthread_should_stop()) { more_to_do = 1; break; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:02:11 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:02:11 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QaQ-0004F2-Ud; Wed, 26 Nov 2008 12:02:11 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYX-00038T-Fl for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:13 -0800 X-ASG-Debug-ID: 1227729593-372f00010009-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id EA463EB8B9 for ; Wed, 26 Nov 2008 12:00:05 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id LO6kt0R0KQjNUk2T for ; Wed, 26 Nov 2008 12:00:05 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738327 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738327" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:04 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK03BW016086 for ; Wed, 26 Nov 2008 12:00:03 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0R5i020066 for ; Wed, 26 Nov 2008 12:00:27 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0RR5020065 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:27 -0800 Message-Id: <200811262000.mAQK0RR5020065@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:26 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729605 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1225770217 -32400 # Node ID 61d1f2810617b4d0a15ba192fcf679918d5b0438 # Parent 45c3a3dfa5b54619676d9de026452ee062a7e8af # Parent 2fb13b8cbe134fdb3f18ee21e641e52655066c62 merge with linux-2.6.18-xen.hg --- arch/i386/kernel/irq-xen.c | 4 arch/i386/kernel/pci-dma-xen.c | 10 - arch/i386/mm/highmem-xen.c | 47 ++++++++ arch/i386/mm/hypervisor.c | 57 ---------- arch/i386/mm/init-xen.c | 7 - arch/ia64/kernel/setup.c | 3 arch/ia64/xen/hypervisor.c | 155 ----------------------------- arch/ia64/xen/xen_dma.c | 3 arch/x86_64/kernel/entry-xen.S | 32 ++--- arch/x86_64/kernel/irq-xen.c | 6 - arch/x86_64/mm/init-xen.c | 7 - drivers/acpi/processor_core.c | 13 ++ drivers/acpi/processor_idle.c | 12 +- drivers/pci/bus.c | 7 - drivers/pci/quirks.c | 41 +------ drivers/xen/core/evtchn.c | 10 + drivers/xen/core/gnttab.c | 5 drivers/xen/core/xen_sysfs.c | 3 include/asm-i386/mach-xen/asm/highmem.h | 17 +++ include/asm-ia64/hypercall.h | 6 - include/asm-ia64/hypervisor.h | 1 include/linux/highmem.h | 8 + include/xen/gnttab.h | 1 include/xen/interface/arch-ia64/hvm/save.h | 10 + include/xen/interface/arch-x86/hvm/save.h | 13 ++ include/xen/interface/domctl.h | 4 include/xen/interface/features.h | 3 include/xen/interface/hvm/params.h | 7 + include/xen/interface/kexec.h | 2 include/xen/interface/trace.h | 10 + include/xen/interface/xen.h | 14 ++ 31 files changed, 196 insertions(+), 322 deletions(-) diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/i386/kernel/irq-xen.c --- a/arch/i386/kernel/irq-xen.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/i386/kernel/irq-xen.c Tue Nov 04 12:43:37 2008 +0900 @@ -66,7 +66,7 @@ fastcall unsigned int do_IRQ(struct pt_r BUG(); } - irq_enter(); + /*irq_enter();*/ #ifdef CONFIG_DEBUG_STACKOVERFLOW /* Debugging check for stack overflow: is there less than 1KB free? */ { @@ -121,7 +121,7 @@ fastcall unsigned int do_IRQ(struct pt_r #endif __do_IRQ(irq, regs); - irq_exit(); + /*irq_exit();*/ return 1; } diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/i386/kernel/pci-dma-xen.c --- a/arch/i386/kernel/pci-dma-xen.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/i386/kernel/pci-dma-xen.c Tue Nov 04 12:43:37 2008 +0900 @@ -97,17 +97,11 @@ static int check_pages_physically_contig int range_straddles_page_boundary(paddr_t p, size_t size) { - extern unsigned long *contiguous_bitmap; unsigned long pfn = p >> PAGE_SHIFT; unsigned int offset = p & ~PAGE_MASK; - if (offset + size <= PAGE_SIZE) - return 0; - if (test_bit(pfn, contiguous_bitmap)) - return 0; - if (check_pages_physically_contiguous(pfn, offset, size)) - return 0; - return 1; + return ((offset + size > PAGE_SIZE) && + !check_pages_physically_contiguous(pfn, offset, size)); } int diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/i386/mm/highmem-xen.c --- a/arch/i386/mm/highmem-xen.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/i386/mm/highmem-xen.c Tue Nov 04 12:43:37 2008 +0900 @@ -128,9 +128,56 @@ struct page *kmap_atomic_to_page(void *p return pte_page(*pte); } +void clear_highpage(struct page *page) +{ + void *kaddr; + + if (likely(xen_feature(XENFEAT_highmem_assist)) + && PageHighMem(page)) { + struct mmuext_op meo; + + meo.cmd = MMUEXT_CLEAR_PAGE; + meo.arg1.mfn = pfn_to_mfn(page_to_pfn(page)); + if (HYPERVISOR_mmuext_op(&meo, 1, NULL, DOMID_SELF) == 0) + return; + } + + kaddr = kmap_atomic(page, KM_USER0); + clear_page(kaddr); + kunmap_atomic(kaddr, KM_USER0); +} + +void copy_highpage(struct page *to, struct page *from) +{ + void *vfrom, *vto; + + if (likely(xen_feature(XENFEAT_highmem_assist)) + && (PageHighMem(from) || PageHighMem(to))) { + unsigned long from_pfn = page_to_pfn(from); + unsigned long to_pfn = page_to_pfn(to); + struct mmuext_op meo; + + meo.cmd = MMUEXT_COPY_PAGE; + meo.arg1.mfn = pfn_to_mfn(to_pfn); + meo.arg2.src_mfn = pfn_to_mfn(from_pfn); + if (mfn_to_pfn(meo.arg2.src_mfn) == from_pfn + && mfn_to_pfn(meo.arg1.mfn) == to_pfn + && HYPERVISOR_mmuext_op(&meo, 1, NULL, DOMID_SELF) == 0) + return; + } + + vfrom = kmap_atomic(from, KM_USER0); + vto = kmap_atomic(to, KM_USER1); + copy_page(vto, vfrom); + kunmap_atomic(vfrom, KM_USER0); + kunmap_atomic(vto, KM_USER1); +} + EXPORT_SYMBOL(kmap); EXPORT_SYMBOL(kunmap); EXPORT_SYMBOL(kmap_atomic); EXPORT_SYMBOL(kmap_atomic_pte); EXPORT_SYMBOL(kunmap_atomic); EXPORT_SYMBOL(kmap_atomic_to_page); +EXPORT_SYMBOL(clear_highpage); +EXPORT_SYMBOL(copy_highpage); diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/i386/mm/hypervisor.c --- a/arch/i386/mm/hypervisor.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/i386/mm/hypervisor.c Tue Nov 04 12:43:37 2008 +0900 @@ -190,54 +190,6 @@ void xen_set_ldt(const void *ptr, unsign BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); } -/* - * Bitmap is indexed by page number. If bit is set, the page is part of a - * xen_create_contiguous_region() area of memory. - */ -unsigned long *contiguous_bitmap; - -static void contiguous_bitmap_set( - unsigned long first_page, unsigned long nr_pages) -{ - unsigned long start_off, end_off, curr_idx, end_idx; - - curr_idx = first_page / BITS_PER_LONG; - start_off = first_page & (BITS_PER_LONG-1); - end_idx = (first_page + nr_pages) / BITS_PER_LONG; - end_off = (first_page + nr_pages) & (BITS_PER_LONG-1); - - if (curr_idx == end_idx) { - contiguous_bitmap[curr_idx] |= - ((1UL<> PAGE_SHIFT, - 1UL << order); - balloon_unlock(flags); return success ? 0 : -ENOMEM; @@ -363,8 +311,7 @@ void xen_destroy_contiguous_region(unsig } }; - if (xen_feature(XENFEAT_auto_translated_physmap) || - !test_bit(__pa(vstart) >> PAGE_SHIFT, contiguous_bitmap)) + if (xen_feature(XENFEAT_auto_translated_physmap)) return; if (unlikely(order > MAX_CONTIG_ORDER)) @@ -376,8 +323,6 @@ void xen_destroy_contiguous_region(unsig scrub_pages((void *)vstart, 1 << order); balloon_lock(flags); - - contiguous_bitmap_clear(__pa(vstart) >> PAGE_SHIFT, 1UL << order); /* 1. Find start MFN of contiguous extent. */ in_frame = pfn_to_mfn(__pa(vstart) >> PAGE_SHIFT); diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/i386/mm/init-xen.c --- a/arch/i386/mm/init-xen.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/i386/mm/init-xen.c Tue Nov 04 12:43:37 2008 +0900 @@ -47,8 +47,6 @@ #include #include -extern unsigned long *contiguous_bitmap; - unsigned int __VMALLOC_RESERVE = 128 << 20; DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); @@ -619,11 +617,6 @@ void __init mem_init(void) int tmp; int bad_ppro; unsigned long pfn; - - contiguous_bitmap = alloc_bootmem_low_pages( - (max_low_pfn + 2*BITS_PER_LONG) >> 3); - BUG_ON(!contiguous_bitmap); - memset(contiguous_bitmap, 0, (max_low_pfn + 2*BITS_PER_LONG) >> 3); #if defined(CONFIG_SWIOTLB) swiotlb_init(); diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/ia64/kernel/setup.c --- a/arch/ia64/kernel/setup.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/ia64/kernel/setup.c Tue Nov 04 12:43:37 2008 +0900 @@ -684,9 +684,6 @@ setup_arch (char **cmdline_p) } #endif paging_init(); -#ifdef CONFIG_XEN - xen_contiguous_bitmap_init(max_pfn); -#endif } /* diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/ia64/xen/hypervisor.c --- a/arch/ia64/xen/hypervisor.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/ia64/xen/hypervisor.c Tue Nov 04 12:43:37 2008 +0900 @@ -77,154 +77,6 @@ xen_cpu_init(void) { extern void xen_smp_intr_init(void); xen_smp_intr_init(); -} - -/* - *XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear() - * move those to lib/contiguous_bitmap? - *XXX discontigmem/sparsemem - */ - -/* - * Bitmap is indexed by page number. If bit is set, the page is part of a - * xen_create_contiguous_region() area of memory. - */ -unsigned long *contiguous_bitmap __read_mostly; - -#ifdef CONFIG_VIRTUAL_MEM_MAP -/* Following logic is stolen from create_mem_map_table() for virtual memmap */ -static int -create_contiguous_bitmap(u64 start, u64 end, void *arg) -{ - unsigned long address, start_page, end_page; - unsigned long bitmap_start, bitmap_end; - unsigned char *bitmap; - int node; - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - pte_t *pte; - - bitmap_start = (unsigned long)contiguous_bitmap + - ((__pa(start) >> PAGE_SHIFT) >> 3); - bitmap_end = (unsigned long)contiguous_bitmap + - (((__pa(end) >> PAGE_SHIFT) + 2 * BITS_PER_LONG) >> 3); - - start_page = bitmap_start & PAGE_MASK; - end_page = PAGE_ALIGN(bitmap_end); - node = paddr_to_nid(__pa(start)); - - bitmap = alloc_bootmem_pages_node(NODE_DATA(node), - end_page - start_page); - BUG_ON(!bitmap); - memset(bitmap, 0, end_page - start_page); - - for (address = start_page; address < end_page; address += PAGE_SIZE) { - pgd = pgd_offset_k(address); - if (pgd_none(*pgd)) - pgd_populate(&init_mm, pgd, - alloc_bootmem_pages_node(NODE_DATA(node), - PAGE_SIZE)); - pud = pud_offset(pgd, address); - - if (pud_none(*pud)) - pud_populate(&init_mm, pud, - alloc_bootmem_pages_node(NODE_DATA(node), - PAGE_SIZE)); - pmd = pmd_offset(pud, address); - - if (pmd_none(*pmd)) - pmd_populate_kernel(&init_mm, pmd, - alloc_bootmem_pages_node - (NODE_DATA(node), PAGE_SIZE)); - pte = pte_offset_kernel(pmd, address); - - if (pte_none(*pte)) - set_pte(pte, - pfn_pte(__pa(bitmap + (address - start_page)) - >> PAGE_SHIFT, PAGE_KERNEL)); - } - return 0; -} -#endif - -static void -__contiguous_bitmap_init(unsigned long size) -{ - contiguous_bitmap = alloc_bootmem_pages(size); - BUG_ON(!contiguous_bitmap); - memset(contiguous_bitmap, 0, size); -} - -void -xen_contiguous_bitmap_init(unsigned long end_pfn) -{ - unsigned long size = (end_pfn + 2 * BITS_PER_LONG) >> 3; -#ifndef CONFIG_VIRTUAL_MEM_MAP - __contiguous_bitmap_init(size); -#else - unsigned long max_gap = 0; - - efi_memmap_walk(find_largest_hole, (u64*)&max_gap); - if (max_gap < LARGE_GAP) { - __contiguous_bitmap_init(size); - } else { - unsigned long map_size = PAGE_ALIGN(size); - vmalloc_end -= map_size; - contiguous_bitmap = (unsigned long*)vmalloc_end; - efi_memmap_walk(create_contiguous_bitmap, NULL); - } -#endif -} - -#if 0 -int -contiguous_bitmap_test(void* p) -{ - return test_bit(__pa(p) >> PAGE_SHIFT, contiguous_bitmap); -} -#endif - -static void contiguous_bitmap_set( - unsigned long first_page, unsigned long nr_pages) -{ - unsigned long start_off, end_off, curr_idx, end_idx; - - curr_idx = first_page / BITS_PER_LONG; - start_off = first_page & (BITS_PER_LONG-1); - end_idx = (first_page + nr_pages) / BITS_PER_LONG; - end_off = (first_page + nr_pages) & (BITS_PER_LONG-1); - - if (curr_idx == end_idx) { - contiguous_bitmap[curr_idx] |= - ((1UL< MAX_CONTIG_ORDER)) return; @@ -375,8 +222,6 @@ __xen_destroy_contiguous_region(unsigned scrub_pages(vstart, num_gpfn); balloon_lock(flags); - - contiguous_bitmap_clear(start_gpfn, num_gpfn); /* Do the exchange for non-contiguous MFNs. */ in_frame = start_gpfn; diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/ia64/xen/xen_dma.c --- a/arch/ia64/xen/xen_dma.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/ia64/xen/xen_dma.c Tue Nov 04 12:43:37 2008 +0900 @@ -57,7 +57,6 @@ static int check_pages_physically_contig int range_straddles_page_boundary(paddr_t p, size_t size) { - extern unsigned long *contiguous_bitmap; unsigned long pfn = p >> PAGE_SHIFT; unsigned int offset = p & ~PAGE_MASK; @@ -65,8 +64,6 @@ int range_straddles_page_boundary(paddr_ return 0; if (offset + size <= PAGE_SIZE) - return 0; - if (test_bit(pfn, contiguous_bitmap)) return 0; if (check_pages_physically_contiguous(pfn, offset, size)) return 0; diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/x86_64/kernel/entry-xen.S --- a/arch/x86_64/kernel/entry-xen.S Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/x86_64/kernel/entry-xen.S Tue Nov 04 12:43:37 2008 +0900 @@ -117,9 +117,9 @@ NMI_MASK = 0x80000000 .macro CFI_DEFAULT_STACK start=1,adj=0 .if \start CFI_STARTPROC simple - CFI_DEF_CFA rsp,SS+8-(\adj*ARGOFFSET) + CFI_DEF_CFA rsp,SS+8 - \adj*ARGOFFSET .else - CFI_DEF_CFA_OFFSET SS+8-(\adj*ARGOFFSET) + CFI_DEF_CFA_OFFSET SS+8 - \adj*ARGOFFSET .endif .if \adj == 0 CFI_REL_OFFSET r15,R15 @@ -129,20 +129,20 @@ NMI_MASK = 0x80000000 CFI_REL_OFFSET rbp,RBP CFI_REL_OFFSET rbx,RBX .endif - CFI_REL_OFFSET r11,R11 - CFI_REL_OFFSET r10,R10 - CFI_REL_OFFSET r9,R9 - CFI_REL_OFFSET r8,R8 - CFI_REL_OFFSET rax,RAX - CFI_REL_OFFSET rcx,RCX - CFI_REL_OFFSET rdx,RDX - CFI_REL_OFFSET rsi,RSI - CFI_REL_OFFSET rdi,RDI - CFI_REL_OFFSET rip,RIP - /*CFI_REL_OFFSET cs,CS*/ - /*CFI_REL_OFFSET rflags,EFLAGS*/ - CFI_REL_OFFSET rsp,RSP - /*CFI_REL_OFFSET ss,SS*/ + CFI_REL_OFFSET r11,R11 - \adj*ARGOFFSET + CFI_REL_OFFSET r10,R10 - \adj*ARGOFFSET + CFI_REL_OFFSET r9,R9 - \adj*ARGOFFSET + CFI_REL_OFFSET r8,R8 - \adj*ARGOFFSET + CFI_REL_OFFSET rax,RAX - \adj*ARGOFFSET + CFI_REL_OFFSET rcx,RCX - \adj*ARGOFFSET + CFI_REL_OFFSET rdx,RDX - \adj*ARGOFFSET + CFI_REL_OFFSET rsi,RSI - \adj*ARGOFFSET + CFI_REL_OFFSET rdi,RDI - \adj*ARGOFFSET + CFI_REL_OFFSET rip,RIP - \adj*ARGOFFSET + /*CFI_REL_OFFSET cs,CS - \adj*ARGOFFSET*/ + /*CFI_REL_OFFSET rflags,EFLAGS - \adj*ARGOFFSET*/ + CFI_REL_OFFSET rsp,RSP - \adj*ARGOFFSET + /*CFI_REL_OFFSET ss,SS - \adj*ARGOFFSET*/ .endm /* diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/x86_64/kernel/irq-xen.c --- a/arch/x86_64/kernel/irq-xen.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/x86_64/kernel/irq-xen.c Tue Nov 04 12:43:37 2008 +0900 @@ -124,13 +124,13 @@ asmlinkage unsigned int do_IRQ(struct pt BUG(); } - exit_idle(); - irq_enter(); + /*exit_idle();*/ + /*irq_enter();*/ #ifdef CONFIG_DEBUG_STACKOVERFLOW stack_overflow_check(regs); #endif __do_IRQ(irq, regs); - irq_exit(); + /*irq_exit();*/ return 1; } diff -r 45c3a3dfa5b5 -r 61d1f2810617 arch/x86_64/mm/init-xen.c --- a/arch/x86_64/mm/init-xen.c Fri Oct 24 11:22:02 2008 +0900 +++ b/arch/x86_64/mm/init-xen.c Tue Nov 04 12:43:37 2008 +0900 @@ -61,8 +61,6 @@ EXPORT_SYMBOL(__kernel_page_user); int after_bootmem; -extern unsigned long *contiguous_bitmap; - static unsigned long dma_reserve __initdata; DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); @@ -972,11 +970,6 @@ void __init mem_init(void) long codesize, reservedpages, datasize, initsize; unsigned long pfn; - contiguous_bitmap = alloc_bootmem_low_pages( - (end_pfn + 2*BITS_PER_LONG) >> 3); - BUG_ON(!contiguous_bitmap); - memset(contiguous_bitmap, 0, (end_pfn + 2*BITS_PER_LONG) >> 3); - pci_iommu_alloc(); /* How many end-of-memory variables you have, grandma! */ diff -r 45c3a3dfa5b5 -r 61d1f2810617 drivers/acpi/processor_core.c --- a/drivers/acpi/processor_core.c Fri Oct 24 11:22:02 2008 +0900 +++ b/drivers/acpi/processor_core.c Tue Nov 04 12:43:37 2008 +0900 @@ -513,8 +513,17 @@ static int acpi_processor_get_info(struc #if defined(CONFIG_CPU_FREQ) || defined(CONFIG_PROCESSOR_EXTERNAL_CONTROL) acpi_processor_ppc_has_changed(pr); #endif - acpi_processor_get_throttling_info(pr); - acpi_processor_get_limit_info(pr); + + /* + * pr->id may equal to -1 while processor_cntl_external enabled. + * throttle and thermal module don't support this case. + * Tx only works when dom0 vcpu == pcpu num by far, as we give + * control to dom0. + */ + if (pr->id != -1) { + acpi_processor_get_throttling_info(pr); + acpi_processor_get_limit_info(pr); + } return 0; } diff -r 45c3a3dfa5b5 -r 61d1f2810617 drivers/acpi/processor_idle.c --- a/drivers/acpi/processor_idle.c Fri Oct 24 11:22:02 2008 +0900 +++ b/drivers/acpi/processor_idle.c Tue Nov 04 12:43:37 2008 +0900 @@ -654,7 +654,7 @@ static int acpi_processor_get_power_info if (nocst) return -ENODEV; - current_count = 1; + current_count = 0; /* Zero initialize C2 onwards and prepare for fresh CST lookup */ for (i = 2; i < ACPI_PROCESSOR_MAX_POWER; i++) @@ -728,13 +728,17 @@ static int acpi_processor_get_power_info cx.type = obj->integer.value; + /* + * Some buggy BIOSes won't list C1 in _CST - + * Let acpi_processor_get_power_info_default() handle them later + */ + if (i == 1 && cx.type != ACPI_STATE_C1) + current_count++; + /* Following check doesn't apply to external control case */ if (!processor_pm_external() && (cx.type != ACPI_STATE_C1) && (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) - continue; - - if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3)) continue; obj = (union acpi_object *)&(element->package.elements[2]); diff -r 45c3a3dfa5b5 -r 61d1f2810617 drivers/pci/bus.c --- a/drivers/pci/bus.c Fri Oct 24 11:22:02 2008 +0900 +++ b/drivers/pci/bus.c Tue Nov 04 12:43:37 2008 +0900 @@ -16,8 +16,6 @@ #include #include "pci.h" - -extern int pci_mem_align; /** * pci_bus_alloc_resource - allocate a resource from a parent bus @@ -45,11 +43,6 @@ pci_bus_alloc_resource(struct pci_bus *b int i, ret = -ENOMEM; type_mask |= IORESOURCE_IO | IORESOURCE_MEM; - - /* If the boot parameter 'pci-mem-align' was specified then we need to - align the memory addresses, at page size alignment. */ - if (pci_mem_align && (align < (PAGE_SIZE-1))) - align = PAGE_SIZE - 1; for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { struct resource *r = bus->resource[i]; diff -r 45c3a3dfa5b5 -r 61d1f2810617 drivers/pci/quirks.c --- a/drivers/pci/quirks.c Fri Oct 24 11:22:02 2008 +0900 +++ b/drivers/pci/quirks.c Tue Nov 04 12:43:37 2008 +0900 @@ -23,25 +23,17 @@ #include #include "pci.h" -/* A global flag which signals if we should page-align PCI mem windows. */ -int pci_mem_align = 0; - -static int __init set_pci_mem_align(char *str) -{ - pci_mem_align = 1; - return 1; -} -__setup("pci-mem-align", set_pci_mem_align); - - -/* This quirk function enables us to force all memory resources which are - * assigned to PCI devices, to be page-aligned. - */ -static void __devinit quirk_align_mem_resources(struct pci_dev *dev) + +/* + * This quirk function disables the device and releases resources + * which is specified by kernel's boot parameter 'reassigndev'. + * Later on, kernel will assign page-aligned memory resource back + * to that device. + */ +static void __devinit quirk_release_resources(struct pci_dev *dev) { int i; struct resource *r; - resource_size_t old_start; if (is_reassigndev(dev)) { if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL && @@ -76,21 +68,8 @@ static void __devinit quirk_align_mem_re } return; } - - if (!pci_mem_align) - return; - - for (i=0; i < DEVICE_COUNT_RESOURCE; i++) { - r = &dev->resource[i]; - if ((r == NULL) || !(r->flags & IORESOURCE_MEM)) - continue; - - old_start = r->start; - r->start = (r->start + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); - r->end = r->end - (old_start - r->start); - } -} -DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_align_mem_resources); +} +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_release_resources); /* The Mellanox Tavor device gives false positive parity errors * Mark this device with a broken_parity_status, to allow diff -r 45c3a3dfa5b5 -r 61d1f2810617 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Fri Oct 24 11:22:02 2008 +0900 +++ b/drivers/xen/core/evtchn.c Tue Nov 04 12:43:37 2008 +0900 @@ -246,6 +246,8 @@ asmlinkage void evtchn_do_upcall(struct shared_info_t *s = HYPERVISOR_shared_info; vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; + exit_idle(); + irq_enter(); do { /* Avoid a callback storm when we reenable delivery. */ @@ -253,7 +255,7 @@ asmlinkage void evtchn_do_upcall(struct /* Nested invocations bail immediately. */ if (unlikely(per_cpu(upcall_count, cpu)++)) - return; + break; #ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */ /* Clear master flag /before/ clearing selector flag. */ @@ -293,10 +295,8 @@ asmlinkage void evtchn_do_upcall(struct port = (l1i * BITS_PER_LONG) + l2i; if ((irq = evtchn_to_irq[port]) != -1) do_IRQ(irq, regs); - else { - exit_idle(); + else evtchn_device_upcall(port); - } /* if this is the final port processed, we'll pick up here+1 next time */ per_cpu(last_processed_l1i, cpu) = l1i; @@ -314,6 +314,8 @@ asmlinkage void evtchn_do_upcall(struct count = per_cpu(upcall_count, cpu); per_cpu(upcall_count, cpu) = 0; } while (unlikely(count != 1)); + + irq_exit(); } static int find_unbound_irq(void) diff -r 45c3a3dfa5b5 -r 61d1f2810617 drivers/xen/core/gnttab.c --- a/drivers/xen/core/gnttab.c Fri Oct 24 11:22:02 2008 +0900 +++ b/drivers/xen/core/gnttab.c Tue Nov 04 12:43:37 2008 +0900 @@ -112,6 +112,7 @@ static void do_free_callbacks(void) next = callback->next; if (gnttab_free_count >= callback->count) { callback->next = NULL; + callback->queued = 0; callback->fn(callback->arg); } else { callback->next = gnttab_free_callback_list; @@ -343,11 +344,12 @@ void gnttab_request_free_callback(struct { unsigned long flags; spin_lock_irqsave(&gnttab_list_lock, flags); - if (callback->next) + if (callback->queued) goto out; callback->fn = fn; callback->arg = arg; callback->count = count; + callback->queued = 1; callback->next = gnttab_free_callback_list; gnttab_free_callback_list = callback; check_free_callbacks(); @@ -365,6 +367,7 @@ void gnttab_cancel_free_callback(struct for (pcb = &gnttab_free_callback_list; *pcb; pcb = &(*pcb)->next) { if (*pcb == callback) { *pcb = callback->next; + callback->queued = 0; break; } } diff -r 45c3a3dfa5b5 -r 61d1f2810617 drivers/xen/core/xen_sysfs.c --- a/drivers/xen/core/xen_sysfs.c Fri Oct 24 11:22:02 2008 +0900 +++ b/drivers/xen/core/xen_sysfs.c Tue Nov 04 12:43:37 2008 +0900 @@ -336,6 +336,9 @@ static void xen_properties_destroy(void) } #ifdef CONFIG_KEXEC + +extern size_t vmcoreinfo_size_xen; +extern unsigned long paddr_vmcoreinfo_xen; static ssize_t vmcoreinfo_show(struct hyp_sysfs_attr *attr, char *page) { diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/asm-i386/mach-xen/asm/highmem.h --- a/include/asm-i386/mach-xen/asm/highmem.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/asm-i386/mach-xen/asm/highmem.h Tue Nov 04 12:43:37 2008 +0900 @@ -75,6 +75,23 @@ struct page *kmap_atomic_to_page(void *p #define flush_cache_kmaps() do { } while (0) +void clear_highpage(struct page *); +static inline void clear_user_highpage(struct page *page, unsigned long vaddr) +{ + clear_highpage(page); +} +#define __HAVE_ARCH_CLEAR_HIGHPAGE +#define __HAVE_ARCH_CLEAR_USER_HIGHPAGE + +void copy_highpage(struct page *to, struct page *from); +static inline void copy_user_highpage(struct page *to, struct page *from, + unsigned long vaddr) +{ + copy_highpage(to, from); +} +#define __HAVE_ARCH_COPY_HIGHPAGE +#define __HAVE_ARCH_COPY_USER_HIGHPAGE + #endif /* __KERNEL__ */ #endif /* _ASM_HIGHMEM_H */ diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/asm-ia64/hypercall.h --- a/include/asm-ia64/hypercall.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/asm-ia64/hypercall.h Tue Nov 04 12:43:37 2008 +0900 @@ -237,11 +237,7 @@ xencomm_arch_hypercall_opt_feature(struc extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); static inline void exit_idle(void) {} -#define do_IRQ(irq, regs) ({ \ - irq_enter(); \ - __do_IRQ((irq), (regs)); \ - irq_exit(); \ -}) +#define do_IRQ(irq, regs) __do_IRQ((irq), (regs)) #include #ifdef HAVE_XEN_PLATFORM_COMPAT_H diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/asm-ia64/hypervisor.h --- a/include/asm-ia64/hypervisor.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/asm-ia64/hypervisor.h Tue Nov 04 12:43:37 2008 +0900 @@ -140,7 +140,6 @@ int privcmd_mmap(struct file * file, str #define pte_mfn(_x) pte_pfn(_x) #define phys_to_machine_mapping_valid(_x) (1) -void xen_contiguous_bitmap_init(unsigned long end_pfn); int __xen_create_contiguous_region(unsigned long vstart, unsigned int order, unsigned int address_bits); static inline int xen_create_contiguous_region(unsigned long vstart, diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/linux/highmem.h --- a/include/linux/highmem.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/linux/highmem.h Tue Nov 04 12:43:37 2008 +0900 @@ -50,6 +50,7 @@ static inline void *kmap(struct page *pa #endif /* CONFIG_HIGHMEM */ +#ifndef __HAVE_ARCH_CLEAR_USER_HIGHPAGE /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ static inline void clear_user_highpage(struct page *page, unsigned long vaddr) { @@ -59,6 +60,7 @@ static inline void clear_user_highpage(s /* Make sure this page is cleared on other CPU's too before using it */ smp_wmb(); } +#endif #ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE static inline struct page * @@ -73,12 +75,14 @@ alloc_zeroed_user_highpage(struct vm_are } #endif +#ifndef __HAVE_ARCH_CLEAR_HIGHPAGE static inline void clear_highpage(struct page *page) { void *kaddr = kmap_atomic(page, KM_USER0); clear_page(kaddr); kunmap_atomic(kaddr, KM_USER0); } +#endif /* * Same but also flushes aliased cache contents to RAM. @@ -95,6 +99,7 @@ static inline void memclear_highpage_flu kunmap_atomic(kaddr, KM_USER0); } +#ifndef __HAVE_ARCH_COPY_USER_HIGHPAGE static inline void copy_user_highpage(struct page *to, struct page *from, unsigned long vaddr) { char *vfrom, *vto; @@ -107,7 +112,9 @@ static inline void copy_user_highpage(st /* Make sure this page is cleared on other CPU's too before using it */ smp_wmb(); } +#endif +#ifndef __HAVE_ARCH_COPY_HIGHPAGE static inline void copy_highpage(struct page *to, struct page *from) { char *vfrom, *vto; @@ -118,5 +125,6 @@ static inline void copy_highpage(struct kunmap_atomic(vfrom, KM_USER0); kunmap_atomic(vto, KM_USER1); } +#endif #endif /* _LINUX_HIGHMEM_H */ diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/gnttab.h --- a/include/xen/gnttab.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/gnttab.h Tue Nov 04 12:43:37 2008 +0900 @@ -48,6 +48,7 @@ struct gnttab_free_callback { void (*fn)(void *); void *arg; u16 count; + u8 queued; }; int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/interface/arch-ia64/hvm/save.h --- a/include/xen/interface/arch-ia64/hvm/save.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/interface/arch-ia64/hvm/save.h Tue Nov 04 12:43:37 2008 +0900 @@ -106,7 +106,11 @@ DECLARE_HVM_SAVE_TYPE(VTIME, 5, struct h */ #define VIOSAPIC_NUM_PINS 48 -union viosapic_rte +/* To share VT-d code which uses vioapic_redir_entry. + * Although on ia64 this is for vsapic, but we have to vioapic_redir_entry + * instead of viosapic_redir_entry. + */ +union vioapic_redir_entry { uint64_t bits; struct { @@ -124,7 +128,7 @@ union viosapic_rte uint8_t reserved[3]; uint16_t dest_id; - }; + } fields; }; struct hvm_hw_ia64_viosapic { @@ -134,7 +138,7 @@ struct hvm_hw_ia64_viosapic { uint32_t pad; uint64_t lowest_vcpu_id; uint64_t base_address; - union viosapic_rte redirtbl[VIOSAPIC_NUM_PINS]; + union vioapic_redir_entry redirtbl[VIOSAPIC_NUM_PINS]; }; DECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struct hvm_hw_ia64_viosapic); diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/interface/arch-x86/hvm/save.h --- a/include/xen/interface/arch-x86/hvm/save.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/interface/arch-x86/hvm/save.h Tue Nov 04 12:43:37 2008 +0900 @@ -421,9 +421,20 @@ struct hvm_hw_mtrr { DECLARE_HVM_SAVE_TYPE(MTRR, 14, struct hvm_hw_mtrr); +/* + * Viridian hypervisor context. + */ + +struct hvm_viridian_context { + uint64_t hypercall_gpa; + uint64_t guest_os_id; +}; + +DECLARE_HVM_SAVE_TYPE(VIRIDIAN, 15, struct hvm_viridian_context); + /* * Largest type-code in use */ -#define HVM_SAVE_CODE_MAX 14 +#define HVM_SAVE_CODE_MAX 15 #endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */ diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/interface/domctl.h --- a/include/xen/interface/domctl.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/interface/domctl.h Tue Nov 04 12:43:37 2008 +0900 @@ -614,6 +614,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_subsc #define XEN_DOMCTL_set_machine_address_size 51 #define XEN_DOMCTL_get_machine_address_size 52 +/* + * Do not inject spurious page faults into this domain. + */ +#define XEN_DOMCTL_suppress_spurious_page_faults 53 struct xen_domctl { uint32_t cmd; diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/interface/features.h --- a/include/xen/interface/features.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/interface/features.h Tue Nov 04 12:43:37 2008 +0900 @@ -59,6 +59,9 @@ /* x86: Does this Xen host support the MMU_PT_UPDATE_PRESERVE_AD hypercall? */ #define XENFEAT_mmu_pt_update_preserve_ad 5 +/* x86: Does this Xen host support the MMU_{CLEAR,COPY}_PAGE hypercall? */ +#define XENFEAT_highmem_assist 6 + #define XENFEAT_NR_SUBMAPS 1 #endif /* __XEN_PUBLIC_FEATURES_H__ */ diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/interface/hvm/params.h --- a/include/xen/interface/hvm/params.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/interface/hvm/params.h Tue Nov 04 12:43:37 2008 +0900 @@ -51,9 +51,16 @@ #define HVM_PARAM_BUFIOREQ_PFN 6 #ifdef __ia64__ + #define HVM_PARAM_NVRAM_FD 7 #define HVM_PARAM_VHPT_SIZE 8 #define HVM_PARAM_BUFPIOREQ_PFN 9 + +#elif defined(__i386__) || defined(__x86_64__) + +/* Expose Viridian interfaces to this HVM guest? */ +#define HVM_PARAM_VIRIDIAN 9 + #endif /* diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/interface/kexec.h --- a/include/xen/interface/kexec.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/interface/kexec.h Tue Nov 04 12:43:37 2008 +0900 @@ -175,8 +175,6 @@ void vmcoreinfo_append_str(const char *f #define VMCOREINFO_OFFSET_ALIAS(name, field, alias) \ vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #alias, \ (unsigned long)offsetof(struct name, field)) -extern size_t vmcoreinfo_size_xen; -extern unsigned long paddr_vmcoreinfo_xen; #endif /* _XEN_PUBLIC_KEXEC_H */ diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/interface/trace.h --- a/include/xen/interface/trace.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/interface/trace.h Tue Nov 04 12:43:37 2008 +0900 @@ -38,6 +38,7 @@ #define TRC_MEM 0x0010f000 /* Xen memory trace */ #define TRC_PV 0x0020f000 /* Xen PV traces */ #define TRC_SHADOW 0x0040f000 /* Xen shadow tracing */ +#define TRC_PM 0x0080f000 /* Xen power management trace */ #define TRC_ALL 0x0ffff000 #define TRC_HD_TO_EVENT(x) ((x)&0x0fffffff) #define TRC_HD_CYCLE_FLAG (1UL<<31) @@ -146,6 +147,15 @@ #define TRC_HVM_LMSW (TRC_HVM_HANDLER + 0x19) #define TRC_HVM_LMSW64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x19) +/* trace subclasses for power management */ +#define TRC_PM_FREQ 0x00801000 /* xen cpu freq events */ +#define TRC_PM_IDLE 0x00802000 /* xen cpu idle events */ + +/* trace events for per class */ +#define TRC_PM_FREQ_CHANGE (TRC_PM_FREQ + 0x01) +#define TRC_PM_IDLE_ENTRY (TRC_PM_IDLE + 0x01) +#define TRC_PM_IDLE_EXIT (TRC_PM_IDLE + 0x02) + /* This structure represents a single trace buffer record. */ struct t_rec { uint32_t event:28; diff -r 45c3a3dfa5b5 -r 61d1f2810617 include/xen/interface/xen.h --- a/include/xen/interface/xen.h Fri Oct 24 11:22:02 2008 +0900 +++ b/include/xen/interface/xen.h Tue Nov 04 12:43:37 2008 +0900 @@ -231,6 +231,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); * cmd: MMUEXT_SET_LDT * linear_addr: Linear address of LDT base (NB. must be page-aligned). * nr_ents: Number of entries in LDT. + * + * cmd: MMUEXT_CLEAR_PAGE + * mfn: Machine frame number to be cleared. + * + * cmd: MMUEXT_COPY_PAGE + * mfn: Machine frame number of the destination page. + * src_mfn: Machine frame number of the source page. */ #define MMUEXT_PIN_L1_TABLE 0 #define MMUEXT_PIN_L2_TABLE 1 @@ -247,12 +254,15 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #define MMUEXT_FLUSH_CACHE 12 #define MMUEXT_SET_LDT 13 #define MMUEXT_NEW_USER_BASEPTR 15 +#define MMUEXT_CLEAR_PAGE 16 +#define MMUEXT_COPY_PAGE 17 #ifndef __ASSEMBLY__ struct mmuext_op { unsigned int cmd; union { - /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */ + /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR + * CLEAR_PAGE, COPY_PAGE */ xen_pfn_t mfn; /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ unsigned long linear_addr; @@ -266,6 +276,8 @@ struct mmuext_op { #else void *vcpumask; #endif + /* COPY_PAGE */ + xen_pfn_t src_mfn; } arg2; }; typedef struct mmuext_op mmuext_op_t; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:02:22 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:02:22 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5Qac-0004Jd-2F; Wed, 26 Nov 2008 12:02:22 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYd-0003CE-Nc for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:19 -0800 X-ASG-Debug-ID: 1227729593-372f0001000a-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 13B5FEB8CE for ; Wed, 26 Nov 2008 12:00:08 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id x5kA14ALnBWyoNvN for ; Wed, 26 Nov 2008 12:00:08 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738328 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738328" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:07 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK06WT016089 for ; Wed, 26 Nov 2008 12:00:06 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0UPP020096 for ; Wed, 26 Nov 2008 12:00:30 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0U11020093 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:30 -0800 Message-Id: <200811262000.mAQK0U11020093@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:28 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729611 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1227662655 -32400 # Node ID 6591b4869889bdd705267c47ac855f0c4bb7d75b # Parent 61d1f2810617b4d0a15ba192fcf679918d5b0438 # Parent f236d7def9944909bf40015ff4a08817b0803ed9 merge with linux-2.6.18-xen.hg --- Documentation/pcieaer-howto.txt | 252 +++++++++ arch/i386/kernel/io_apic-xen.c | 5 arch/i386/pci/irq.c | 9 arch/x86_64/kernel/io_apic-xen.c | 5 drivers/i2c/busses/Kconfig | 1 drivers/i2c/busses/i2c-i801.c | 2 drivers/pci/msi-xen.c | 177 ++++-- drivers/pci/pcie/Kconfig | 1 drivers/pci/pcie/Makefile | 3 drivers/pci/pcie/aer/Kconfig | 12 drivers/pci/pcie/aer/Makefile | 8 drivers/pci/pcie/aer/aerdrv.c | 346 ++++++++++++ drivers/pci/pcie/aer/aerdrv.h | 125 ++++ drivers/pci/pcie/aer/aerdrv_acpi.c | 68 ++ drivers/pci/pcie/aer/aerdrv_core.c | 757 ++++++++++++++++++++++++++++ drivers/pci/pcie/aer/aerdrv_errprint.c | 248 +++++++++ drivers/pci/pcie/portdrv_bus.c | 1 drivers/pci/pcie/portdrv_pci.c | 224 ++++++-- drivers/pci/search.c | 31 + drivers/scsi/ahci.c | 25 drivers/scsi/ata_piix.c | 12 drivers/xen/balloon/balloon.c | 4 drivers/xen/balloon/sysfs.c | 9 drivers/xen/blkback/blkback.c | 44 - drivers/xen/blktap/blktap.c | 43 + drivers/xen/core/evtchn.c | 583 ++++++++++----------- drivers/xen/core/pci.c | 8 drivers/xen/fbfront/xenfb.c | 8 drivers/xen/pciback/controller.c | 35 + drivers/xen/pciback/passthrough.c | 10 drivers/xen/pciback/pci_stub.c | 319 +++++++++++ drivers/xen/pciback/pciback.h | 15 drivers/xen/pciback/pciback_ops.c | 25 drivers/xen/pciback/slot.c | 30 + drivers/xen/pciback/vpci.c | 30 + drivers/xen/pciback/xenbus.c | 9 drivers/xen/pcifront/pci_op.c | 115 ++++ drivers/xen/pcifront/pcifront.h | 13 drivers/xen/pcifront/xenbus.c | 14 include/asm-i386/mach-xen/asm/hypercall.h | 7 include/asm-x86_64/mach-xen/asm/hypercall.h | 7 include/linux/aer.h | 24 include/linux/pci.h | 6 include/linux/pci_ids.h | 3 include/linux/pcieport_if.h | 6 include/xen/interface/features.h | 6 include/xen/interface/grant_table.h | 9 include/xen/interface/io/pciif.h | 35 + include/xen/interface/kexec.h | 21 include/xen/interface/trace.h | 2 kernel/kexec.c | 3 sound/pci/hda/hda_intel.c | 2 52 files changed, 3285 insertions(+), 472 deletions(-) diff -r 61d1f2810617 -r 6591b4869889 Documentation/pcieaer-howto.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Documentation/pcieaer-howto.txt Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,253 @@ + The PCI Express Advanced Error Reporting Driver Guide HOWTO + T. Long Nguyen + Yanmin Zhang + 07/29/2006 + + +1. Overview + +1.1 About this guide + +This guide describes the basics of the PCI Express Advanced Error +Reporting (AER) driver and provides information on how to use it, as +well as how to enable the drivers of endpoint devices to conform with +PCI Express AER driver. + +1.2 Copyright © Intel Corporation 2006. + +1.3 What is the PCI Express AER Driver? + +PCI Express error signaling can occur on the PCI Express link itself +or on behalf of transactions initiated on the link. PCI Express +defines two error reporting paradigms: the baseline capability and +the Advanced Error Reporting capability. The baseline capability is +required of all PCI Express components providing a minimum defined +set of error reporting requirements. Advanced Error Reporting +capability is implemented with a PCI Express advanced error reporting +extended capability structure providing more robust error reporting. + +The PCI Express AER driver provides the infrastructure to support PCI +Express Advanced Error Reporting capability. The PCI Express AER +driver provides three basic functions: + +- Gathers the comprehensive error information if errors occurred. +- Reports error to the users. +- Performs error recovery actions. + +AER driver only attaches root ports which support PCI-Express AER +capability. + + +2. User Guide + +2.1 Include the PCI Express AER Root Driver into the Linux Kernel + +The PCI Express AER Root driver is a Root Port service driver attached +to the PCI Express Port Bus driver. If a user wants to use it, the driver +has to be compiled. Option CONFIG_PCIEAER supports this capability. It +depends on CONFIG_PCIEPORTBUS, so pls. set CONFIG_PCIEPORTBUS=y and +CONFIG_PCIEAER = y. + +2.2 Load PCI Express AER Root Driver +There is a case where a system has AER support in BIOS. Enabling the AER +Root driver and having AER support in BIOS may result unpredictable +behavior. To avoid this conflict, a successful load of the AER Root driver +requires ACPI _OSC support in the BIOS to allow the AER Root driver to +request for native control of AER. See the PCI FW 3.0 Specification for +details regarding OSC usage. Currently, lots of firmwares don't provide +_OSC support while they use PCI Express. To support such firmwares, +forceload, a parameter of type bool, could enable AER to continue to +be initiated although firmwares have no _OSC support. To enable the +walkaround, pls. add aerdriver.forceload=y to kernel boot parameter line +when booting kernel. Note that forceload=n by default. + +2.3 AER error output +When a PCI-E AER error is captured, an error message will be outputed to +console. If it's a correctable error, it is outputed as a warning. +Otherwise, it is printed as an error. So users could choose different +log level to filter out correctable error messages. + +Below shows an example. ++------ PCI-Express Device Error -----+ +Error Severity : Uncorrected (Fatal) +PCIE Bus Error type : Transaction Layer +Unsupported Request : First +Requester ID : 0500 +VendorID=8086h, DeviceID=0329h, Bus=05h, Device=00h, Function=00h +TLB Header: +04000001 00200a03 05010000 00050100 + +In the example, 'Requester ID' means the ID of the device who sends +the error message to root port. Pls. refer to pci express specs for +other fields. + + +3. Developer Guide + +To enable AER aware support requires a software driver to configure +the AER capability structure within its device and to provide callbacks. + +To support AER better, developers need understand how AER does work +firstly. + +PCI Express errors are classified into two types: correctable errors +and uncorrectable errors. This classification is based on the impacts +of those errors, which may result in degraded performance or function +failure. + +Correctable errors pose no impacts on the functionality of the +interface. The PCI Express protocol can recover without any software +intervention or any loss of data. These errors are detected and +corrected by hardware. Unlike correctable errors, uncorrectable +errors impact functionality of the interface. Uncorrectable errors +can cause a particular transaction or a particular PCI Express link +to be unreliable. Depending on those error conditions, uncorrectable +errors are further classified into non-fatal errors and fatal errors. +Non-fatal errors cause the particular transaction to be unreliable, +but the PCI Express link itself is fully functional. Fatal errors, on +the other hand, cause the link to be unreliable. + +When AER is enabled, a PCI Express device will automatically send an +error message to the PCIE root port above it when the device captures +an error. The Root Port, upon receiving an error reporting message, +internally processes and logs the error message in its PCI Express +capability structure. Error information being logged includes storing +the error reporting agent's requestor ID into the Error Source +Identification Registers and setting the error bits of the Root Error +Status Register accordingly. If AER error reporting is enabled in Root +Error Command Register, the Root Port generates an interrupt if an +error is detected. + +Note that the errors as described above are related to the PCI Express +hierarchy and links. These errors do not include any device specific +errors because device specific errors will still get sent directly to +the device driver. + +3.1 Configure the AER capability structure + +AER aware drivers of PCI Express component need change the device +control registers to enable AER. They also could change AER registers, +including mask and severity registers. Helper function +pci_enable_pcie_error_reporting could be used to enable AER. See +section 3.3. + +3.2. Provide callbacks + +3.2.1 callback reset_link to reset pci express link + +This callback is used to reset the pci express physical link when a +fatal error happens. The root port aer service driver provides a +default reset_link function, but different upstream ports might +have different specifications to reset pci express link, so all +upstream ports should provide their own reset_link functions. + +In struct pcie_port_service_driver, a new pointer, reset_link, is +added. + +pci_ers_result_t (*reset_link) (struct pci_dev *dev); + +Section 3.2.2.2 provides more detailed info on when to call +reset_link. + +3.2.2 PCI error-recovery callbacks + +The PCI Express AER Root driver uses error callbacks to coordinate +with downstream device drivers associated with a hierarchy in question +when performing error recovery actions. + +Data struct pci_driver has a pointer, err_handler, to point to +pci_error_handlers who consists of a couple of callback function +pointers. AER driver follows the rules defined in +pci-error-recovery.txt except pci express specific parts (e.g. +reset_link). Pls. refer to pci-error-recovery.txt for detailed +definitions of the callbacks. + +Below sections specify when to call the error callback functions. + +3.2.2.1 Correctable errors + +Correctable errors pose no impacts on the functionality of +the interface. The PCI Express protocol can recover without any +software intervention or any loss of data. These errors do not +require any recovery actions. The AER driver clears the device's +correctable error status register accordingly and logs these errors. + +3.2.2.2 Non-correctable (non-fatal and fatal) errors + +If an error message indicates a non-fatal error, performing link reset +at upstream is not required. The AER driver calls error_detected(dev, +pci_channel_io_normal) to all drivers associated within a hierarchy in +question. for example, +EndPoint<==>DownstreamPort B<==>UpstreamPort A<==>RootPort. +If Upstream port A captures an AER error, the hierarchy consists of +Downstream port B and EndPoint. + +A driver may return PCI_ERS_RESULT_CAN_RECOVER, +PCI_ERS_RESULT_DISCONNECT, or PCI_ERS_RESULT_NEED_RESET, depending on +whether it can recover or the AER driver calls mmio_enabled as next. + +If an error message indicates a fatal error, kernel will broadcast +error_detected(dev, pci_channel_io_frozen) to all drivers within +a hierarchy in question. Then, performing link reset at upstream is +necessary. As different kinds of devices might use different approaches +to reset link, AER port service driver is required to provide the +function to reset link. Firstly, kernel looks for if the upstream +component has an aer driver. If it has, kernel uses the reset_link +callback of the aer driver. If the upstream component has no aer driver +and the port is downstream port, we will use the aer driver of the +root port who reports the AER error. As for upstream ports, +they should provide their own aer service drivers with reset_link +function. If error_detected returns PCI_ERS_RESULT_CAN_RECOVER and +reset_link returns PCI_ERS_RESULT_RECOVERED, the error handling goes +to mmio_enabled. + +3.3 helper functions + +3.3.1 int pci_find_aer_capability(struct pci_dev *dev); +pci_find_aer_capability locates the PCI Express AER capability +in the device configuration space. If the device doesn't support +PCI-Express AER, the function returns 0. + +3.3.2 int pci_enable_pcie_error_reporting(struct pci_dev *dev); +pci_enable_pcie_error_reporting enables the device to send error +messages to root port when an error is detected. Note that devices +don't enable the error reporting by default, so device drivers need +call this function to enable it. + +3.3.3 int pci_disable_pcie_error_reporting(struct pci_dev *dev); +pci_disable_pcie_error_reporting disables the device to send error +messages to root port when an error is detected. + +3.3.4 int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); +pci_cleanup_aer_uncorrect_error_status cleanups the uncorrectable +error status register. + +3.4 Frequent Asked Questions + +Q: What happens if a PCI Express device driver does not provide an +error recovery handler (pci_driver->err_handler is equal to NULL)? + +A: The devices attached with the driver won't be recovered. If the +error is fatal, kernel will print out warning messages. Please refer +to section 3 for more information. + +Q: What happens if an upstream port service driver does not provide +callback reset_link? + +A: Fatal error recovery will fail if the errors are reported by the +upstream ports who are attached by the service driver. + +Q: How does this infrastructure deal with driver that is not PCI +Express aware? + +A: This infrastructure calls the error callback functions of the +driver when an error happens. But if the driver is not aware of +PCI Express, the device might not report its own errors to root +port. + +Q: What modifications will that driver need to make it compatible +with the PCI Express AER Root driver? + +A: It could call the helper functions to enable AER in devices and +cleanup uncorrectable status register. Pls. refer to section 3.3. + diff -r 61d1f2810617 -r 6591b4869889 arch/i386/kernel/io_apic-xen.c --- a/arch/i386/kernel/io_apic-xen.c Tue Nov 04 12:43:37 2008 +0900 +++ b/arch/i386/kernel/io_apic-xen.c Wed Nov 26 10:24:15 2008 +0900 @@ -1216,6 +1216,9 @@ int assign_irq_vector(int irq) BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); + if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS) + return -EINVAL; + spin_lock_irqsave(&vector_lock, flags); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { @@ -2567,8 +2570,10 @@ static int ioapic_resume(struct sys_devi static struct sysdev_class ioapic_sysdev_class = { set_kset_name("ioapic"), +#ifndef CONFIG_XEN .suspend = ioapic_suspend, .resume = ioapic_resume, +#endif }; static int __init ioapic_init_sysfs(void) diff -r 61d1f2810617 -r 6591b4869889 arch/i386/pci/irq.c --- a/arch/i386/pci/irq.c Tue Nov 04 12:43:37 2008 +0900 +++ b/arch/i386/pci/irq.c Wed Nov 26 10:24:15 2008 +0900 @@ -558,6 +558,15 @@ static __init int intel_router_probe(str r->set = pirq_piix_set; return 1; } + + if ((device >= PCI_DEVICE_ID_INTEL_PCH_LPC_MIN) && + (device <= PCI_DEVICE_ID_INTEL_PCH_LPC_MAX)) { + r->name = "PIIX/ICH"; + r->get = pirq_piix_get; + r->set = pirq_piix_set; + return 1; + } + return 0; } diff -r 61d1f2810617 -r 6591b4869889 arch/x86_64/kernel/io_apic-xen.c --- a/arch/x86_64/kernel/io_apic-xen.c Tue Nov 04 12:43:37 2008 +0900 +++ b/arch/x86_64/kernel/io_apic-xen.c Wed Nov 26 10:24:15 2008 +0900 @@ -895,6 +895,9 @@ int assign_irq_vector(int irq) BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS); + if (irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS) + return -EINVAL; + spin_lock_irqsave(&vector_lock, flags); if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) { @@ -2104,8 +2107,10 @@ static int ioapic_resume(struct sys_devi static struct sysdev_class ioapic_sysdev_class = { set_kset_name("ioapic"), +#ifndef CONFIG_XEN .suspend = ioapic_suspend, .resume = ioapic_resume, +#endif }; static int __init ioapic_init_sysfs(void) diff -r 61d1f2810617 -r 6591b4869889 drivers/i2c/busses/Kconfig --- a/drivers/i2c/busses/Kconfig Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/i2c/busses/Kconfig Wed Nov 26 10:24:15 2008 +0900 @@ -127,6 +127,7 @@ config I2C_I801 ICH8 ICH9 ICH10 + PCH This driver can also be built as a module. If so, the module will be called i2c-i801. diff -r 61d1f2810617 -r 6591b4869889 drivers/i2c/busses/i2c-i801.c --- a/drivers/i2c/busses/i2c-i801.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/i2c/busses/i2c-i801.c Wed Nov 26 10:24:15 2008 +0900 @@ -36,6 +36,7 @@ ICH9 2930 ICH10 3A30 ICH10 3A60 + PCH 3B30 This driver supports several versions of Intel's I/O Controller Hubs (ICH). For SMBus support, they are similar to the PIIX4 and are part of Intel's '810' and other chipsets. @@ -463,6 +464,7 @@ static struct pci_device_id i801_ids[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_6) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_4) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_5) }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PCH_SMBUS) }, { 0, } }; diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/msi-xen.c --- a/drivers/pci/msi-xen.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/pci/msi-xen.c Wed Nov 26 10:24:15 2008 +0900 @@ -48,6 +48,13 @@ struct msi_pirq_entry { struct list_head list; int pirq; int entry_nr; +#ifdef CONFIG_PM + /* PM save area for MSIX address/data */ + void __iomem *mask_base; + u32 address_hi_save; + u32 address_lo_save; + u32 data_save; +#endif }; static struct msi_dev_list *get_msi_dev_pirq_list(struct pci_dev *dev) @@ -83,7 +90,7 @@ static struct msi_dev_list *get_msi_dev_ return ret; } -static int attach_pirq_entry(int pirq, int entry_nr, +static int attach_pirq_entry(int pirq, int entry_nr, u64 table_base, struct msi_dev_list *msi_dev_entry) { struct msi_pirq_entry *entry = kmalloc(sizeof(*entry), GFP_ATOMIC); @@ -93,6 +100,9 @@ static int attach_pirq_entry(int pirq, i return -ENOMEM; entry->pirq = pirq; entry->entry_nr = entry_nr; +#ifdef COMFIG_PM + entry->mask_base = table_base; +#endif spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); list_add_tail(&entry->list, &msi_dev_entry->pirq_list_head); spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); @@ -299,104 +309,173 @@ static void enable_msi_mode(struct pci_d #ifdef CONFIG_PM int pci_save_msi_state(struct pci_dev *dev) { - int pos; + int pos, i = 0; + u16 control; + struct pci_cap_saved_state *save_state; + u32 *cap; pos = pci_find_capability(dev, PCI_CAP_ID_MSI); if (pos <= 0 || dev->no_msi) return 0; - if (!dev->msi_enabled) + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (!(control & PCI_MSI_FLAGS_ENABLE)) return 0; - /* Restore dev->irq to its default pin-assertion vector */ - msi_unmap_pirq(dev, dev->irq); - /* Disable MSI mode */ - disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); - /* Set the flags for use of restore */ - dev->msi_enabled = 1; + save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u32) * 5, + GFP_KERNEL); + if (!save_state) { + printk(KERN_ERR "Out of memory in pci_save_msi_state\n"); + return -ENOMEM; + } + cap = &save_state->data[0]; + + pci_read_config_dword(dev, pos, &cap[i++]); + control = cap[0] >> 16; + pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, &cap[i++]); + if (control & PCI_MSI_FLAGS_64BIT) { + pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, &cap[i++]); + pci_read_config_dword(dev, pos + PCI_MSI_DATA_64, &cap[i++]); + } else + pci_read_config_dword(dev, pos + PCI_MSI_DATA_32, &cap[i++]); + if (control & PCI_MSI_FLAGS_MASKBIT) + pci_read_config_dword(dev, pos + PCI_MSI_MASK_BIT, &cap[i++]); + save_state->cap_nr = PCI_CAP_ID_MSI; + pci_add_saved_cap(dev, save_state); return 0; } void pci_restore_msi_state(struct pci_dev *dev) { - int pos, pirq; - + int i = 0, pos; + u16 control; + struct pci_cap_saved_state *save_state; + u32 *cap; + + save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSI); pos = pci_find_capability(dev, PCI_CAP_ID_MSI); - if (pos <= 0) - return; - - if (!dev->msi_enabled) - return; - - pirq = msi_map_pirq_to_vector(dev, dev->irq, 0, 0); - if (pirq < 0) - return; + if (!save_state || pos <= 0) + return; + cap = &save_state->data[0]; + + control = cap[i++] >> 16; + pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, cap[i++]); + if (control & PCI_MSI_FLAGS_64BIT) { + pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, cap[i++]); + pci_write_config_dword(dev, pos + PCI_MSI_DATA_64, cap[i++]); + } else + pci_write_config_dword(dev, pos + PCI_MSI_DATA_32, cap[i++]); + if (control & PCI_MSI_FLAGS_MASKBIT) + pci_write_config_dword(dev, pos + PCI_MSI_MASK_BIT, cap[i++]); + pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); + pci_remove_saved_cap(save_state); + kfree(save_state); } int pci_save_msix_state(struct pci_dev *dev) { int pos; + u16 control; + struct pci_cap_saved_state *save_state; unsigned long flags; struct msi_dev_list *msi_dev_entry; - struct msi_pirq_entry *pirq_entry, *tmp; + struct msi_pirq_entry *pirq_entry; pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); if (pos <= 0 || dev->no_msi) return 0; + printk(KERN_CRIT "Saving MSIX cap\n"); + /* save the capability */ - if (!dev->msix_enabled) + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (!(control & PCI_MSIX_FLAGS_ENABLE)) return 0; + save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u16), + GFP_KERNEL); + if (!save_state) { + printk(KERN_ERR "Out of memory in pci_save_msix_state\n"); + return -ENOMEM; + } + *((u16 *)&save_state->data[0]) = control; msi_dev_entry = get_msi_dev_pirq_list(dev); spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - list_for_each_entry_safe(pirq_entry, tmp, - &msi_dev_entry->pirq_list_head, list) - msi_unmap_pirq(dev, pirq_entry->pirq); + list_for_each_entry(pirq_entry, &msi_dev_entry->pirq_list_head, list) { + int j; + void __iomem *base; + + /* save the table */ + base = pirq_entry->mask_base; + j = pirq_entry->entry_nr; + printk(KERN_CRIT "Save msix table entry %d pirq %x base %p\n", + j, pirq_entry->pirq, base); + + pirq_entry->address_lo_save = + readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + pirq_entry->address_hi_save = + readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); + pirq_entry->data_save = + readl(base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_DATA_OFFSET); + } spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); - disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); - /* Set the flags for use of restore */ - dev->msix_enabled = 1; - + save_state->cap_nr = PCI_CAP_ID_MSIX; + pci_add_saved_cap(dev, save_state); return 0; } void pci_restore_msix_state(struct pci_dev *dev) { - int pos; + u16 save; + int pos, j; + void __iomem *base; + struct pci_cap_saved_state *save_state; unsigned long flags; - u64 table_base; struct msi_dev_list *msi_dev_entry; - struct msi_pirq_entry *pirq_entry, *tmp; + struct msi_pirq_entry *pirq_entry; + + save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSIX); + if (!save_state) + return; + printk(KERN_CRIT "Restoring MSIX cap\n"); + + save = *((u16 *)&save_state->data[0]); + pci_remove_saved_cap(save_state); + kfree(save_state); pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); if (pos <= 0) return; - if (!dev->msix_enabled) - return; - msi_dev_entry = get_msi_dev_pirq_list(dev); - table_base = find_table_base(dev, pos); - if (!table_base) - return; spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - list_for_each_entry_safe(pirq_entry, tmp, - &msi_dev_entry->pirq_list_head, list) { - int rc = msi_map_pirq_to_vector(dev, pirq_entry->pirq, - pirq_entry->entry_nr, table_base); - if (rc < 0) - printk(KERN_WARNING - "%s: re-mapping irq #%d (pirq%d) failed: %d\n", - pci_name(dev), pirq_entry->entry_nr, - pirq_entry->pirq, rc); + list_for_each_entry(pirq_entry, &msi_dev_entry->pirq_list_head, list) { + /* route the table */ + base = pirq_entry->mask_base; + j = pirq_entry->entry_nr; + + printk(KERN_CRIT "Restore msix table entry %d pirq %x base %p\n", + j, pirq_entry->pirq, base); + writel(pirq_entry->address_lo_save, + base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + writel(pirq_entry->address_hi_save, + base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); + writel(pirq_entry->data_save, + base + j * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_DATA_OFFSET); } spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + pci_write_config_word(dev, msi_control_reg(pos), save); enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); } #endif @@ -475,7 +554,7 @@ static int msix_capability_init(struct p pirq = msi_map_vector(dev, entries[i].entry, table_base); if (pirq < 0) break; - attach_pirq_entry(pirq, entries[i].entry, msi_dev_entry); + attach_pirq_entry(pirq, entries[i].entry, table_base, msi_dev_entry); (entries + i)->vector = pirq; } @@ -660,7 +739,7 @@ int pci_enable_msix(struct pci_dev* dev, if (mapped) continue; irq = evtchn_map_pirq(-1, entries[i].vector); - attach_pirq_entry(irq, entries[i].entry, msi_dev_entry); + attach_pirq_entry(irq, entries[i].entry, 0, msi_dev_entry); entries[i].vector = irq; } return 0; diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/Kconfig --- a/drivers/pci/pcie/Kconfig Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/pci/pcie/Kconfig Wed Nov 26 10:24:15 2008 +0900 @@ -34,3 +34,4 @@ config HOTPLUG_PCI_PCIE_POLL_EVENT_MODE When in doubt, say N. +source "drivers/pci/pcie/aer/Kconfig" diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/Makefile --- a/drivers/pci/pcie/Makefile Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/pci/pcie/Makefile Wed Nov 26 10:24:15 2008 +0900 @@ -5,3 +5,6 @@ pcieportdrv-y := portdrv_core.o portdr pcieportdrv-y := portdrv_core.o portdrv_pci.o portdrv_bus.o obj-$(CONFIG_PCIEPORTBUS) += pcieportdrv.o + +# Build PCI Express AER if needed +obj-$(CONFIG_PCIEAER) += aer/ diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/aer/Kconfig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/Kconfig Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,12 @@ +# +# PCI Express Root Port Device AER Configuration +# + +config PCIEAER + boolean "Root Port Advanced Error Reporting support" + depends on PCIEPORTBUS && ACPI + default y + help + This enables PCI Express Root Port Advanced Error Reporting + (AER) driver support. Error reporting messages sent to Root + Port will be handled by PCI Express AER driver. diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/aer/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/Makefile Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,8 @@ +# +# Makefile for PCI-Express Root Port Advanced Error Reporting Driver +# + +obj-$(CONFIG_PCIEAER) += aerdriver.o + +aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o aerdrv_acpi.o + diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/aer/aerdrv.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv.c Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,346 @@ +/* + * drivers/pci/pcie/aer/aerdrv.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * This file implements the AER root port service driver. The driver will + * register an irq handler. When root port triggers an AER interrupt, the irq + * handler will collect root port status and schedule a work. + * + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "aerdrv.h" + +/* + * Version Information + */ +#define DRIVER_VERSION "v1.0" +#define DRIVER_AUTHOR "tom.l.nguyen@intel.com" +#define DRIVER_DESC "Root Port Advanced Error Reporting Driver" +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL"); + +static int __devinit aer_probe (struct pcie_device *dev, + const struct pcie_port_service_id *id ); +static void aer_remove(struct pcie_device *dev); +static int aer_suspend(struct pcie_device *dev, pm_message_t state) +{return 0;} +static int aer_resume(struct pcie_device *dev) {return 0;} +static pci_ers_result_t aer_error_detected(struct pci_dev *dev, + enum pci_channel_state error); +static void aer_error_resume(struct pci_dev *dev); +static pci_ers_result_t aer_root_reset(struct pci_dev *dev); + +/* + * PCI Express bus's AER Root service driver data structure + */ +static struct pcie_port_service_id aer_id[] = { + { + .vendor = PCI_ANY_ID, + .device = PCI_ANY_ID, + .port_type = PCIE_RC_PORT, + .service_type = PCIE_PORT_SERVICE_AER, + }, + { /* end: all zeroes */ } +}; + +static struct pci_error_handlers aer_error_handlers = { + .error_detected = aer_error_detected, + .resume = aer_error_resume, +}; + +static struct pcie_port_service_driver aerdrv = { + .name = "aer", + .id_table = &aer_id[0], + + .probe = aer_probe, + .remove = aer_remove, + + .suspend = aer_suspend, + .resume = aer_resume, + + .err_handler = &aer_error_handlers, + + .reset_link = aer_root_reset, +}; + +/** + * aer_irq - Root Port's ISR + * @irq: IRQ assigned to Root Port + * @context: pointer to Root Port data structure + * @r: pointer struct pt_regs + * + * Invoked when Root Port detects AER messages. + **/ +static irqreturn_t aer_irq(int irq, void *context, struct pt_regs * r) +{ + unsigned int status, id; + struct pcie_device *pdev = (struct pcie_device *)context; + struct aer_rpc *rpc = get_service_data(pdev); + int next_prod_idx; + unsigned long flags; + int pos; + + pos = pci_find_aer_capability(pdev->port); + /* + * Must lock access to Root Error Status Reg, Root Error ID Reg, + * and Root error producer/consumer index + */ + spin_lock_irqsave(&rpc->e_lock, flags); + + /* Read error status */ + pci_read_config_dword(pdev->port, pos + PCI_ERR_ROOT_STATUS, &status); + if (!(status & ROOT_ERR_STATUS_MASKS)) { + spin_unlock_irqrestore(&rpc->e_lock, flags); + return IRQ_NONE; + } + + /* Read error source and clear error status */ + pci_read_config_dword(pdev->port, pos + PCI_ERR_ROOT_COR_SRC, &id); + pci_write_config_dword(pdev->port, pos + PCI_ERR_ROOT_STATUS, status); + + /* Store error source for later DPC handler */ + next_prod_idx = rpc->prod_idx + 1; + if (next_prod_idx == AER_ERROR_SOURCES_MAX) + next_prod_idx = 0; + if (next_prod_idx == rpc->cons_idx) { + /* + * Error Storm Condition - possibly the same error occurred. + * Drop the error. + */ + spin_unlock_irqrestore(&rpc->e_lock, flags); + return IRQ_HANDLED; + } + rpc->e_sources[rpc->prod_idx].status = status; + rpc->e_sources[rpc->prod_idx].id = id; + rpc->prod_idx = next_prod_idx; + spin_unlock_irqrestore(&rpc->e_lock, flags); + + /* Invoke DPC handler */ + schedule_work(&rpc->dpc_handler); + + return IRQ_HANDLED; +} + +/** + * aer_alloc_rpc - allocate Root Port data structure + * @dev: pointer to the pcie_dev data structure + * + * Invoked when Root Port's AER service is loaded. + **/ +static struct aer_rpc* aer_alloc_rpc(struct pcie_device *dev) +{ + struct aer_rpc *rpc; + + if (!(rpc = (struct aer_rpc *)kmalloc(sizeof(struct aer_rpc), + GFP_KERNEL))) + return NULL; + + memset(rpc, 0, sizeof(struct aer_rpc)); + /* + * Initialize Root lock access, e_lock, to Root Error Status Reg, + * Root Error ID Reg, and Root error producer/consumer index. + */ + rpc->e_lock = SPIN_LOCK_UNLOCKED; + + rpc->rpd = dev; + INIT_WORK(&rpc->dpc_handler, aer_isr, (void *)dev); + rpc->prod_idx = rpc->cons_idx = 0; + mutex_init(&rpc->rpc_mutex); + init_waitqueue_head(&rpc->wait_release); + + /* Use PCIE bus function to store rpc into PCIE device */ + set_service_data(dev, rpc); + + return rpc; +} + +/** + * aer_remove - clean up resources + * @dev: pointer to the pcie_dev data structure + * + * Invoked when PCI Express bus unloads or AER probe fails. + **/ +static void aer_remove(struct pcie_device *dev) +{ + struct aer_rpc *rpc = get_service_data(dev); + + if (rpc) { + /* If register interrupt service, it must be free. */ + if (rpc->isr) + free_irq(dev->irq, dev); + + wait_event(rpc->wait_release, rpc->prod_idx == rpc->cons_idx); + + aer_delete_rootport(rpc); + set_service_data(dev, NULL); + } +} + +/** + * aer_probe - initialize resources + * @dev: pointer to the pcie_dev data structure + * @id: pointer to the service id data structure + * + * Invoked when PCI Express bus loads AER service driver. + **/ +static int __devinit aer_probe (struct pcie_device *dev, + const struct pcie_port_service_id *id ) +{ + int status; + struct aer_rpc *rpc; + struct device *device = &dev->device; + + /* Init */ + if ((status = aer_init(dev))) + return status; + + /* Alloc rpc data structure */ + if (!(rpc = aer_alloc_rpc(dev))) { + printk(KERN_DEBUG "%s: Alloc rpc fails on PCIE device[%s]\n", + __FUNCTION__, device->bus_id); + aer_remove(dev); + return -ENOMEM; + } + + /* Request IRQ ISR */ + if ((status = request_irq(dev->irq, aer_irq, SA_SHIRQ, "aerdrv", + dev))) { + printk(KERN_DEBUG "%s: Request ISR fails on PCIE device[%s]\n", + __FUNCTION__, device->bus_id); + aer_remove(dev); + return status; + } + + rpc->isr = 1; + + aer_enable_rootport(rpc); + + return status; +} + +/** + * aer_root_reset - reset link on Root Port + * @dev: pointer to Root Port's pci_dev data structure + * + * Invoked by Port Bus driver when performing link reset at Root Port. + **/ +static pci_ers_result_t aer_root_reset(struct pci_dev *dev) +{ + u16 p2p_ctrl; + u32 status; + int pos; + + pos = pci_find_aer_capability(dev); + + /* Disable Root's interrupt in response to error messages */ + pci_write_config_dword(dev, pos + PCI_ERR_ROOT_COMMAND, 0); + + /* Assert Secondary Bus Reset */ + pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &p2p_ctrl); + p2p_ctrl |= PCI_CB_BRIDGE_CTL_CB_RESET; + pci_write_config_word(dev, PCI_BRIDGE_CONTROL, p2p_ctrl); + + /* De-assert Secondary Bus Reset */ + p2p_ctrl &= ~PCI_CB_BRIDGE_CTL_CB_RESET; + pci_write_config_word(dev, PCI_BRIDGE_CONTROL, p2p_ctrl); + + /* + * System software must wait for at least 100ms from the end + * of a reset of one or more device before it is permitted + * to issue Configuration Requests to those devices. + */ + msleep(200); + printk(KERN_DEBUG "Complete link reset at Root[%s]\n", dev->dev.bus_id); + + /* Enable Root Port's interrupt in response to error messages */ + pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, &status); + pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, status); + pci_write_config_dword(dev, + pos + PCI_ERR_ROOT_COMMAND, + ROOT_PORT_INTR_ON_MESG_MASK); + + return PCI_ERS_RESULT_RECOVERED; +} + +/** + * aer_error_detected - update severity status + * @dev: pointer to Root Port's pci_dev data structure + * @error: error severity being notified by port bus + * + * Invoked by Port Bus driver during error recovery. + **/ +static pci_ers_result_t aer_error_detected(struct pci_dev *dev, + enum pci_channel_state error) +{ + /* Root Port has no impact. Always recovers. */ + return PCI_ERS_RESULT_CAN_RECOVER; +} + +/** + * aer_error_resume - clean up corresponding error status bits + * @dev: pointer to Root Port's pci_dev data structure + * + * Invoked by Port Bus driver during nonfatal recovery. + **/ +static void aer_error_resume(struct pci_dev *dev) +{ + int pos; + u32 status, mask; + u16 reg16; + + /* Clean up Root device status */ + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, ®16); + pci_write_config_word(dev, pos + PCI_EXP_DEVSTA, reg16); + + /* Clean AER Root Error Status */ + pos = pci_find_aer_capability(dev); + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status); + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, &mask); + if (dev->error_state == pci_channel_io_normal) + status &= ~mask; /* Clear corresponding nonfatal bits */ + else + status &= mask; /* Clear corresponding fatal bits */ + pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); +} + +/** + * aer_service_init - register AER root service driver + * + * Invoked when AER root service driver is loaded. + **/ +static int __init aer_service_init(void) +{ + return pcie_port_service_register(&aerdrv); +} + +/** + * aer_service_exit - unregister AER root service driver + * + * Invoked when AER root service driver is unloaded. + **/ +static void __exit aer_service_exit(void) +{ + pcie_port_service_unregister(&aerdrv); +} + +module_init(aer_service_init); +module_exit(aer_service_exit); diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/aer/aerdrv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv.h Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#ifndef _AERDRV_H_ +#define _AERDRV_H_ + +#include +#include + +#define AER_NONFATAL 0 +#define AER_FATAL 1 +#define AER_CORRECTABLE 2 +#define AER_UNCORRECTABLE 4 +#define AER_ERROR_MASK 0x001fffff +#define AER_ERROR(d) (d & AER_ERROR_MASK) + +#define OSC_METHOD_RUN_SUCCESS 0 +#define OSC_METHOD_NOT_SUPPORTED 1 +#define OSC_METHOD_RUN_FAILURE 2 + +/* Root Error Status Register Bits */ +#define ROOT_ERR_STATUS_MASKS 0x0f + +#define SYSTEM_ERROR_INTR_ON_MESG_MASK (PCI_EXP_RTCTL_SECEE| \ + PCI_EXP_RTCTL_SENFEE| \ + PCI_EXP_RTCTL_SEFEE) +#define ROOT_PORT_INTR_ON_MESG_MASK (PCI_ERR_ROOT_CMD_COR_EN| \ + PCI_ERR_ROOT_CMD_NONFATAL_EN| \ + PCI_ERR_ROOT_CMD_FATAL_EN) +#define ERR_COR_ID(d) (d & 0xffff) +#define ERR_UNCOR_ID(d) (d >> 16) + +#define AER_SUCCESS 0 +#define AER_UNSUCCESS 1 +#define AER_ERROR_SOURCES_MAX 100 + +#define AER_LOG_TLP_MASKS (PCI_ERR_UNC_POISON_TLP| \ + PCI_ERR_UNC_ECRC| \ + PCI_ERR_UNC_UNSUP| \ + PCI_ERR_UNC_COMP_ABORT| \ + PCI_ERR_UNC_UNX_COMP| \ + PCI_ERR_UNC_MALF_TLP) + +/* AER Error Info Flags */ +#define AER_TLP_HEADER_VALID_FLAG 0x00000001 +#define AER_MULTI_ERROR_VALID_FLAG 0x00000002 + +#define ERR_CORRECTABLE_ERROR_MASK 0x000031c1 +#define ERR_UNCORRECTABLE_ERROR_MASK 0x001ff010 + +struct header_log_regs { + unsigned int dw0; + unsigned int dw1; + unsigned int dw2; + unsigned int dw3; +}; + +struct aer_err_info { + int severity; /* 0:NONFATAL | 1:FATAL | 2:COR */ + int flags; + unsigned int status; /* COR/UNCOR Error Status */ + struct header_log_regs tlp; /* TLP Header */ +}; + +struct aer_err_source { + unsigned int status; + unsigned int id; +}; + +struct aer_rpc { + struct pcie_device *rpd; /* Root Port device */ + struct work_struct dpc_handler; + struct aer_err_source e_sources[AER_ERROR_SOURCES_MAX]; + unsigned short prod_idx; /* Error Producer Index */ + unsigned short cons_idx; /* Error Consumer Index */ + int isr; + spinlock_t e_lock; /* + * Lock access to Error Status/ID Regs + * and error producer/consumer index + */ + struct mutex rpc_mutex; /* + * only one thread could do + * recovery on the same + * root port hierachy + */ + wait_queue_head_t wait_release; +}; + +struct aer_broadcast_data { + enum pci_channel_state state; + enum pci_ers_result result; +}; + +static inline pci_ers_result_t merge_result(enum pci_ers_result orig, + enum pci_ers_result new) +{ + switch (orig) { + case PCI_ERS_RESULT_CAN_RECOVER: + case PCI_ERS_RESULT_RECOVERED: + orig = new; + break; + case PCI_ERS_RESULT_DISCONNECT: + if (new == PCI_ERS_RESULT_NEED_RESET) + orig = new; + break; + default: + break; + } + + return orig; +} + +extern struct bus_type pcie_port_bus_type; +extern void aer_enable_rootport(struct aer_rpc *rpc); +extern void aer_delete_rootport(struct aer_rpc *rpc); +extern int aer_init(struct pcie_device *dev); +extern void aer_isr(void *context); +extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); +extern int aer_osc_setup(struct pci_dev *dev); + +#endif //_AERDRV_H_ diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/aer/aerdrv_acpi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,68 @@ +/* + * Access ACPI _OSC method + * + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "aerdrv.h" + +/** + * aer_osc_setup - run ACPI _OSC method + * + * Return: + * Zero if success. Nonzero for otherwise. + * + * Invoked when PCIE bus loads AER service driver. To avoid conflict with + * BIOS AER support requires BIOS to yield AER control to OS native driver. + **/ +int aer_osc_setup(struct pci_dev *dev) +{ + int retval = OSC_METHOD_RUN_SUCCESS; + acpi_status status; + acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); + struct pci_dev *pdev = dev; + struct pci_bus *parent; + + while (!handle) { + if (!pdev || !pdev->bus->parent) + break; + parent = pdev->bus->parent; + if (!parent->self) + /* Parent must be a host bridge */ + handle = acpi_get_pci_rootbridge_handle( + pci_domain_nr(parent), + parent->number); + else + handle = DEVICE_ACPI_HANDLE( + &(parent->self->dev)); + pdev = parent->self; + } + + if (!handle) + return OSC_METHOD_NOT_SUPPORTED; + + pci_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT); + status = pci_osc_control_set(handle, OSC_PCI_EXPRESS_AER_CONTROL | + OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); + if (ACPI_FAILURE(status)) { + if (status == AE_SUPPORT) + retval = OSC_METHOD_NOT_SUPPORTED; + else + retval = OSC_METHOD_RUN_FAILURE; + } + + return retval; +} + diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/aer/aerdrv_core.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv_core.c Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,757 @@ +/* + * drivers/pci/pcie/aer/aerdrv_core.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * This file implements the core part of PCI-Express AER. When an pci-express + * error is delivered, an error message will be collected and printed to + * console, then, an error recovery procedure will be executed by following + * the pci error recovery rules. + * + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "aerdrv.h" + +static int forceload; +module_param(forceload, bool, 0); + +#define PCI_CFG_SPACE_SIZE (0x100) +int pci_find_aer_capability(struct pci_dev *dev) +{ + int pos; + u32 reg32 = 0; + + /* Check if it's a pci-express device */ + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return 0; + + /* Check if it supports pci-express AER */ + pos = PCI_CFG_SPACE_SIZE; + while (pos) { + if (pci_read_config_dword(dev, pos, ®32)) + return 0; + + /* some broken boards return ~0 */ + if (reg32 == 0xffffffff) + return 0; + + if (PCI_EXT_CAP_ID(reg32) == PCI_EXT_CAP_ID_ERR) + break; + + pos = reg32 >> 20; + } + + return pos; +} + +int pci_enable_pcie_error_reporting(struct pci_dev *dev) +{ + u16 reg16 = 0; + int pos; + + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return -EIO; + + pci_read_config_word(dev, pos+PCI_EXP_DEVCTL, ®16); + reg16 = reg16 | + PCI_EXP_DEVCTL_CERE | + PCI_EXP_DEVCTL_NFERE | + PCI_EXP_DEVCTL_FERE | + PCI_EXP_DEVCTL_URRE; + pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, + reg16); + return 0; +} + +int pci_disable_pcie_error_reporting(struct pci_dev *dev) +{ + u16 reg16 = 0; + int pos; + + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return -EIO; + + pci_read_config_word(dev, pos+PCI_EXP_DEVCTL, ®16); + reg16 = reg16 & ~(PCI_EXP_DEVCTL_CERE | + PCI_EXP_DEVCTL_NFERE | + PCI_EXP_DEVCTL_FERE | + PCI_EXP_DEVCTL_URRE); + pci_write_config_word(dev, pos+PCI_EXP_DEVCTL, + reg16); + return 0; +} + +int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) +{ + int pos; + u32 status, mask; + + pos = pci_find_aer_capability(dev); + if (!pos) + return -EIO; + + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status); + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, &mask); + if (dev->error_state == pci_channel_io_normal) + status &= ~mask; /* Clear corresponding nonfatal bits */ + else + status &= mask; /* Clear corresponding fatal bits */ + pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); + + return 0; +} + +static int find_device_iter(struct device *device, void *data) +{ + struct pci_dev *dev; + u16 id = *(unsigned long *)data; + u8 secondary, subordinate, d_bus = id >> 8; + + if (device->bus == &pci_bus_type) { + dev = to_pci_dev(device); + if (id == ((dev->bus->number << 8) | dev->devfn)) { + /* + * Device ID match + */ + *(unsigned long*)data = (unsigned long)device; + return 1; + } + + /* + * If device is P2P, check if it is an upstream? + */ + if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE) { + pci_read_config_byte(dev, PCI_SECONDARY_BUS, + &secondary); + pci_read_config_byte(dev, PCI_SUBORDINATE_BUS, + &subordinate); + if (d_bus >= secondary && d_bus <= subordinate) { + *(unsigned long*)data = (unsigned long)device; + return 1; + } + } + } + + return 0; +} + +/** + * find_source_device - search through device hierarchy for source device + * @p_dev: pointer to Root Port pci_dev data structure + * @id: device ID of agent who sends an error message to this Root Port + * + * Invoked when error is detected at the Root Port. + **/ +static struct device* find_source_device(struct pci_dev *parent, u16 id) +{ + struct pci_dev *dev = parent; + struct device *device; + unsigned long device_addr; + int status; + + /* Is Root Port an agent that sends error message? */ + if (id == ((dev->bus->number << 8) | dev->devfn)) + return &dev->dev; + + do { + device_addr = id; + if ((status = device_for_each_child(&dev->dev, + &device_addr, find_device_iter))) { + device = (struct device*)device_addr; + dev = to_pci_dev(device); + if (id == ((dev->bus->number << 8) | dev->devfn)) + return device; + } + }while (status); + + return NULL; +} + +static void report_error_detected(struct pci_dev *dev, void *data) +{ + pci_ers_result_t vote; + struct pci_error_handlers *err_handler; + struct aer_broadcast_data *result_data; + result_data = (struct aer_broadcast_data *) data; + + dev->error_state = result_data->state; + + if (!dev->driver || + !dev->driver->err_handler || + !dev->driver->err_handler->error_detected) { + if (result_data->state == pci_channel_io_frozen && + !(dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)) { + /* + * In case of fatal recovery, if one of down- + * stream device has no driver. We might be + * unable to recover because a later insmod + * of a driver for this device is unaware of + * its hw state. + */ + printk(KERN_DEBUG "Device ID[%s] has %s\n", + dev->dev.bus_id, (dev->driver) ? + "no AER-aware driver" : "no driver"); + } + return; + } + + err_handler = dev->driver->err_handler; + vote = err_handler->error_detected(dev, result_data->state); + result_data->result = merge_result(result_data->result, vote); + return; +} + +static void report_mmio_enabled(struct pci_dev *dev, void *data) +{ + pci_ers_result_t vote; + struct pci_error_handlers *err_handler; + struct aer_broadcast_data *result_data; + result_data = (struct aer_broadcast_data *) data; + + if (!dev->driver || + !dev->driver->err_handler || + !dev->driver->err_handler->mmio_enabled) + return; + + err_handler = dev->driver->err_handler; + vote = err_handler->mmio_enabled(dev); + result_data->result = merge_result(result_data->result, vote); + return; +} + +static void report_slot_reset(struct pci_dev *dev, void *data) +{ + pci_ers_result_t vote; + struct pci_error_handlers *err_handler; + struct aer_broadcast_data *result_data; + result_data = (struct aer_broadcast_data *) data; + + if (!dev->driver || + !dev->driver->err_handler || + !dev->driver->err_handler->slot_reset) + return; + + err_handler = dev->driver->err_handler; + vote = err_handler->slot_reset(dev); + result_data->result = merge_result(result_data->result, vote); + return; +} + +static void report_resume(struct pci_dev *dev, void *data) +{ + struct pci_error_handlers *err_handler; + + dev->error_state = pci_channel_io_normal; + + if (!dev->driver || + !dev->driver->err_handler || + !dev->driver->err_handler->resume) + return; + + err_handler = dev->driver->err_handler; + err_handler->resume(dev); + return; +} + +/** + * broadcast_error_message - handle message broadcast to downstream drivers + * @device: pointer to from where in a hierarchy message is broadcasted down + * @api: callback to be broadcasted + * @state: error state + * + * Invoked during error recovery process. Once being invoked, the content + * of error severity will be broadcasted to all downstream drivers in a + * hierarchy in question. + **/ +static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, + enum pci_channel_state state, + char *error_mesg, + void (*cb)(struct pci_dev *, void *)) +{ + struct aer_broadcast_data result_data; + + printk(KERN_DEBUG "Broadcast %s message\n", error_mesg); + result_data.state = state; + if (cb == report_error_detected) + result_data.result = PCI_ERS_RESULT_CAN_RECOVER; + else + result_data.result = PCI_ERS_RESULT_RECOVERED; + + if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE) { + /* + * If the error is reported by a bridge, we think this error + * is related to the downstream link of the bridge, so we + * do error recovery on all subordinates of the bridge instead + * of the bridge and clear the error status of the bridge. + */ + if (cb == report_error_detected) + dev->error_state = state; + pci_walk_bus(dev->subordinate, cb, &result_data); + if (cb == report_resume) { + pci_cleanup_aer_uncorrect_error_status(dev); + dev->error_state = pci_channel_io_normal; + } + } + else { + /* + * If the error is reported by an end point, we think this + * error is related to the upstream link of the end point. + */ + pci_walk_bus(dev->bus, cb, &result_data); + } + + return result_data.result; +} + +struct find_aer_service_data { + struct pcie_port_service_driver *aer_driver; + int is_downstream; +}; + +static int find_aer_service_iter(struct device *device, void *data) +{ + struct device_driver *driver; + struct pcie_port_service_driver *service_driver; + struct pcie_device *pcie_dev; + struct find_aer_service_data *result; + + result = (struct find_aer_service_data *) data; + + if (device->bus == &pcie_port_bus_type) { + pcie_dev = to_pcie_device(device); + if (pcie_dev->id.port_type == PCIE_SW_DOWNSTREAM_PORT) + result->is_downstream = 1; + + driver = device->driver; + if (driver) { + service_driver = to_service_driver(driver); + if (service_driver->id_table->service_type == + PCIE_PORT_SERVICE_AER) { + result->aer_driver = service_driver; + return 1; + } + } + } + + return 0; +} + +static void find_aer_service(struct pci_dev *dev, + struct find_aer_service_data *data) +{ + device_for_each_child(&dev->dev, data, find_aer_service_iter); +} + +static pci_ers_result_t reset_link(struct pcie_device *aerdev, + struct pci_dev *dev) +{ + struct pci_dev *udev; + pci_ers_result_t status; + struct find_aer_service_data data; + + if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE) + udev = dev; + else + udev= dev->bus->self; + + data.is_downstream = 0; + data.aer_driver = NULL; + find_aer_service(udev, &data); + + /* + * Use the aer driver of the error agent firstly. + * If it hasn't the aer driver, use the root port's + */ + if (!data.aer_driver || !data.aer_driver->reset_link) { + if (data.is_downstream && + aerdev->device.driver && + to_service_driver(aerdev->device.driver)->reset_link) { + data.aer_driver = + to_service_driver(aerdev->device.driver); + } else { + printk(KERN_DEBUG "No link-reset support to Device ID" + "[%s]\n", + dev->dev.bus_id); + return PCI_ERS_RESULT_DISCONNECT; + } + } + + status = data.aer_driver->reset_link(udev); + if (status != PCI_ERS_RESULT_RECOVERED) { + printk(KERN_DEBUG "Link reset at upstream Device ID" + "[%s] failed\n", + udev->dev.bus_id); + return PCI_ERS_RESULT_DISCONNECT; + } + + return status; +} + +/** + * do_recovery - handle nonfatal/fatal error recovery process + * @aerdev: pointer to a pcie_device data structure of root port + * @dev: pointer to a pci_dev data structure of agent detecting an error + * @severity: error severity type + * + * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast + * error detected message to all downstream drivers within a hierarchy in + * question and return the returned code. + **/ +static pci_ers_result_t do_recovery(struct pcie_device *aerdev, + struct pci_dev *dev, + int severity) +{ + pci_ers_result_t status, result = PCI_ERS_RESULT_RECOVERED; + enum pci_channel_state state; + + if (severity == AER_FATAL) + state = pci_channel_io_frozen; + else + state = pci_channel_io_normal; + + status = broadcast_error_message(dev, + state, + "error_detected", + report_error_detected); + + if (severity == AER_FATAL) { + result = reset_link(aerdev, dev); + if (result != PCI_ERS_RESULT_RECOVERED) { + /* TODO: Should panic here? */ + return result; + } + } + + if (status == PCI_ERS_RESULT_CAN_RECOVER) + status = broadcast_error_message(dev, + state, + "mmio_enabled", + report_mmio_enabled); + + if (status == PCI_ERS_RESULT_NEED_RESET) { + /* + * TODO: Should call platform-specific + * functions to reset slot before calling + * drivers' slot_reset callbacks? + */ + status = broadcast_error_message(dev, + state, + "slot_reset", + report_slot_reset); + } + + if (status == PCI_ERS_RESULT_RECOVERED) + broadcast_error_message(dev, + state, + "resume", + report_resume); + + return status; +} + +/** + * handle_error_source - handle logging error into an event log + * @aerdev: pointer to pcie_device data structure of the root port + * @dev: pointer to pci_dev data structure of error source device + * @info: comprehensive error information + * + * Invoked when an error being detected by Root Port. + **/ +static void handle_error_source(struct pcie_device * aerdev, + struct pci_dev *dev, + struct aer_err_info info) +{ + pci_ers_result_t status = 0; + int pos; + + if (info.severity == AER_CORRECTABLE) { + /* + * Correctable error does not need software intevention. + * No need to go through error recovery process. + */ + pos = pci_find_aer_capability(dev); + if (pos) + pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS, + info.status); + } else { + status = do_recovery(aerdev, dev, info.severity); + if (status == PCI_ERS_RESULT_RECOVERED) { + printk(KERN_DEBUG "AER driver successfully recovered\n"); + } else { + /* TODO: Should kernel panic here? */ + printk(KERN_DEBUG "AER driver didn't recover\n"); + } + } +} + +/** + * aer_enable_rootport - enable Root Port's interrupts when receiving messages + * @rpc: pointer to a Root Port data structure + * + * Invoked when PCIE bus loads AER service driver. + **/ +void aer_enable_rootport(struct aer_rpc *rpc) +{ + struct pci_dev *pdev = rpc->rpd->port; + int pos, aer_pos; + u16 reg16; + u32 reg32; + + pos = pci_find_capability(pdev, PCI_CAP_ID_EXP); + /* Clear PCIE Capability's Device Status */ + pci_read_config_word(pdev, pos+PCI_EXP_DEVSTA, ®16); + pci_write_config_word(pdev, pos+PCI_EXP_DEVSTA, reg16); + + /* Disable system error generation in response to error messages */ + pci_read_config_word(pdev, pos + PCI_EXP_RTCTL, ®16); + reg16 &= ~(SYSTEM_ERROR_INTR_ON_MESG_MASK); + pci_write_config_word(pdev, pos + PCI_EXP_RTCTL, reg16); + + aer_pos = pci_find_aer_capability(pdev); + /* Clear error status */ + pci_read_config_dword(pdev, aer_pos + PCI_ERR_ROOT_STATUS, ®32); + pci_write_config_dword(pdev, aer_pos + PCI_ERR_ROOT_STATUS, reg32); + pci_read_config_dword(pdev, aer_pos + PCI_ERR_COR_STATUS, ®32); + pci_write_config_dword(pdev, aer_pos + PCI_ERR_COR_STATUS, reg32); + pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, ®32); + pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32); + + /* Enable Root Port device reporting error itself */ + pci_read_config_word(pdev, pos+PCI_EXP_DEVCTL, ®16); + reg16 = reg16 | + PCI_EXP_DEVCTL_CERE | + PCI_EXP_DEVCTL_NFERE | + PCI_EXP_DEVCTL_FERE | + PCI_EXP_DEVCTL_URRE; + pci_write_config_word(pdev, pos+PCI_EXP_DEVCTL, + reg16); + + /* Enable Root Port's interrupt in response to error messages */ + pci_write_config_dword(pdev, + aer_pos + PCI_ERR_ROOT_COMMAND, + ROOT_PORT_INTR_ON_MESG_MASK); +} + +/** + * disable_root_aer - disable Root Port's interrupts when receiving messages + * @rpc: pointer to a Root Port data structure + * + * Invoked when PCIE bus unloads AER service driver. + **/ +static void disable_root_aer(struct aer_rpc *rpc) +{ + struct pci_dev *pdev = rpc->rpd->port; + u32 reg32; + int pos; + + pos = pci_find_aer_capability(pdev); + /* Disable Root's interrupt in response to error messages */ + pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_COMMAND, 0); + + /* Clear Root's error status reg */ + pci_read_config_dword(pdev, pos + PCI_ERR_ROOT_STATUS, ®32); + pci_write_config_dword(pdev, pos + PCI_ERR_ROOT_STATUS, reg32); +} + +/** + * get_e_source - retrieve an error source + * @rpc: pointer to the root port which holds an error + * + * Invoked by DPC handler to consume an error. + **/ +static struct aer_err_source* get_e_source(struct aer_rpc *rpc) +{ + struct aer_err_source *e_source; + unsigned long flags; + + /* Lock access to Root error producer/consumer index */ + spin_lock_irqsave(&rpc->e_lock, flags); + if (rpc->prod_idx == rpc->cons_idx) { + spin_unlock_irqrestore(&rpc->e_lock, flags); + return NULL; + } + e_source = &rpc->e_sources[rpc->cons_idx]; + rpc->cons_idx++; + if (rpc->cons_idx == AER_ERROR_SOURCES_MAX) + rpc->cons_idx = 0; + spin_unlock_irqrestore(&rpc->e_lock, flags); + + return e_source; +} + +static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) +{ + int pos; + + pos = pci_find_aer_capability(dev); + + /* The device might not support AER */ + if (!pos) + return AER_SUCCESS; + + if (info->severity == AER_CORRECTABLE) { + pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, + &info->status); + if (!(info->status & ERR_CORRECTABLE_ERROR_MASK)) + return AER_UNSUCCESS; + } else if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE || + info->severity == AER_NONFATAL) { + + /* Link is still healthy for IO reads */ + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, + &info->status); + if (!(info->status & ERR_UNCORRECTABLE_ERROR_MASK)) + return AER_UNSUCCESS; + + if (info->status & AER_LOG_TLP_MASKS) { + info->flags |= AER_TLP_HEADER_VALID_FLAG; + pci_read_config_dword(dev, + pos + PCI_ERR_HEADER_LOG, &info->tlp.dw0); + pci_read_config_dword(dev, + pos + PCI_ERR_HEADER_LOG + 4, &info->tlp.dw1); + pci_read_config_dword(dev, + pos + PCI_ERR_HEADER_LOG + 8, &info->tlp.dw2); + pci_read_config_dword(dev, + pos + PCI_ERR_HEADER_LOG + 12, &info->tlp.dw3); + } + } + + return AER_SUCCESS; +} + +/** + * aer_isr_one_error - consume an error detected by root port + * @p_device: pointer to error root port service device + * @e_src: pointer to an error source + **/ +static void aer_isr_one_error(struct pcie_device *p_device, + struct aer_err_source *e_src) +{ + struct device *s_device; + struct aer_err_info e_info = {0, 0, 0,}; + int i; + u16 id; + + /* + * There is a possibility that both correctable error and + * uncorrectable error being logged. Report correctable error first. + */ + for (i = 1; i & ROOT_ERR_STATUS_MASKS ; i <<= 2) { + if (i > 4) + break; + if (!(e_src->status & i)) + continue; + + /* Init comprehensive error information */ + if (i & PCI_ERR_ROOT_COR_RCV) { + id = ERR_COR_ID(e_src->id); + e_info.severity = AER_CORRECTABLE; + } else { + id = ERR_UNCOR_ID(e_src->id); + e_info.severity = ((e_src->status >> 6) & 1); + } + if (e_src->status & + (PCI_ERR_ROOT_MULTI_COR_RCV | + PCI_ERR_ROOT_MULTI_UNCOR_RCV)) + e_info.flags |= AER_MULTI_ERROR_VALID_FLAG; + if (!(s_device = find_source_device(p_device->port, id))) { + printk(KERN_DEBUG "%s->can't find device of ID%04x\n", + __FUNCTION__, id); + continue; + } + if (get_device_error_info(to_pci_dev(s_device), &e_info) == + AER_SUCCESS) { + aer_print_error(to_pci_dev(s_device), &e_info); + handle_error_source(p_device, + to_pci_dev(s_device), + e_info); + } + } +} + +/** + * aer_isr - consume errors detected by root port + * @context: pointer to a private data of pcie device + * + * Invoked, as DPC, when root port records new detected error + **/ +void aer_isr(void *context) +{ + struct pcie_device *p_device = (struct pcie_device *) context; + struct aer_rpc *rpc = get_service_data(p_device); + struct aer_err_source *e_src; + + mutex_lock(&rpc->rpc_mutex); + e_src = get_e_source(rpc); + while (e_src) { + aer_isr_one_error(p_device, e_src); + e_src = get_e_source(rpc); + } + mutex_unlock(&rpc->rpc_mutex); + + wake_up(&rpc->wait_release); +} + +/** + * aer_delete_rootport - disable root port aer and delete service data + * @rpc: pointer to a root port device being deleted + * + * Invoked when AER service unloaded on a specific Root Port + **/ +void aer_delete_rootport(struct aer_rpc *rpc) +{ + /* Disable root port AER itself */ + disable_root_aer(rpc); + + kfree(rpc); +} + +/** + * aer_init - provide AER initialization + * @dev: pointer to AER pcie device + * + * Invoked when AER service driver is loaded. + **/ +int aer_init(struct pcie_device *dev) +{ + int status; + + /* Run _OSC Method */ + status = aer_osc_setup(dev->port); + + if(status != OSC_METHOD_RUN_SUCCESS) { + printk(KERN_DEBUG "%s: AER service init fails - %s\n", + __FUNCTION__, + (status == OSC_METHOD_NOT_SUPPORTED) ? + "No ACPI _OSC support" : "Run ACPI _OSC fails"); + + if (!forceload) + return status; + } + + return AER_SUCCESS; +} + +EXPORT_SYMBOL_GPL(pci_find_aer_capability); +EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting); +EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting); +EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); + diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/aer/aerdrv_errprint.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,248 @@ +/* + * drivers/pci/pcie/aer/aerdrv_errprint.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Format error messages and print them to console. + * + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + * + */ + +#include +#include +#include +#include +#include +#include + +#include "aerdrv.h" + +#define AER_AGENT_RECEIVER 0 +#define AER_AGENT_REQUESTER 1 +#define AER_AGENT_COMPLETER 2 +#define AER_AGENT_TRANSMITTER 3 + +#define AER_AGENT_REQUESTER_MASK (PCI_ERR_UNC_COMP_TIME| \ + PCI_ERR_UNC_UNSUP) + +#define AER_AGENT_COMPLETER_MASK PCI_ERR_UNC_COMP_ABORT + +#define AER_AGENT_TRANSMITTER_MASK(t, e) (e & (PCI_ERR_COR_REP_ROLL| \ + ((t == AER_CORRECTABLE) ? PCI_ERR_COR_REP_TIMER: 0))) + +#define AER_GET_AGENT(t, e) \ + ((e & AER_AGENT_COMPLETER_MASK) ? AER_AGENT_COMPLETER : \ + (e & AER_AGENT_REQUESTER_MASK) ? AER_AGENT_REQUESTER : \ + (AER_AGENT_TRANSMITTER_MASK(t, e)) ? AER_AGENT_TRANSMITTER : \ + AER_AGENT_RECEIVER) + +#define AER_PHYSICAL_LAYER_ERROR_MASK PCI_ERR_COR_RCVR +#define AER_DATA_LINK_LAYER_ERROR_MASK(t, e) \ + (PCI_ERR_UNC_DLP| \ + PCI_ERR_COR_BAD_TLP| \ + PCI_ERR_COR_BAD_DLLP| \ + PCI_ERR_COR_REP_ROLL| \ + ((t == AER_CORRECTABLE) ? \ + PCI_ERR_COR_REP_TIMER: 0)) + +#define AER_PHYSICAL_LAYER_ERROR 0 +#define AER_DATA_LINK_LAYER_ERROR 1 +#define AER_TRANSACTION_LAYER_ERROR 2 + +#define AER_GET_LAYER_ERROR(t, e) \ + ((e & AER_PHYSICAL_LAYER_ERROR_MASK) ? \ + AER_PHYSICAL_LAYER_ERROR : \ + (e & AER_DATA_LINK_LAYER_ERROR_MASK(t, e)) ? \ + AER_DATA_LINK_LAYER_ERROR : \ + AER_TRANSACTION_LAYER_ERROR) + +/* + * AER error strings + */ +static char* aer_error_severity_string[] = { + "Uncorrected (Non-Fatal)", + "Uncorrected (Fatal)", + "Corrected" +}; + +static char* aer_error_layer[] = { + "Physical Layer", + "Data Link Layer", + "Transaction Layer" +}; +static char* aer_correctable_error_string[] = { + "Receiver Error ", /* Bit Position 0 */ + NULL, + NULL, + NULL, + NULL, + NULL, + "Bad TLP ", /* Bit Position 6 */ + "Bad DLLP ", /* Bit Position 7 */ + "RELAY_NUM Rollover ", /* Bit Position 8 */ + NULL, + NULL, + NULL, + "Replay Timer Timeout ", /* Bit Position 12 */ + "Advisory Non-Fatal ", /* Bit Position 13 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +static char* aer_uncorrectable_error_string[] = { + NULL, + NULL, + NULL, + NULL, + "Data Link Protocol ", /* Bit Position 4 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Poisoned TLP ", /* Bit Position 12 */ + "Flow Control Protocol ", /* Bit Position 13 */ + "Completion Timeout ", /* Bit Position 14 */ + "Completer Abort ", /* Bit Position 15 */ + "Unexpected Completion ", /* Bit Position 16 */ + "Receiver Overflow ", /* Bit Position 17 */ + "Malformed TLP ", /* Bit Position 18 */ + "ECRC ", /* Bit Position 19 */ + "Unsupported Request ", /* Bit Position 20 */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +static char* aer_agent_string[] = { + "Receiver ID", + "Requester ID", + "Completer ID", + "Transmitter ID" +}; + +static char * aer_get_error_source_name(int severity, + unsigned int status, + char errmsg_buff[]) +{ + int i; + char * errmsg = NULL; + + for (i = 0; i < 32; i++) { + if (!(status & (1 << i))) + continue; + + if (severity == AER_CORRECTABLE) + errmsg = aer_correctable_error_string[i]; + else + errmsg = aer_uncorrectable_error_string[i]; + + if (!errmsg) { + sprintf(errmsg_buff, "Unknown Error Bit %2d ", i); + errmsg = errmsg_buff; + } + + break; + } + + return errmsg; +} + +static DEFINE_SPINLOCK(logbuf_lock); +static char errmsg_buff[100]; +void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) +{ + char * errmsg; + int err_layer, agent; + char * loglevel; + + if (info->severity == AER_CORRECTABLE) + loglevel = KERN_WARNING; + else + loglevel = KERN_ERR; + + printk("%s+------ PCI-Express Device Error ------+\n", loglevel); + printk("%sError Severity\t\t: %s\n", loglevel, + aer_error_severity_string[info->severity]); + + if ( info->status == 0) { + printk("%sPCIE Bus Error type\t: (Unaccessible)\n", loglevel); + printk("%sUnaccessible Received\t: %s\n", loglevel, + info->flags & AER_MULTI_ERROR_VALID_FLAG ? + "Multiple" : "First"); + printk("%sUnregistered Agent ID\t: %04x\n", loglevel, + (dev->bus->number << 8) | dev->devfn); + } else { + err_layer = AER_GET_LAYER_ERROR(info->severity, info->status); + printk("%sPCIE Bus Error type\t: %s\n", loglevel, + aer_error_layer[err_layer]); + + spin_lock(&logbuf_lock); + errmsg = aer_get_error_source_name(info->severity, + info->status, + errmsg_buff); + printk("%s%s\t: %s\n", loglevel, errmsg, + info->flags & AER_MULTI_ERROR_VALID_FLAG ? + "Multiple" : "First"); + spin_unlock(&logbuf_lock); + + agent = AER_GET_AGENT(info->severity, info->status); + printk("%s%s\t\t: %04x\n", loglevel, + aer_agent_string[agent], + (dev->bus->number << 8) | dev->devfn); + + printk("%sVendorID=%04xh, DeviceID=%04xh," + " Bus=%02xh, Device=%02xh, Function=%02xh\n", + loglevel, + dev->vendor, + dev->device, + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + + if (info->flags & AER_TLP_HEADER_VALID_FLAG) { + unsigned char *tlp = (unsigned char *) &info->tlp; + printk("%sTLB Header:\n", loglevel); + printk("%s%02x%02x%02x%02x %02x%02x%02x%02x" + " %02x%02x%02x%02x %02x%02x%02x%02x\n", + loglevel, + *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, + *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), + *(tlp + 11), *(tlp + 10), *(tlp + 9), + *(tlp + 8), *(tlp + 15), *(tlp + 14), + *(tlp + 13), *(tlp + 12)); + } + } +} + diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/portdrv_bus.c --- a/drivers/pci/pcie/portdrv_bus.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/pci/pcie/portdrv_bus.c Wed Nov 26 10:24:15 2008 +0900 @@ -24,6 +24,7 @@ struct bus_type pcie_port_bus_type = { .suspend = pcie_port_bus_suspend, .resume = pcie_port_bus_resume, }; +EXPORT_SYMBOL_GPL(pcie_port_bus_type); static int pcie_port_bus_match(struct device *dev, struct device_driver *drv) { diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/pcie/portdrv_pci.c --- a/drivers/pci/pcie/portdrv_pci.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/pci/pcie/portdrv_pci.c Wed Nov 26 10:24:15 2008 +0900 @@ -14,8 +14,10 @@ #include #include #include +#include #include "portdrv.h" +#include "aer/aerdrv.h" /* * Version Information @@ -29,6 +31,43 @@ MODULE_LICENSE("GPL"); /* global data */ static const char device_name[] = "pcieport-driver"; + +static int pcie_portdrv_save_config(struct pci_dev *dev) +{ + return pci_save_state(dev); +} + +#ifdef CONFIG_PM +static int pcie_portdrv_restore_config(struct pci_dev *dev) +{ + int retval; + + pci_restore_state(dev); + retval = pci_enable_device(dev); + if (retval) + return retval; + pci_set_master(dev); + return 0; +} + +static int pcie_portdrv_suspend(struct pci_dev *dev, pm_message_t state) +{ + int ret = pcie_port_device_suspend(dev, state); + + if (!ret) + ret = pcie_portdrv_save_config(dev); + return ret; +} + +static int pcie_portdrv_resume(struct pci_dev *dev) +{ + pcie_portdrv_restore_config(dev); + return pcie_port_device_resume(dev); +} +#else +#define pcie_portdrv_suspend NULL +#define pcie_portdrv_resume NULL +#endif /* * pcie_portdrv_probe - Probe PCI-Express port devices @@ -61,6 +100,10 @@ static int __devinit pcie_portdrv_probe return -ENOMEM; } + pcie_portdrv_save_config(dev); + + pci_enable_pcie_error_reporting(dev); + return 0; } @@ -70,39 +113,143 @@ static void pcie_portdrv_remove (struct kfree(pci_get_drvdata(dev)); } -#ifdef CONFIG_PM -static int pcie_portdrv_save_config(struct pci_dev *dev) -{ - return pci_save_state(dev); -} - -static int pcie_portdrv_restore_config(struct pci_dev *dev) -{ - int retval; - - pci_restore_state(dev); - retval = pci_enable_device(dev); - if (retval) - return retval; - pci_set_master(dev); - return 0; -} - -static int pcie_portdrv_suspend (struct pci_dev *dev, pm_message_t state) -{ - int ret = pcie_port_device_suspend(dev, state); - - if (!ret) - ret = pcie_portdrv_save_config(dev); - return ret; -} - -static int pcie_portdrv_resume (struct pci_dev *dev) -{ - pcie_portdrv_restore_config(dev); - return pcie_port_device_resume(dev); -} -#endif +static int error_detected_iter(struct device *device, void *data) +{ + struct pcie_device *pcie_device; + struct pcie_port_service_driver *driver; + struct aer_broadcast_data *result_data; + pci_ers_result_t status; + + result_data = (struct aer_broadcast_data *) data; + + if (device->bus == &pcie_port_bus_type && device->driver) { + driver = to_service_driver(device->driver); + if (!driver || + !driver->err_handler || + !driver->err_handler->error_detected) + return 0; + + pcie_device = to_pcie_device(device); + + /* Forward error detected message to service drivers */ + status = driver->err_handler->error_detected( + pcie_device->port, + result_data->state); + result_data->result = + merge_result(result_data->result, status); + } + + return 0; +} + +static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev, + enum pci_channel_state error) +{ + struct aer_broadcast_data result_data = + {error, PCI_ERS_RESULT_CAN_RECOVER}; + + device_for_each_child(&dev->dev, &result_data, error_detected_iter); + + return result_data.result; +} + +static int mmio_enabled_iter(struct device *device, void *data) +{ + struct pcie_device *pcie_device; + struct pcie_port_service_driver *driver; + pci_ers_result_t status, *result; + + result = (pci_ers_result_t *) data; + + if (device->bus == &pcie_port_bus_type && device->driver) { + driver = to_service_driver(device->driver); + if (driver && + driver->err_handler && + driver->err_handler->mmio_enabled) { + pcie_device = to_pcie_device(device); + + /* Forward error message to service drivers */ + status = driver->err_handler->mmio_enabled( + pcie_device->port); + *result = merge_result(*result, status); + } + } + + return 0; +} + +static pci_ers_result_t pcie_portdrv_mmio_enabled(struct pci_dev *dev) +{ + pci_ers_result_t status = PCI_ERS_RESULT_RECOVERED; + + device_for_each_child(&dev->dev, &status, mmio_enabled_iter); + return status; +} + +static int slot_reset_iter(struct device *device, void *data) +{ + struct pcie_device *pcie_device; + struct pcie_port_service_driver *driver; + pci_ers_result_t status, *result; + + result = (pci_ers_result_t *) data; + + if (device->bus == &pcie_port_bus_type && device->driver) { + driver = to_service_driver(device->driver); + if (driver && + driver->err_handler && + driver->err_handler->slot_reset) { + pcie_device = to_pcie_device(device); + + /* Forward error message to service drivers */ + status = driver->err_handler->slot_reset( + pcie_device->port); + *result = merge_result(*result, status); + } + } + + return 0; +} + +static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) +{ + pci_ers_result_t status; + + /* If fatal, restore cfg space for possible link reset at upstream */ + if (dev->error_state == pci_channel_io_frozen) { + pcie_portdrv_restore_config(dev); + pci_enable_pcie_error_reporting(dev); + } + + device_for_each_child(&dev->dev, &status, slot_reset_iter); + + return status; +} + +static int resume_iter(struct device *device, void *data) +{ + struct pcie_device *pcie_device; + struct pcie_port_service_driver *driver; + + if (device->bus == &pcie_port_bus_type && device->driver) { + driver = to_service_driver(device->driver); + if (driver && + driver->err_handler && + driver->err_handler->resume) { + pcie_device = to_pcie_device(device); + + /* Forward error message to service drivers */ + driver->err_handler->resume(pcie_device->port); + } + } + + return 0; +} + +static void pcie_portdrv_err_resume(struct pci_dev *dev) +{ + device_for_each_child(&dev->dev, NULL, resume_iter); +} /* * LINUX Device Driver Model @@ -114,6 +261,13 @@ static const struct pci_device_id port_p }; MODULE_DEVICE_TABLE(pci, port_pci_ids); +static struct pci_error_handlers pcie_portdrv_err_handler = { + .error_detected = pcie_portdrv_error_detected, + .mmio_enabled = pcie_portdrv_mmio_enabled, + .slot_reset = pcie_portdrv_slot_reset, + .resume = pcie_portdrv_err_resume, +}; + static struct pci_driver pcie_portdrv = { .name = (char *)device_name, .id_table = &port_pci_ids[0], @@ -121,10 +275,10 @@ static struct pci_driver pcie_portdrv = .probe = pcie_portdrv_probe, .remove = pcie_portdrv_remove, -#ifdef CONFIG_PM .suspend = pcie_portdrv_suspend, .resume = pcie_portdrv_resume, -#endif /* PM */ + + .err_handler = &pcie_portdrv_err_handler, }; static int __init pcie_portdrv_init(void) diff -r 61d1f2810617 -r 6591b4869889 drivers/pci/search.c --- a/drivers/pci/search.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/pci/search.c Wed Nov 26 10:24:15 2008 +0900 @@ -380,6 +380,36 @@ exit: up_read(&pci_bus_sem); return found; } + +/** + * pci_get_bus_and_slot - locate PCI device from a given PCI bus & slot + * @bus: number of PCI bus on which desired PCI device resides + * @devfn: encodes number of PCI slot in which the desired PCI + * device resides and the logical device number within that slot + * in case of multi-function devices. + * + * Note: the bus/slot search is limited to PCI domain (segment) 0. + * + * Given a PCI bus and slot/function number, the desired PCI device + * is located in system global list of PCI devices. If the device + * is found, a pointer to its data structure is returned. If no + * device is found, %NULL is returned. The returned device has its + * reference count bumped by one. + */ + +struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) +{ + struct pci_dev *dev = NULL; + + while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + if (pci_domain_nr(dev->bus) == 0 && + (dev->bus->number == bus && dev->devfn == devfn)) + return dev; + } + return NULL; +} + + EXPORT_SYMBOL(pci_dev_present); EXPORT_SYMBOL(pci_find_bus); @@ -390,4 +420,5 @@ EXPORT_SYMBOL(pci_get_device); EXPORT_SYMBOL(pci_get_device); EXPORT_SYMBOL(pci_get_subsys); EXPORT_SYMBOL(pci_get_slot); +EXPORT_SYMBOL(pci_get_bus_and_slot); EXPORT_SYMBOL(pci_get_class); diff -r 61d1f2810617 -r 6591b4869889 drivers/scsi/ahci.c --- a/drivers/scsi/ahci.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/scsi/ahci.c Wed Nov 26 10:24:15 2008 +0900 @@ -370,6 +370,31 @@ static const struct pci_device_id ahci_p board_ahci }, /* ICH10 */ { PCI_VENDOR_ID_INTEL, 0x3a25, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* ICH10 */ + /* SATA Controller AHCI (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller AHCI (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b23, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller RAID (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b24, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller RAID (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b25, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller Mobile AHCI (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b29, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller Mobile AHCI (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b2f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller Mobile RAID (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b2b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* SATA Controller Mobile RAID (PCH) */ + { PCI_VENDOR_ID_INTEL, 0x3b2c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci }, + /* JMicron */ { 0x197b, 0x2360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, diff -r 61d1f2810617 -r 6591b4869889 drivers/scsi/ata_piix.c --- a/drivers/scsi/ata_piix.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/scsi/ata_piix.c Wed Nov 26 10:24:15 2008 +0900 @@ -220,6 +220,18 @@ static const struct pci_device_id piix_p { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, /* SATA Controller IDE (ICH10) */ { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b28, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, + /* SATA Controller IDE (PCH) */ + { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, { } /* terminate list */ }; diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/balloon/balloon.c --- a/drivers/xen/balloon/balloon.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/balloon/balloon.c Wed Nov 26 10:24:15 2008 +0900 @@ -577,8 +577,8 @@ subsys_initcall(balloon_init); static void __exit balloon_exit(void) { - /* XXX - release balloon here */ - return; + balloon_sysfs_exit(); + /* XXX - release balloon here */ } module_exit(balloon_exit); diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/balloon/sysfs.c --- a/drivers/xen/balloon/sysfs.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/balloon/sysfs.c Wed Nov 26 10:24:15 2008 +0900 @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -111,7 +112,7 @@ static struct sysdev_class balloon_sysde static struct sys_device balloon_sysdev; -static int register_balloon(struct sys_device *sysdev) +static int __init register_balloon(struct sys_device *sysdev) { int i, error; @@ -148,7 +149,7 @@ static int register_balloon(struct sys_d return error; } -static void unregister_balloon(struct sys_device *sysdev) +static __exit void unregister_balloon(struct sys_device *sysdev) { int i; @@ -159,12 +160,12 @@ static void unregister_balloon(struct sy sysdev_class_unregister(&balloon_sysdev_class); } -int balloon_sysfs_init(void) +int __init balloon_sysfs_init(void) { return register_balloon(&balloon_sysdev); } -void balloon_sysfs_exit(void) +void __exit balloon_sysfs_exit(void) { unregister_balloon(&balloon_sysdev); } diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/blkback/blkback.c Wed Nov 26 10:24:15 2008 +0900 @@ -151,9 +151,9 @@ static void unplug_queue(blkif_t *blkif) blkif->plug = NULL; } -static void plug_queue(blkif_t *blkif, struct bio *bio) -{ - request_queue_t *q = bdev_get_queue(bio->bi_bdev); +static void plug_queue(blkif_t *blkif, struct block_device *bdev) +{ + request_queue_t *q = bdev_get_queue(bdev); if (q == blkif->plug) return; @@ -389,8 +389,8 @@ static void dispatch_rw_block_io(blkif_t unsigned long buf; unsigned int nsec; } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; unsigned int nseg; - struct bio *bio = NULL, *biolist[BLKIF_MAX_SEGMENTS_PER_REQUEST]; - int ret, i, nbio = 0; + struct bio *bio = NULL; + int ret, i; int operation; switch (req->operation) { @@ -477,6 +477,10 @@ static void dispatch_rw_block_io(blkif_t goto fail_flush; } + plug_queue(blkif, preq.bdev); + atomic_set(&pending_req->pendcnt, 1); + blkif_get(blkif); + for (i = 0; i < nseg; i++) { if (((int)preq.sector_number|(int)seg[i].nsec) & ((bdev_hardsect_size(preq.bdev) >> 9) - 1)) { @@ -490,7 +494,12 @@ static void dispatch_rw_block_io(blkif_t virt_to_page(vaddr(pending_req, i)), seg[i].nsec << 9, seg[i].buf & ~PAGE_MASK) == 0)) { - bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, nseg-i); + if (bio) { + atomic_inc(&pending_req->pendcnt); + submit_bio(operation, bio); + } + + bio = bio_alloc(GFP_KERNEL, nseg-i); if (unlikely(bio == NULL)) goto fail_put_bio; @@ -505,7 +514,7 @@ static void dispatch_rw_block_io(blkif_t if (!bio) { BUG_ON(operation != WRITE_BARRIER); - bio = biolist[nbio++] = bio_alloc(GFP_KERNEL, 0); + bio = bio_alloc(GFP_KERNEL, 0); if (unlikely(bio == NULL)) goto fail_put_bio; @@ -515,12 +524,7 @@ static void dispatch_rw_block_io(blkif_t bio->bi_sector = -1; } - plug_queue(blkif, bio); - atomic_set(&pending_req->pendcnt, nbio); - blkif_get(blkif); - - for (i = 0; i < nbio; i++) - submit_bio(operation, biolist[i]); + submit_bio(operation, bio); if (operation == READ) blkif->st_rd_sect += preq.nr_sects; @@ -529,16 +533,22 @@ static void dispatch_rw_block_io(blkif_t return; - fail_put_bio: - for (i = 0; i < (nbio-1); i++) - bio_put(biolist[i]); fail_flush: fast_flush_area(pending_req); fail_response: make_response(blkif, req->id, req->operation, BLKIF_RSP_ERROR); free_req(pending_req); msleep(1); /* back off a bit */ -} + return; + + fail_put_bio: + __end_block_io_op(pending_req, -EINVAL); + if (bio) + bio_put(bio); + unplug_queue(blkif); + msleep(1); /* back off a bit */ + return; +} diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/blktap/blktap.c Wed Nov 26 10:24:15 2008 +0900 @@ -611,9 +611,13 @@ static int blktap_release(struct inode * /* Clear any active mappings and free foreign map table */ if (info->vma) { + struct mm_struct *mm = info->vma->vm_mm; + + down_write(&mm->mmap_sem); zap_page_range( info->vma, info->vma->vm_start, info->vma->vm_end - info->vma->vm_start, NULL); + up_write(&mm->mmap_sem); kfree(info->vma->vm_private_data); @@ -992,12 +996,13 @@ static void fast_flush_area(pending_req_ int tapidx) { struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST*2]; - unsigned int i, invcount = 0; + unsigned int i, invcount = 0, locked = 0; struct grant_handle_pair *khandle; uint64_t ptep; int ret, mmap_idx; unsigned long kvaddr, uvaddr; tap_blkif_t *info; + struct mm_struct *mm; info = tapfds[tapidx]; @@ -1007,13 +1012,15 @@ static void fast_flush_area(pending_req_ return; } + mm = info->vma ? info->vma->vm_mm : NULL; + if (info->vma != NULL && xen_feature(XENFEAT_auto_translated_physmap)) { - down_write(&info->vma->vm_mm->mmap_sem); + down_write(&mm->mmap_sem); zap_page_range(info->vma, MMAP_VADDR(info->user_vstart, u_idx, 0), req->nr_pages << PAGE_SHIFT, NULL); - up_write(&info->vma->vm_mm->mmap_sem); + up_write(&mm->mmap_sem); return; } @@ -1038,10 +1045,13 @@ static void fast_flush_area(pending_req_ if (khandle->user != INVALID_GRANT_HANDLE) { BUG_ON(xen_feature(XENFEAT_auto_translated_physmap)); + if (!locked++) + down_write(&mm->mmap_sem); if (create_lookup_pte_addr( - info->vma->vm_mm, + mm, MMAP_VADDR(info->user_vstart, u_idx, i), &ptep) !=0) { + up_write(&mm->mmap_sem); WPRINTK("Couldn't get a pte addr!\n"); return; } @@ -1060,10 +1070,17 @@ static void fast_flush_area(pending_req_ GNTTABOP_unmap_grant_ref, unmap, invcount); BUG_ON(ret); - if (info->vma != NULL && !xen_feature(XENFEAT_auto_translated_physmap)) + if (info->vma != NULL && + !xen_feature(XENFEAT_auto_translated_physmap)) { + if (!locked++) + down_write(&mm->mmap_sem); zap_page_range(info->vma, MMAP_VADDR(info->user_vstart, u_idx, 0), req->nr_pages << PAGE_SHIFT, NULL); + } + + if (locked) + up_write(&mm->mmap_sem); } /****************************************************************** @@ -1346,6 +1363,7 @@ static void dispatch_rw_block_io(blkif_t int pending_idx = RTN_PEND_IDX(pending_req,pending_req->mem_idx); int usr_idx; uint16_t mmap_idx = pending_req->mem_idx; + struct mm_struct *mm; if (blkif->dev_num < 0 || blkif->dev_num > MAX_TAP_DEV) goto fail_response; @@ -1389,6 +1407,9 @@ static void dispatch_rw_block_io(blkif_t pending_req->status = BLKIF_RSP_OKAY; pending_req->nr_pages = nseg; op = 0; + mm = info->vma->vm_mm; + if (!xen_feature(XENFEAT_auto_translated_physmap)) + down_write(&mm->mmap_sem); for (i = 0; i < nseg; i++) { unsigned long uvaddr; unsigned long kvaddr; @@ -1407,9 +1428,9 @@ static void dispatch_rw_block_io(blkif_t if (!xen_feature(XENFEAT_auto_translated_physmap)) { /* Now map it to user. */ - ret = create_lookup_pte_addr(info->vma->vm_mm, - uvaddr, &ptep); + ret = create_lookup_pte_addr(mm, uvaddr, &ptep); if (ret) { + up_write(&mm->mmap_sem); WPRINTK("Couldn't get a pte addr!\n"); goto fail_flush; } @@ -1431,6 +1452,8 @@ static void dispatch_rw_block_io(blkif_t BUG_ON(ret); if (!xen_feature(XENFEAT_auto_translated_physmap)) { + up_write(&mm->mmap_sem); + for (i = 0; i < (nseg*2); i+=2) { unsigned long uvaddr; unsigned long kvaddr; @@ -1504,7 +1527,7 @@ static void dispatch_rw_block_io(blkif_t goto fail_flush; if (xen_feature(XENFEAT_auto_translated_physmap)) - down_write(&info->vma->vm_mm->mmap_sem); + down_write(&mm->mmap_sem); /* Mark mapped pages as reserved: */ for (i = 0; i < req->nr_segments; i++) { unsigned long kvaddr; @@ -1518,13 +1541,13 @@ static void dispatch_rw_block_io(blkif_t MMAP_VADDR(info->user_vstart, usr_idx, i), pg); if (ret) { - up_write(&info->vma->vm_mm->mmap_sem); + up_write(&mm->mmap_sem); goto fail_flush; } } } if (xen_feature(XENFEAT_auto_translated_physmap)) - up_write(&info->vma->vm_mm->mmap_sem); + up_write(&mm->mmap_sem); /*record [mmap_idx,pending_idx] to [usr_idx] mapping*/ info->idx_map[usr_idx] = MAKE_ID(mmap_idx, pending_idx); diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/core/evtchn.c Wed Nov 26 10:24:15 2008 +0900 @@ -756,18 +756,281 @@ static struct hw_interrupt_type dynirq_t .retrigger = resend_irq_on_evtchn, }; -void evtchn_register_pirq(int irq) -{ - struct irq_desc *desc; - unsigned long flags; - - irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0); - - /* Cannot call set_irq_probe(), as that's marked __init. */ - desc = irq_desc + irq; - spin_lock_irqsave(&desc->lock, flags); - desc->status &= ~IRQ_NOPROBE; - spin_unlock_irqrestore(&desc->lock, flags); +static inline void pirq_unmask_notify(int irq) +{ + struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; + if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) + VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); +} + +static inline void pirq_query_unmask(int irq) +{ + struct physdev_irq_status_query irq_status; + irq_status.irq = evtchn_get_xen_pirq(irq); + if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) + irq_status.flags = 0; + clear_bit(irq - PIRQ_BASE, pirq_needs_eoi); + if (irq_status.flags & XENIRQSTAT_needs_eoi) + set_bit(irq - PIRQ_BASE, pirq_needs_eoi); +} + +/* + * On startup, if there is no action associated with the IRQ then we are + * probing. In this case we should not share with others as it will confuse us. + */ +#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL) + +static unsigned int startup_pirq(unsigned int irq) +{ + struct evtchn_bind_pirq bind_pirq; + int evtchn = evtchn_from_irq(irq); + + if (VALID_EVTCHN(evtchn)) + goto out; + + bind_pirq.pirq = evtchn_get_xen_pirq(irq); + /* NB. We are happy to share unless we are probing. */ + bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { + if (!probing_irq(irq)) + printk(KERN_INFO "Failed to obtain physical IRQ %d\n", + irq); + return 0; + } + evtchn = bind_pirq.port; + + pirq_query_unmask(irq); + + evtchn_to_irq[evtchn] = irq; + bind_evtchn_to_cpu(evtchn, 0); + irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); + + out: + unmask_evtchn(evtchn); + pirq_unmask_notify(irq); + + return 0; +} + +static void shutdown_pirq(unsigned int irq) +{ + struct evtchn_close close; + int evtchn = evtchn_from_irq(irq); + + if (!VALID_EVTCHN(evtchn)) + return; + + mask_evtchn(evtchn); + + close.port = evtchn; + if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) + BUG(); + + bind_evtchn_to_cpu(evtchn, 0); + evtchn_to_irq[evtchn] = -1; + irq_info[irq] = mk_irq_info(IRQT_PIRQ, index_from_irq(irq), 0); +} + +static void enable_pirq(unsigned int irq) +{ + startup_pirq(irq); +} + +static void disable_pirq(unsigned int irq) +{ +} + +static void ack_pirq(unsigned int irq) +{ + int evtchn = evtchn_from_irq(irq); + + move_native_irq(irq); + + if (VALID_EVTCHN(evtchn)) { + mask_evtchn(evtchn); + clear_evtchn(evtchn); + } +} + +static void end_pirq(unsigned int irq) +{ + int evtchn = evtchn_from_irq(irq); + + if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == + (IRQ_DISABLED|IRQ_PENDING)) { + shutdown_pirq(irq); + } else if (VALID_EVTCHN(evtchn)) { + unmask_evtchn(evtchn); + pirq_unmask_notify(irq); + } +} + +static struct hw_interrupt_type pirq_type = { + .typename = "Phys-irq", + .startup = startup_pirq, + .shutdown = shutdown_pirq, + .enable = enable_pirq, + .disable = disable_pirq, + .ack = ack_pirq, + .end = end_pirq, +#ifdef CONFIG_SMP + .set_affinity = set_affinity_irq, +#endif + .retrigger = resend_irq_on_evtchn, +}; + +int irq_ignore_unhandled(unsigned int irq) +{ + struct physdev_irq_status_query irq_status = { .irq = irq }; + + if (!is_running_on_xen()) + return 0; + + if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) + return 0; + return !!(irq_status.flags & XENIRQSTAT_shared); +} + +void notify_remote_via_irq(int irq) +{ + int evtchn = evtchn_from_irq(irq); + + if (VALID_EVTCHN(evtchn)) + notify_remote_via_evtchn(evtchn); +} +EXPORT_SYMBOL_GPL(notify_remote_via_irq); + +int irq_to_evtchn_port(int irq) +{ + return evtchn_from_irq(irq); +} +EXPORT_SYMBOL_GPL(irq_to_evtchn_port); + +void mask_evtchn(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + synch_set_bit(port, s->evtchn_mask); +} +EXPORT_SYMBOL_GPL(mask_evtchn); + +void unmask_evtchn(int port) +{ + shared_info_t *s = HYPERVISOR_shared_info; + unsigned int cpu = smp_processor_id(); + vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; + + BUG_ON(!irqs_disabled()); + + /* Slow path (hypercall) if this is a non-local port. */ + if (unlikely(cpu != cpu_from_evtchn(port))) { + struct evtchn_unmask unmask = { .port = port }; + VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask)); + return; + } + + synch_clear_bit(port, s->evtchn_mask); + + /* Did we miss an interrupt 'edge'? Re-fire if so. */ + if (synch_test_bit(port, s->evtchn_pending) && + !synch_test_and_set_bit(port / BITS_PER_LONG, + &vcpu_info->evtchn_pending_sel)) + vcpu_info->evtchn_upcall_pending = 1; +} +EXPORT_SYMBOL_GPL(unmask_evtchn); + +void disable_all_local_evtchn(void) +{ + unsigned i, cpu = smp_processor_id(); + shared_info_t *s = HYPERVISOR_shared_info; + + for (i = 0; i < NR_EVENT_CHANNELS; ++i) + if (cpu_from_evtchn(i) == cpu) + synch_set_bit(i, &s->evtchn_mask[0]); +} + +static void restore_cpu_virqs(unsigned int cpu) +{ + struct evtchn_bind_virq bind_virq; + int virq, irq, evtchn; + + for (virq = 0; virq < NR_VIRQS; virq++) { + if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) + continue; + + BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0)); + + /* Get a new binding from Xen. */ + bind_virq.virq = virq; + bind_virq.vcpu = cpu; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, + &bind_virq) != 0) + BUG(); + evtchn = bind_virq.port; + + /* Record the new mapping. */ + evtchn_to_irq[evtchn] = irq; + irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn); + bind_evtchn_to_cpu(evtchn, cpu); + + /* Ready for use. */ + unmask_evtchn(evtchn); + } +} + +static void restore_cpu_ipis(unsigned int cpu) +{ + struct evtchn_bind_ipi bind_ipi; + int ipi, irq, evtchn; + + for (ipi = 0; ipi < NR_IPIS; ipi++) { + if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) + continue; + + BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0)); + + /* Get a new binding from Xen. */ + bind_ipi.vcpu = cpu; + if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, + &bind_ipi) != 0) + BUG(); + evtchn = bind_ipi.port; + + /* Record the new mapping. */ + evtchn_to_irq[evtchn] = irq; + irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn); + bind_evtchn_to_cpu(evtchn, cpu); + + /* Ready for use. */ + unmask_evtchn(evtchn); + + } +} + +void irq_resume(void) +{ + unsigned int cpu, irq, evtchn; + + init_evtchn_cpu_bindings(); + + /* New event-channel space is not 'live' yet. */ + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) + mask_evtchn(evtchn); + + /* Check that no PIRQs are still bound. */ + for (irq = PIRQ_BASE; irq < (PIRQ_BASE + NR_PIRQS); irq++) + BUG_ON(irq_info[irq] != IRQ_UNBOUND); + + /* No IRQ <-> event-channel mappings. */ + for (irq = 0; irq < NR_IRQS; irq++) + irq_info[irq] &= ~((1U << _EVTCHN_BITS) - 1); + for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) + evtchn_to_irq[evtchn] = -1; + + for_each_possible_cpu(cpu) { + restore_cpu_virqs(cpu); + restore_cpu_ipis(cpu); + } + } #if defined(CONFIG_X86_IO_APIC) @@ -777,6 +1040,15 @@ void evtchn_register_pirq(int irq) #else #define identity_mapped_irq(irq) (1) #endif + +void evtchn_register_pirq(int irq) +{ + BUG_ON(irq < PIRQ_BASE || irq - PIRQ_BASE > NR_PIRQS); + if (identity_mapped_irq(irq)) + return; + irq_info[irq] = mk_irq_info(IRQT_PIRQ, irq, 0); + irq_desc[irq].chip = &pirq_type; +} int evtchn_map_pirq(int irq, int xen_pirq) { @@ -798,9 +1070,11 @@ int evtchn_map_pirq(int irq, int xen_pir spin_unlock(&irq_alloc_lock); if (irq < PIRQ_BASE) return -ENOSPC; + irq_desc[irq].chip = &pirq_type; } else if (!xen_pirq) { if (unlikely(type_from_irq(irq) != IRQT_PIRQ)) return -EINVAL; + irq_desc[irq].chip = &no_irq_type; irq_info[irq] = IRQ_UNBOUND; return 0; } else if (type_from_irq(irq) != IRQT_PIRQ @@ -821,283 +1095,6 @@ int evtchn_get_xen_pirq(int irq) return index_from_irq(irq); } -static inline void pirq_unmask_notify(int irq) -{ - struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; - if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) - VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); -} - -static inline void pirq_query_unmask(int irq) -{ - struct physdev_irq_status_query irq_status; - irq_status.irq = evtchn_get_xen_pirq(irq); - if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) - irq_status.flags = 0; - clear_bit(irq - PIRQ_BASE, pirq_needs_eoi); - if (irq_status.flags & XENIRQSTAT_needs_eoi) - set_bit(irq - PIRQ_BASE, pirq_needs_eoi); -} - -/* - * On startup, if there is no action associated with the IRQ then we are - * probing. In this case we should not share with others as it will confuse us. - */ -#define probing_irq(_irq) (irq_desc[(_irq)].action == NULL) - -static unsigned int startup_pirq(unsigned int irq) -{ - struct evtchn_bind_pirq bind_pirq; - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn)) - goto out; - - bind_pirq.pirq = evtchn_get_xen_pirq(irq); - /* NB. We are happy to share unless we are probing. */ - bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) { - if (!probing_irq(irq)) - printk(KERN_INFO "Failed to obtain physical IRQ %d\n", - irq); - return 0; - } - evtchn = bind_pirq.port; - - pirq_query_unmask(irq); - - evtchn_to_irq[evtchn] = irq; - bind_evtchn_to_cpu(evtchn, 0); - irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); - - out: - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - - return 0; -} - -static void shutdown_pirq(unsigned int irq) -{ - struct evtchn_close close; - int evtchn = evtchn_from_irq(irq); - - if (!VALID_EVTCHN(evtchn)) - return; - - mask_evtchn(evtchn); - - close.port = evtchn; - if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) - BUG(); - - bind_evtchn_to_cpu(evtchn, 0); - evtchn_to_irq[evtchn] = -1; - irq_info[irq] = mk_irq_info(IRQT_PIRQ, index_from_irq(irq), 0); -} - -static void enable_pirq(unsigned int irq) -{ - startup_pirq(irq); -} - -static void disable_pirq(unsigned int irq) -{ -} - -static void ack_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - move_native_irq(irq); - - if (VALID_EVTCHN(evtchn)) { - mask_evtchn(evtchn); - clear_evtchn(evtchn); - } -} - -static void end_pirq(unsigned int irq) -{ - int evtchn = evtchn_from_irq(irq); - - if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == - (IRQ_DISABLED|IRQ_PENDING)) { - shutdown_pirq(irq); - } else if (VALID_EVTCHN(evtchn)) { - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - } -} - -static struct hw_interrupt_type pirq_type = { - .typename = "Phys-irq", - .startup = startup_pirq, - .shutdown = shutdown_pirq, - .enable = enable_pirq, - .disable = disable_pirq, - .ack = ack_pirq, - .end = end_pirq, -#ifdef CONFIG_SMP - .set_affinity = set_affinity_irq, -#endif - .retrigger = resend_irq_on_evtchn, -}; - -int irq_ignore_unhandled(unsigned int irq) -{ - struct physdev_irq_status_query irq_status = { .irq = irq }; - - if (!is_running_on_xen()) - return 0; - - if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) - return 0; - return !!(irq_status.flags & XENIRQSTAT_shared); -} - -void notify_remote_via_irq(int irq) -{ - int evtchn = evtchn_from_irq(irq); - - if (VALID_EVTCHN(evtchn)) - notify_remote_via_evtchn(evtchn); -} -EXPORT_SYMBOL_GPL(notify_remote_via_irq); - -int irq_to_evtchn_port(int irq) -{ - return evtchn_from_irq(irq); -} -EXPORT_SYMBOL_GPL(irq_to_evtchn_port); - -void mask_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - synch_set_bit(port, s->evtchn_mask); -} -EXPORT_SYMBOL_GPL(mask_evtchn); - -void unmask_evtchn(int port) -{ - shared_info_t *s = HYPERVISOR_shared_info; - unsigned int cpu = smp_processor_id(); - vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; - - BUG_ON(!irqs_disabled()); - - /* Slow path (hypercall) if this is a non-local port. */ - if (unlikely(cpu != cpu_from_evtchn(port))) { - struct evtchn_unmask unmask = { .port = port }; - VOID(HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask)); - return; - } - - synch_clear_bit(port, s->evtchn_mask); - - /* Did we miss an interrupt 'edge'? Re-fire if so. */ - if (synch_test_bit(port, s->evtchn_pending) && - !synch_test_and_set_bit(port / BITS_PER_LONG, - &vcpu_info->evtchn_pending_sel)) - vcpu_info->evtchn_upcall_pending = 1; -} -EXPORT_SYMBOL_GPL(unmask_evtchn); - -void disable_all_local_evtchn(void) -{ - unsigned i, cpu = smp_processor_id(); - shared_info_t *s = HYPERVISOR_shared_info; - - for (i = 0; i < NR_EVENT_CHANNELS; ++i) - if (cpu_from_evtchn(i) == cpu) - synch_set_bit(i, &s->evtchn_mask[0]); -} - -static void restore_cpu_virqs(unsigned int cpu) -{ - struct evtchn_bind_virq bind_virq; - int virq, irq, evtchn; - - for (virq = 0; virq < NR_VIRQS; virq++) { - if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) - continue; - - BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0)); - - /* Get a new binding from Xen. */ - bind_virq.virq = virq; - bind_virq.vcpu = cpu; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, - &bind_virq) != 0) - BUG(); - evtchn = bind_virq.port; - - /* Record the new mapping. */ - evtchn_to_irq[evtchn] = irq; - irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn); - bind_evtchn_to_cpu(evtchn, cpu); - - /* Ready for use. */ - unmask_evtchn(evtchn); - } -} - -static void restore_cpu_ipis(unsigned int cpu) -{ - struct evtchn_bind_ipi bind_ipi; - int ipi, irq, evtchn; - - for (ipi = 0; ipi < NR_IPIS; ipi++) { - if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) - continue; - - BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0)); - - /* Get a new binding from Xen. */ - bind_ipi.vcpu = cpu; - if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, - &bind_ipi) != 0) - BUG(); - evtchn = bind_ipi.port; - - /* Record the new mapping. */ - evtchn_to_irq[evtchn] = irq; - irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn); - bind_evtchn_to_cpu(evtchn, cpu); - - /* Ready for use. */ - unmask_evtchn(evtchn); - - } -} - -void irq_resume(void) -{ - unsigned int cpu, irq, evtchn; - - init_evtchn_cpu_bindings(); - - /* New event-channel space is not 'live' yet. */ - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) - mask_evtchn(evtchn); - - /* Check that no PIRQs are still bound. */ - for (irq = PIRQ_BASE; irq < (PIRQ_BASE + NR_PIRQS); irq++) - BUG_ON(irq_info[irq] != IRQ_UNBOUND); - - /* No IRQ <-> event-channel mappings. */ - for (irq = 0; irq < NR_IRQS; irq++) - irq_info[irq] &= ~((1U << _EVTCHN_BITS) - 1); - for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) - evtchn_to_irq[evtchn] = -1; - - for_each_possible_cpu(cpu) { - restore_cpu_virqs(cpu); - restore_cpu_ipis(cpu); - } - -} - void __init xen_init_IRQ(void) { unsigned int i; @@ -1126,16 +1123,16 @@ void __init xen_init_IRQ(void) for (i = PIRQ_BASE; i < (PIRQ_BASE + NR_PIRQS); i++) { irq_bindcount[i] = 1; + if (!identity_mapped_irq(i)) + continue; + #ifdef RTC_IRQ /* If not domain 0, force our RTC driver to fail its probe. */ - if (identity_mapped_irq(i) && ((i - PIRQ_BASE) == RTC_IRQ) - && !is_initial_xendomain()) + if (i - PIRQ_BASE == RTC_IRQ && !is_initial_xendomain()) continue; #endif irq_desc[i].status = IRQ_DISABLED; - if (!identity_mapped_irq(i)) - irq_desc[i].status |= IRQ_NOPROBE; irq_desc[i].action = NULL; irq_desc[i].depth = 1; irq_desc[i].chip = &pirq_type; diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/core/pci.c --- a/drivers/xen/core/pci.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/core/pci.c Wed Nov 26 10:24:15 2008 +0900 @@ -23,14 +23,6 @@ static int pci_bus_probe_wrapper(struct return r; r = pci_bus_probe(dev); - if (r) { - int ret; - - ret = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove, - &manage_pci); - WARN_ON(ret && ret != -ENOSYS); - } - return r; } diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/fbfront/xenfb.c --- a/drivers/xen/fbfront/xenfb.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/fbfront/xenfb.c Wed Nov 26 10:24:15 2008 +0900 @@ -662,6 +662,10 @@ static int __devinit xenfb_probe(struct } info->fb_info = fb_info; + ret = xenfb_connect_backend(dev, info); + if (ret < 0) + goto error; + /* FIXME should this be delayed until backend XenbusStateConnected? */ info->kthread = kthread_run(xenfb_thread, info, "xenfb thread"); if (IS_ERR(info->kthread)) { @@ -670,10 +674,6 @@ static int __devinit xenfb_probe(struct xenbus_dev_fatal(dev, ret, "register_framebuffer"); goto error; } - - ret = xenfb_connect_backend(dev, info); - if (ret < 0) - goto error; return 0; diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pciback/controller.c --- a/drivers/xen/pciback/controller.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pciback/controller.c Wed Nov 26 10:24:15 2008 +0900 @@ -406,3 +406,38 @@ void pciback_release_devices(struct pcib kfree(dev_data); pdev->pci_dev_data = NULL; } + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, + struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn) +{ + struct controller_dev_data *dev_data = pdev->pci_dev_data; + struct controller_dev_entry *dev_entry; + struct controller_list_entry *cntrl_entry; + unsigned long flags; + int found = 0; + spin_lock_irqsave(&dev_data->lock, flags); + + list_for_each_entry(cntrl_entry, &dev_data->list, list) { + list_for_each_entry(dev_entry, &cntrl_entry->dev_list, list) { + if ( (dev_entry->dev->bus->number == + pcidev->bus->number) && + (dev_entry->dev->devfn == + pcidev->devfn) && + (pci_domain_nr(dev_entry->dev->bus) == + pci_domain_nr(pcidev->bus))) + { + found = 1; + *domain = cntrl_entry->domain; + *bus = cntrl_entry->bus; + *devfn = dev_entry->devfn; + goto out; + } + } + } +out: + spin_unlock_irqrestore(&dev_data->lock, flags); + return found; + +} + diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pciback/passthrough.c --- a/drivers/xen/pciback/passthrough.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pciback/passthrough.c Wed Nov 26 10:24:15 2008 +0900 @@ -164,3 +164,13 @@ void pciback_release_devices(struct pcib kfree(dev_data); pdev->pci_dev_data = NULL; } + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn) + +{ + *domain = pci_domain_nr(pcidev->bus); + *bus = pcidev->bus->number; + *devfn = pcidev->devfn; + return 1; +} diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pciback/pci_stub.c --- a/drivers/xen/pciback/pci_stub.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pciback/pci_stub.c Wed Nov 26 10:24:15 2008 +0900 @@ -6,15 +6,24 @@ */ #include #include +#include #include #include #include +#include +#include #include +#include #include "pciback.h" #include "conf_space.h" #include "conf_space_quirks.h" static char *pci_devs_to_hide = NULL; +wait_queue_head_t aer_wait_queue; +/*Add sem for sync AER handling and pciback remove/reconfigue ops, +* We want to avoid in middle of AER ops, pciback devices is being removed +*/ +static DECLARE_RWSEM(pcistub_sem); module_param_named(hide, pci_devs_to_hide, charp, 0444); struct pcistub_device_id { @@ -207,6 +216,10 @@ void pcistub_put_pci_dev(struct pci_dev spin_unlock_irqrestore(&pcistub_devices_lock, flags); + /*hold this lock for avoiding breaking link between + * pcistub and pciback when AER is in processing + */ + down_write(&pcistub_sem); /* Cleanup our device * (so it's ready for the next domain) */ @@ -219,6 +232,7 @@ void pcistub_put_pci_dev(struct pci_dev spin_unlock_irqrestore(&found_psdev->lock, flags); pcistub_device_put(found_psdev); + up_write(&pcistub_sem); } static int __devinit pcistub_match_one(struct pci_dev *dev, @@ -279,6 +293,8 @@ static int __devinit pcistub_init_device pci_set_drvdata(dev, dev_data); dev_dbg(&dev->dev, "initializing config\n"); + + init_waitqueue_head(&aer_wait_queue); err = pciback_config_init_dev(dev); if (err) goto out; @@ -477,6 +493,308 @@ static const struct pci_device_id pcistu {0,}, }; +static void kill_domain_by_device(struct pcistub_device *psdev) +{ + struct xenbus_transaction xbt; + int err; + char nodename[1024]; + + if (!psdev) + dev_err(&psdev->dev->dev, + "device is NULL when do AER recovery/kill_domain\n"); + sprintf(nodename, "/local/domain/0/backend/pci/%d/0", + psdev->pdev->xdev->otherend_id); + nodename[strlen(nodename)] = '\0'; + +again: + err = xenbus_transaction_start(&xbt); + if (err) + { + dev_err(&psdev->dev->dev, + "error %d when start xenbus transaction\n", err); + return; + } + /*PV AER handlers will set this flag*/ + xenbus_printf(xbt, nodename, "aerState" , "aerfail" ); + err = xenbus_transaction_end(xbt, 0); + if (err) + { + if (err == -EAGAIN) + goto again; + dev_err(&psdev->dev->dev, + "error %d when end xenbus transaction\n", err); + return; + } +} + +/* For each aer recovery step error_detected, mmio_enabled, etc, front_end and + * backend need to have cooperation. In pciback, those steps will do similar + * jobs: send service request and waiting for front_end response. +*/ +static pci_ers_result_t common_process(struct pcistub_device *psdev, + pci_channel_state_t state, int aer_cmd, pci_ers_result_t result) +{ + pci_ers_result_t res = result; + struct xen_pcie_aer_op *aer_op; + int ret; + + /*with PV AER drivers*/ + aer_op = &(psdev->pdev->sh_info->aer_op); + aer_op->cmd = aer_cmd ; + /*useful for error_detected callback*/ + aer_op->err = state; + /*pcifront_end BDF*/ + ret = pciback_get_pcifront_dev(psdev->dev, psdev->pdev, + &aer_op->domain, &aer_op->bus, &aer_op->devfn); + if (!ret) { + dev_err(&psdev->dev->dev, + "pciback: failed to get pcifront device\n"); + return PCI_ERS_RESULT_NONE; + } + wmb(); + + dev_dbg(&psdev->dev->dev, + "pciback: aer_op %x dom %x bus %x devfn %x\n", + aer_cmd, aer_op->domain, aer_op->bus, aer_op->devfn); + /*local flag to mark there's aer request, pciback callback will use this + * flag to judge whether we need to check pci-front give aer service + * ack signal + */ + set_bit(_PCIB_op_pending, (unsigned long *)&psdev->pdev->flags); + + /*It is possible that a pcifront conf_read_write ops request invokes + * the callback which cause the spurious execution of wake_up. + * Yet it is harmless and better than a spinlock here + */ + set_bit(_XEN_PCIB_active, + (unsigned long *)&psdev->pdev->sh_info->flags); + wmb(); + notify_remote_via_irq(psdev->pdev->evtchn_irq); + + ret = wait_event_timeout(aer_wait_queue, !(test_bit(_XEN_PCIB_active, + (unsigned long *)&psdev->pdev->sh_info->flags)), 300*HZ); + + if (!ret) { + if (test_bit(_XEN_PCIB_active, + (unsigned long *)&psdev->pdev->sh_info->flags)) { + dev_err(&psdev->dev->dev, + "pcifront aer process not responding!\n"); + clear_bit(_XEN_PCIB_active, + (unsigned long *)&psdev->pdev->sh_info->flags); + aer_op->err = PCI_ERS_RESULT_NONE; + return res; + } + } + clear_bit(_PCIB_op_pending, (unsigned long *)&psdev->pdev->flags); + + if ( test_bit( _XEN_PCIF_active, + (unsigned long*)&psdev->pdev->sh_info->flags)) { + dev_dbg(&psdev->dev->dev, + "schedule pci_conf service in pciback \n"); + test_and_schedule_op(psdev->pdev); + } + + res = (pci_ers_result_t)aer_op->err; + return res; +} + +/* +* pciback_slot_reset: it will send the slot_reset request to pcifront in case +* of the device driver could provide this service, and then wait for pcifront +* ack. +* @dev: pointer to PCI devices +* return value is used by aer_core do_recovery policy +*/ +static pci_ers_result_t pciback_slot_reset(struct pci_dev *dev) +{ + struct pcistub_device *psdev; + pci_ers_result_t result; + + result = PCI_ERS_RESULT_RECOVERED; + dev_dbg(&dev->dev, "pciback_slot_reset(bus:%x,devfn:%x)\n", + dev->bus->number, dev->devfn); + + down_write(&pcistub_sem); + psdev = pcistub_device_find(pci_domain_nr(dev->bus), + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info ) + { + dev_err(&dev->dev, + "pciback device is not found/in use/connected!\n"); + goto end; + } + if ( !test_bit(_XEN_PCIB_AERHANDLER, + (unsigned long *)&psdev->pdev->sh_info->flags) ) { + dev_err(&dev->dev, + "guest with no AER driver should have been killed\n"); + goto release; + } + result = common_process(psdev, 1, XEN_PCI_OP_aer_slotreset, result); + + if (result == PCI_ERS_RESULT_NONE || + result == PCI_ERS_RESULT_DISCONNECT) { + dev_dbg(&dev->dev, + "No AER slot_reset service or disconnected!\n"); + kill_domain_by_device(psdev); + } +release: + pcistub_device_put(psdev); +end: + up_write(&pcistub_sem); + return result; + +} + + +/*pciback_mmio_enabled: it will send the mmio_enabled request to pcifront +* in case of the device driver could provide this service, and then wait +* for pcifront ack. +* @dev: pointer to PCI devices +* return value is used by aer_core do_recovery policy +*/ + +static pci_ers_result_t pciback_mmio_enabled(struct pci_dev *dev) +{ + struct pcistub_device *psdev; + pci_ers_result_t result; + + result = PCI_ERS_RESULT_RECOVERED; + dev_dbg(&dev->dev, "pciback_mmio_enabled(bus:%x,devfn:%x)\n", + dev->bus->number, dev->devfn); + + down_write(&pcistub_sem); + psdev = pcistub_device_find(pci_domain_nr(dev->bus), + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info) + { + dev_err(&dev->dev, + "pciback device is not found/in use/connected!\n"); + goto end; + } + if ( !test_bit(_XEN_PCIB_AERHANDLER, + (unsigned long *)&psdev->pdev->sh_info->flags) ) { + dev_err(&dev->dev, + "guest with no AER driver should have been killed\n"); + goto release; + } + result = common_process(psdev, 1, XEN_PCI_OP_aer_mmio, result); + + if (result == PCI_ERS_RESULT_NONE || + result == PCI_ERS_RESULT_DISCONNECT) { + dev_dbg(&dev->dev, + "No AER mmio_enabled service or disconnected!\n"); + kill_domain_by_device(psdev); + } +release: + pcistub_device_put(psdev); +end: + up_write(&pcistub_sem); + return result; +} + +/*pciback_error_detected: it will send the error_detected request to pcifront +* in case of the device driver could provide this service, and then wait +* for pcifront ack. +* @dev: pointer to PCI devices +* @error: the current PCI connection state +* return value is used by aer_core do_recovery policy +*/ + +static pci_ers_result_t pciback_error_detected(struct pci_dev *dev, + pci_channel_state_t error) +{ + struct pcistub_device *psdev; + pci_ers_result_t result; + + result = PCI_ERS_RESULT_CAN_RECOVER; + dev_dbg(&dev->dev, "pciback_error_detected(bus:%x,devfn:%x)\n", + dev->bus->number, dev->devfn); + + down_write(&pcistub_sem); + psdev = pcistub_device_find(pci_domain_nr(dev->bus), + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info) + { + dev_err(&dev->dev, + "pciback device is not found/in use/connected!\n"); + goto end; + } + /*Guest owns the device yet no aer handler regiested, kill guest*/ + if ( !test_bit(_XEN_PCIB_AERHANDLER, + (unsigned long *)&psdev->pdev->sh_info->flags) ) { + dev_dbg(&dev->dev, "guest may have no aer driver, kill it\n"); + kill_domain_by_device(psdev); + goto release; + } + result = common_process(psdev, error, XEN_PCI_OP_aer_detected, result); + + if (result == PCI_ERS_RESULT_NONE || + result == PCI_ERS_RESULT_DISCONNECT) { + dev_dbg(&dev->dev, + "No AER error_detected service or disconnected!\n"); + kill_domain_by_device(psdev); + } +release: + pcistub_device_put(psdev); +end: + up_write(&pcistub_sem); + return result; +} + +/*pciback_error_resume: it will send the error_resume request to pcifront +* in case of the device driver could provide this service, and then wait +* for pcifront ack. +* @dev: pointer to PCI devices +*/ + +static void pciback_error_resume(struct pci_dev *dev) +{ + struct pcistub_device *psdev; + + dev_dbg(&dev->dev, "pciback_error_resume(bus:%x,devfn:%x)\n", + dev->bus->number, dev->devfn); + + down_write(&pcistub_sem); + psdev = pcistub_device_find(pci_domain_nr(dev->bus), + dev->bus->number, + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + if ( !psdev || !psdev->pdev || !psdev->pdev->sh_info) + { + dev_err(&dev->dev, + "pciback device is not found/in use/connected!\n"); + goto end; + } + + if ( !test_bit(_XEN_PCIB_AERHANDLER, + (unsigned long *)&psdev->pdev->sh_info->flags) ) { + dev_err(&dev->dev, + "guest with no AER driver should have been killed\n"); + kill_domain_by_device(psdev); + goto release; + } + common_process(psdev, 1, XEN_PCI_OP_aer_resume, PCI_ERS_RESULT_RECOVERED); +release: + pcistub_device_put(psdev); +end: + up_write(&pcistub_sem); + return; +} + +/*add pciback AER handling*/ +static struct pci_error_handlers pciback_error_handler = { + .error_detected = pciback_error_detected, + .mmio_enabled = pciback_mmio_enabled, + .slot_reset = pciback_slot_reset, + .resume = pciback_error_resume, +}; + /* * Note: There is no MODULE_DEVICE_TABLE entry here because this isn't * for a normal device. I don't want it to be loaded automatically. @@ -487,6 +805,7 @@ static struct pci_driver pciback_pci_dri .id_table = pcistub_ids, .probe = pcistub_probe, .remove = pcistub_remove, + .err_handler = &pciback_error_handler, }; static inline int str_to_slot(const char *buf, int *domain, int *bus, diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pciback/pciback.h --- a/drivers/xen/pciback/pciback.h Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pciback/pciback.h Wed Nov 26 10:24:15 2008 +0900 @@ -22,6 +22,8 @@ struct pci_dev_entry { #define _PDEVF_op_active (0) #define PDEVF_op_active (1<<(_PDEVF_op_active)) +#define _PCIB_op_pending (1) +#define PCIB_op_pending (1<<(_PCIB_op_pending)) struct pciback_device { void *pci_dev_data; @@ -81,6 +83,16 @@ struct pci_dev *pciback_get_pci_dev(stru struct pci_dev *pciback_get_pci_dev(struct pciback_device *pdev, unsigned int domain, unsigned int bus, unsigned int devfn); + +/** +* Add for domain0 PCIE-AER handling. Get guest domain/bus/devfn in pciback +* before sending aer request to pcifront, so that guest could identify +* device, coopearte with pciback to finish aer recovery job if device driver +* has the capability +*/ + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn); int pciback_init_devices(struct pciback_device *pdev); int pciback_publish_pci_roots(struct pciback_device *pdev, publish_pci_root_cb cb); @@ -108,4 +120,7 @@ int pciback_disable_msix(struct pciback_ struct pci_dev *dev, struct xen_pci_op *op); #endif extern int verbose_request; + +void test_and_schedule_op(struct pciback_device *pdev); #endif + diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pciback/pciback_ops.c --- a/drivers/xen/pciback/pciback_ops.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pciback/pciback_ops.c Wed Nov 26 10:24:15 2008 +0900 @@ -4,6 +4,7 @@ * Author: Ryan Wilson */ #include +#include #include #include #include "pciback.h" @@ -37,14 +38,29 @@ void pciback_reset_device(struct pci_dev } } } - -static inline void test_and_schedule_op(struct pciback_device *pdev) +extern wait_queue_head_t aer_wait_queue; +extern struct workqueue_struct *pciback_wq; +/* +* Now the same evtchn is used for both pcifront conf_read_write request +* as well as pcie aer front end ack. We use a new work_queue to schedule +* pciback conf_read_write service for avoiding confict with aer_core +* do_recovery job which also use the system default work_queue +*/ +void test_and_schedule_op(struct pciback_device *pdev) { /* Check that frontend is requesting an operation and that we are not * already processing a request */ if (test_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags) && !test_and_set_bit(_PDEVF_op_active, &pdev->flags)) - schedule_work(&pdev->op_work); + { + queue_work(pciback_wq, &pdev->op_work); + } + /*_XEN_PCIB_active should have been cleared by pcifront. And also make + sure pciback is waiting for ack by checking _PCIB_op_pending*/ + if (!test_bit(_XEN_PCIB_active,(unsigned long *)&pdev->sh_info->flags) + &&test_bit(_PCIB_op_pending, &pdev->flags)) { + wake_up(&aer_wait_queue); + } } /* Performing the configuration space reads/writes must not be done in atomic @@ -103,7 +119,8 @@ void pciback_do_op(void *data) smp_mb__after_clear_bit(); /* /before/ final check for work */ /* Check to see if the driver domain tried to start another request in - * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active. */ + * between clearing _XEN_PCIF_active and clearing _PDEVF_op_active. + */ test_and_schedule_op(pdev); } diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pciback/slot.c --- a/drivers/xen/pciback/slot.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pciback/slot.c Wed Nov 26 10:24:15 2008 +0900 @@ -155,3 +155,33 @@ void pciback_release_devices(struct pcib kfree(slot_dev); pdev->pci_dev_data = NULL; } + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn) +{ + int slot, busnr; + struct slot_dev_data *slot_dev = pdev->pci_dev_data; + struct pci_dev *dev; + int found = 0; + unsigned long flags; + + spin_lock_irqsave(&slot_dev->lock, flags); + + for (busnr = 0; busnr < PCI_BUS_NBR; bus++) + for (slot = 0; slot < PCI_SLOT_MAX; slot++) { + dev = slot_dev->slots[busnr][slot]; + if (dev && dev->bus->number == pcidev->bus->number + && dev->devfn == pcidev->devfn + && pci_domain_nr(dev->bus) == pci_domain_nr(pcidev->bus)) { + found = 1; + *domain = 0; + *bus = busnr; + *devfn = PCI_DEVFN(slot,0); + goto out; + } + } +out: + spin_unlock_irqrestore(&slot_dev->lock, flags); + return found; + +} diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pciback/vpci.c --- a/drivers/xen/pciback/vpci.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pciback/vpci.c Wed Nov 26 10:24:15 2008 +0900 @@ -210,3 +210,33 @@ void pciback_release_devices(struct pcib kfree(vpci_dev); pdev->pci_dev_data = NULL; } + +int pciback_get_pcifront_dev(struct pci_dev *pcidev, struct pciback_device *pdev, + unsigned int *domain, unsigned int *bus, unsigned int *devfn) +{ + struct pci_dev_entry *entry; + struct pci_dev *dev = NULL; + struct vpci_dev_data *vpci_dev = pdev->pci_dev_data; + unsigned long flags; + int found = 0, slot; + + spin_lock_irqsave(&vpci_dev->lock, flags); + for (slot = 0; slot < PCI_SLOT_MAX; slot++) { + list_for_each_entry(entry, + &vpci_dev->dev_list[slot], + list) { + dev = entry->dev; + if (dev && dev->bus->number == pcidev->bus->number + && pci_domain_nr(dev->bus) == pci_domain_nr(pcidev->bus) + && dev->devfn == pcidev->devfn) + { + found = 1; + *domain = 0; + *bus = 0; + *devfn = PCI_DEVFN(slot, PCI_FUNC(pcidev->devfn)); + } + } + } + spin_unlock_irqrestore(&vpci_dev->lock, flags); + return found; +} diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pciback/xenbus.c --- a/drivers/xen/pciback/xenbus.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pciback/xenbus.c Wed Nov 26 10:24:15 2008 +0900 @@ -12,6 +12,7 @@ #include "pciback.h" #define INVALID_EVTCHN_IRQ (-1) +struct workqueue_struct *pciback_wq; static struct pciback_device *alloc_pdev(struct xenbus_device *xdev) { @@ -694,11 +695,17 @@ int __init pciback_xenbus_register(void) { if (!is_running_on_xen()) return -ENODEV; - + pciback_wq = create_workqueue("pciback_workqueue"); + if (!pciback_wq) { + printk(KERN_ERR "pciback_xenbus_register: create" + "pciback_workqueue failed\n"); + return -EFAULT; + } return xenbus_register_backend(&xenbus_pciback_driver); } void __exit pciback_xenbus_unregister(void) { + destroy_workqueue(pciback_wq); xenbus_unregister_driver(&xenbus_pciback_driver); } diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pcifront/pci_op.c --- a/drivers/xen/pcifront/pci_op.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pcifront/pci_op.c Wed Nov 26 10:24:15 2008 +0900 @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include "pcifront.h" @@ -151,6 +152,15 @@ static int errno_to_pcibios_err(int errn return PCIBIOS_SET_FAILED; } return errno; +} + +static inline void schedule_pcifront_aer_op(struct pcifront_device *pdev) +{ + if (test_bit(_XEN_PCIB_active, (unsigned long *)&pdev->sh_info->flags) + && !test_and_set_bit(_PDEVB_op_active, &pdev->flags)) { + dev_dbg(&pdev->xdev->dev, "schedule aer frontend job\n"); + schedule_work(&pdev->op_work); + } } static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) @@ -199,6 +209,18 @@ static int do_pci_op(struct pcifront_dev } } + /* + * We might lose backend service request since we + * reuse same evtchn with pci_conf backend response. So re-schedule + * aer pcifront service. + */ + if (test_bit(_XEN_PCIB_active, + (unsigned long*)&pdev->sh_info->flags)) { + dev_err(&pdev->xdev->dev, + "schedule aer pcifront service\n"); + schedule_pcifront_aer_op(pdev); + } + memcpy(op, active_op, sizeof(struct xen_pci_op)); err = op->err; @@ -549,3 +571,96 @@ void pcifront_free_roots(struct pcifront kfree(bus_entry); } } + +static pci_ers_result_t pcifront_common_process( int cmd, struct pcifront_device *pdev, + pci_channel_state_t state) +{ + pci_ers_result_t result; + struct pci_driver *pdrv; + int bus = pdev->sh_info->aer_op.bus; + int devfn = pdev->sh_info->aer_op.devfn; + struct pci_dev *pcidev; + int flag = 0; + + dev_dbg(&pdev->xdev->dev, + "pcifront AER process: cmd %x (bus:%x, devfn%x)", + cmd, bus, devfn); + result = PCI_ERS_RESULT_NONE; + + pcidev = pci_get_bus_and_slot(bus, devfn); + if (!pcidev || !pcidev->driver){ + dev_err(&pcidev->dev, + "device or driver is NULL\n"); + return result; + } + pdrv = pcidev->driver; + + if (get_driver(&pdrv->driver)) { + if (pdrv->err_handler && pdrv->err_handler->error_detected) { + dev_dbg(&pcidev->dev, + "trying to call AER service\n"); + if (pcidev) { + flag = 1; + switch(cmd) { + case XEN_PCI_OP_aer_detected: + result = pdrv->err_handler->error_detected(pcidev, state); + break; + case XEN_PCI_OP_aer_mmio: + result = pdrv->err_handler->mmio_enabled(pcidev); + break; + case XEN_PCI_OP_aer_slotreset: + result = pdrv->err_handler->slot_reset(pcidev); + break; + case XEN_PCI_OP_aer_resume: + pdrv->err_handler->resume(pcidev); + break; + default: + dev_err(&pdev->xdev->dev, + "bad request in aer recovery operation!\n"); + + } + } + } + put_driver(&pdrv->driver); + } + if (!flag) + result = PCI_ERS_RESULT_NONE; + + return result; +} + + +void pcifront_do_aer(void *data) +{ + struct pcifront_device *pdev = data; + int cmd = pdev->sh_info->aer_op.cmd; + pci_channel_state_t state = + (pci_channel_state_t)pdev->sh_info->aer_op.err; + + /*If a pci_conf op is in progress, + we have to wait until it is done before service aer op*/ + dev_dbg(&pdev->xdev->dev, + "pcifront service aer bus %x devfn %x\n", pdev->sh_info->aer_op.bus, + pdev->sh_info->aer_op.devfn); + + pdev->sh_info->aer_op.err = pcifront_common_process(cmd, pdev, state); + + wmb(); + clear_bit(_XEN_PCIB_active, (unsigned long*)&pdev->sh_info->flags); + notify_remote_via_evtchn(pdev->evtchn); + + /*in case of we lost an aer request in four lines time_window*/ + smp_mb__before_clear_bit(); + clear_bit( _PDEVB_op_active, &pdev->flags); + smp_mb__after_clear_bit(); + + schedule_pcifront_aer_op(pdev); + +} + +irqreturn_t pcifront_handler_aer(int irq, void *dev, struct pt_regs *regs) +{ + struct pcifront_device *pdev = dev; + schedule_pcifront_aer_op(pdev); + return IRQ_HANDLED; +} diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pcifront/pcifront.h --- a/drivers/xen/pcifront/pcifront.h Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pcifront/pcifront.h Wed Nov 26 10:24:15 2008 +0900 @@ -10,12 +10,18 @@ #include #include #include +#include #include +#include +#include struct pci_bus_entry { struct list_head list; struct pci_bus *bus; }; + +#define _PDEVB_op_active (0) +#define PDEVB_op_active (1 << (_PDEVB_op_active)) struct pcifront_device { struct xenbus_device *xdev; @@ -28,6 +34,9 @@ struct pcifront_device { /* Lock this when doing any operations in sh_info */ spinlock_t sh_info_lock; struct xen_pci_sharedinfo *sh_info; + struct work_struct op_work; + unsigned long flags; + }; int pcifront_connect(struct pcifront_device *pdev); @@ -39,4 +48,8 @@ int pcifront_rescan_root(struct pcifront unsigned int domain, unsigned int bus); void pcifront_free_roots(struct pcifront_device *pdev); +void pcifront_do_aer( void *data); + +irqreturn_t pcifront_handler_aer(int irq, void *dev, struct pt_regs *regs); + #endif /* __XEN_PCIFRONT_H__ */ diff -r 61d1f2810617 -r 6591b4869889 drivers/xen/pcifront/xenbus.c --- a/drivers/xen/pcifront/xenbus.c Tue Nov 04 12:43:37 2008 +0900 +++ b/drivers/xen/pcifront/xenbus.c Wed Nov 26 10:24:15 2008 +0900 @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "pcifront.h" @@ -34,6 +35,9 @@ static struct pcifront_device *alloc_pde } pdev->sh_info->flags = 0; + /*Flag for registering PV AER handler*/ + set_bit(_XEN_PCIB_AERHANDLER, (void*)&pdev->sh_info->flags); + xdev->dev.driver_data = pdev; pdev->xdev = xdev; @@ -45,6 +49,8 @@ static struct pcifront_device *alloc_pde pdev->evtchn = INVALID_EVTCHN; pdev->gnt_ref = INVALID_GRANT_REF; + INIT_WORK(&pdev->op_work, pcifront_do_aer, pdev); + dev_dbg(&xdev->dev, "Allocated pdev @ 0x%p pdev->sh_info @ 0x%p\n", pdev, pdev->sh_info); out: @@ -56,6 +62,11 @@ static void free_pdev(struct pcifront_de dev_dbg(&pdev->xdev->dev, "freeing pdev @ 0x%p\n", pdev); pcifront_free_roots(pdev); + + /*For PCIE_AER error handling job*/ + cancel_delayed_work(&pdev->op_work); + flush_scheduled_work(); + unbind_from_irqhandler(pdev->evtchn, pdev); if (pdev->evtchn != INVALID_EVTCHN) xenbus_free_evtchn(pdev->xdev, pdev->evtchn); @@ -83,6 +94,9 @@ static int pcifront_publish_info(struct err = xenbus_alloc_evtchn(pdev->xdev, &pdev->evtchn); if (err) goto out; + + bind_caller_port_to_irqhandler(pdev->evtchn, pcifront_handler_aer, + SA_SAMPLE_RANDOM, "pcifront", pdev); do_publish: err = xenbus_transaction_start(&trans); diff -r 61d1f2810617 -r 6591b4869889 include/asm-i386/mach-xen/asm/hypercall.h --- a/include/asm-i386/mach-xen/asm/hypercall.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/asm-i386/mach-xen/asm/hypercall.h Wed Nov 26 10:24:15 2008 +0900 @@ -280,13 +280,6 @@ HYPERVISOR_event_channel_op( } static inline int __must_check -HYPERVISOR_acm_op( - int cmd, void *arg) -{ - return _hypercall2(int, acm_op, cmd, arg); -} - -static inline int __must_check HYPERVISOR_xen_version( int cmd, void *arg) { diff -r 61d1f2810617 -r 6591b4869889 include/asm-x86_64/mach-xen/asm/hypercall.h --- a/include/asm-x86_64/mach-xen/asm/hypercall.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/asm-x86_64/mach-xen/asm/hypercall.h Wed Nov 26 10:24:15 2008 +0900 @@ -278,13 +278,6 @@ HYPERVISOR_event_channel_op( } static inline int __must_check -HYPERVISOR_acm_op( - int cmd, void *arg) -{ - return _hypercall2(int, acm_op, cmd, arg); -} - -static inline int __must_check HYPERVISOR_xen_version( int cmd, void *arg) { diff -r 61d1f2810617 -r 6591b4869889 include/linux/aer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/linux/aer.h Wed Nov 26 10:24:15 2008 +0900 @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2006 Intel Corp. + * Tom Long Nguyen (tom.l.nguyen@intel.com) + * Zhang Yanmin (yanmin.zhang@intel.com) + */ + +#ifndef _AER_H_ +#define _AER_H_ + +#if defined(CONFIG_PCIEAER) +/* pci-e port driver needs this function to enable aer */ +extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); +extern int pci_find_aer_capability(struct pci_dev *dev); +extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); +extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); +#else +#define pci_enable_pcie_error_reporting(dev) do { } while (0) +#define pci_find_aer_capability(dev) do { } while (0) +#define pci_disable_pcie_error_reporting(dev) do { } while (0) +#define pci_cleanup_aer_uncorrect_error_status(dev) do { } while (0) +#endif + +#endif //_AER_H_ + diff -r 61d1f2810617 -r 6591b4869889 include/linux/pci.h --- a/include/linux/pci.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/linux/pci.h Wed Nov 26 10:24:15 2008 +0900 @@ -456,6 +456,7 @@ struct pci_dev *pci_get_subsys (unsigned unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from); struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); +struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); int pci_dev_present(const struct pci_device_id *ids); @@ -655,6 +656,11 @@ static inline struct pci_dev *pci_find_s static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) { return NULL; } + +static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) +{ + return NULL; +} static inline struct pci_dev *pci_get_device (unsigned int vendor, unsigned int device, struct pci_dev *from) { return NULL; } diff -r 61d1f2810617 -r 6591b4869889 include/linux/pci_ids.h --- a/include/linux/pci_ids.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/linux/pci_ids.h Wed Nov 26 10:24:15 2008 +0900 @@ -2219,6 +2219,9 @@ #define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a #define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 #define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 +#define PCI_DEVICE_ID_INTEL_PCH_LPC_MIN 0x3b00 +#define PCI_DEVICE_ID_INTEL_PCH_LPC_MAX 0x3b1f +#define PCI_DEVICE_ID_INTEL_PCH_SMBUS 0x3b30 #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 diff -r 61d1f2810617 -r 6591b4869889 include/linux/pcieport_if.h --- a/include/linux/pcieport_if.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/linux/pcieport_if.h Wed Nov 26 10:24:15 2008 +0900 @@ -62,6 +62,12 @@ struct pcie_port_service_driver { int (*suspend) (struct pcie_device *dev, pm_message_t state); int (*resume) (struct pcie_device *dev); + /* Service Error Recovery Handler */ + struct pci_error_handlers *err_handler; + + /* Link Reset Capability - AER service driver specific */ + pci_ers_result_t (*reset_link) (struct pci_dev *dev); + const struct pcie_port_service_id *id_table; struct device_driver driver; }; diff -r 61d1f2810617 -r 6591b4869889 include/xen/interface/features.h --- a/include/xen/interface/features.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/xen/interface/features.h Wed Nov 26 10:24:15 2008 +0900 @@ -62,6 +62,12 @@ /* x86: Does this Xen host support the MMU_{CLEAR,COPY}_PAGE hypercall? */ #define XENFEAT_highmem_assist 6 +/* + * If set, GNTTABOP_map_grant_ref honors flags to be placed into guest kernel + * available pte bits. + */ +#define XENFEAT_gnttab_map_avail_bits 7 + #define XENFEAT_NR_SUBMAPS 1 #endif /* __XEN_PUBLIC_FEATURES_H__ */ diff -r 61d1f2810617 -r 6591b4869889 include/xen/interface/grant_table.h --- a/include/xen/interface/grant_table.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/xen/interface/grant_table.h Wed Nov 26 10:24:15 2008 +0900 @@ -360,7 +360,7 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and /* - * Bitfield values for update_pin_status.flags. + * Bitfield values for gnttab_map_grant_ref.flags. */ /* Map the grant entry for access by I/O devices. */ #define _GNTMAP_device_map (0) @@ -388,6 +388,13 @@ DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and #define GNTMAP_contains_pte (1<<_GNTMAP_contains_pte) /* + * Bits to be placed in guest kernel available PTE bits (architecture + * dependent; only supported when XENFEAT_gnttab_map_avail_bits is set). + */ +#define _GNTMAP_guest_avail0 (16) +#define GNTMAP_guest_avail_mask ((uint32_t)~0 << _GNTMAP_guest_avail0) + +/* * Values for error status returns. All errors are -ve. */ #define GNTST_okay (0) /* Normal return. */ diff -r 61d1f2810617 -r 6591b4869889 include/xen/interface/io/pciif.h --- a/include/xen/interface/io/pciif.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/xen/interface/io/pciif.h Wed Nov 26 10:24:15 2008 +0900 @@ -30,14 +30,22 @@ /* xen_pci_sharedinfo flags */ #define _XEN_PCIF_active (0) #define XEN_PCIF_active (1<<_XEN_PCI_active) +#define _XEN_PCIB_AERHANDLER (1) +#define XEN_PCIB_AERHANDLER (1<<_XEN_PCIB_AERHANDLER) +#define _XEN_PCIB_active (2) +#define XEN_PCIB_active (1<<_XEN_PCIB_active) /* xen_pci_op commands */ -#define XEN_PCI_OP_conf_read (0) -#define XEN_PCI_OP_conf_write (1) -#define XEN_PCI_OP_enable_msi (2) -#define XEN_PCI_OP_disable_msi (3) -#define XEN_PCI_OP_enable_msix (4) -#define XEN_PCI_OP_disable_msix (5) +#define XEN_PCI_OP_conf_read (0) +#define XEN_PCI_OP_conf_write (1) +#define XEN_PCI_OP_enable_msi (2) +#define XEN_PCI_OP_disable_msi (3) +#define XEN_PCI_OP_enable_msix (4) +#define XEN_PCI_OP_disable_msix (5) +#define XEN_PCI_OP_aer_detected (6) +#define XEN_PCI_OP_aer_resume (7) +#define XEN_PCI_OP_aer_mmio (8) +#define XEN_PCI_OP_aer_slotreset (9) /* xen_pci_op error numbers */ #define XEN_PCI_ERR_success (0) @@ -82,10 +90,25 @@ struct xen_pci_op { struct xen_msix_entry msix_entries[SH_INFO_MAX_VEC]; }; +/*used for pcie aer handling*/ +struct xen_pcie_aer_op +{ + + /* IN: what action to perform: XEN_PCI_OP_* */ + uint32_t cmd; + /*IN/OUT: return aer_op result or carry error_detected state as input*/ + int32_t err; + + /* IN: which device to touch */ + uint32_t domain; /* PCI Domain/Segment*/ + uint32_t bus; + uint32_t devfn; +}; struct xen_pci_sharedinfo { /* flags - XEN_PCIF_* */ uint32_t flags; struct xen_pci_op op; + struct xen_pcie_aer_op aer_op; }; #endif /* __XEN_PCI_COMMON_H__ */ diff -r 61d1f2810617 -r 6591b4869889 include/xen/interface/kexec.h --- a/include/xen/interface/kexec.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/xen/interface/kexec.h Wed Nov 26 10:24:15 2008 +0900 @@ -155,27 +155,6 @@ typedef struct xen_kexec_range { unsigned long start; } xen_kexec_range_t; -/* vmcoreinfo stuff */ -#define VMCOREINFO_BYTES (4096) -#define VMCOREINFO_NOTE_NAME "VMCOREINFO_XEN" -void arch_crash_save_vmcoreinfo(void); -void vmcoreinfo_append_str(const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); -#define VMCOREINFO_PAGESIZE(value) \ - vmcoreinfo_append_str("PAGESIZE=%ld\n", value) -#define VMCOREINFO_SYMBOL(name) \ - vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name) -#define VMCOREINFO_SYMBOL_ALIAS(alias, name) \ - vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #alias, (unsigned long)&name) -#define VMCOREINFO_STRUCT_SIZE(name) \ - vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(struct name)) -#define VMCOREINFO_OFFSET(name, field) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \ - (unsigned long)offsetof(struct name, field)) -#define VMCOREINFO_OFFSET_ALIAS(name, field, alias) \ - vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #alias, \ - (unsigned long)offsetof(struct name, field)) - #endif /* _XEN_PUBLIC_KEXEC_H */ /* diff -r 61d1f2810617 -r 6591b4869889 include/xen/interface/trace.h --- a/include/xen/interface/trace.h Tue Nov 04 12:43:37 2008 +0900 +++ b/include/xen/interface/trace.h Wed Nov 26 10:24:15 2008 +0900 @@ -142,7 +142,9 @@ #define TRC_HVM_INVLPG64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x14) #define TRC_HVM_MCE (TRC_HVM_HANDLER + 0x15) #define TRC_HVM_IO_ASSIST (TRC_HVM_HANDLER + 0x16) +#define TRC_HVM_IO_ASSIST64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x16) #define TRC_HVM_MMIO_ASSIST (TRC_HVM_HANDLER + 0x17) +#define TRC_HVM_MMIO_ASSIST64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x17) #define TRC_HVM_CLTS (TRC_HVM_HANDLER + 0x18) #define TRC_HVM_LMSW (TRC_HVM_HANDLER + 0x19) #define TRC_HVM_LMSW64 (TRC_HVM_HANDLER + TRC_64_FLAG + 0x19) diff -r 61d1f2810617 -r 6591b4869889 kernel/kexec.c --- a/kernel/kexec.c Tue Nov 04 12:43:37 2008 +0900 +++ b/kernel/kexec.c Wed Nov 26 10:24:15 2008 +0900 @@ -368,9 +368,6 @@ static void kimage_free_pages(struct pag count = 1 << order; for (i = 0; i < count; i++) ClearPageReserved(page + i); -#ifdef CONFIG_XEN - xen_destroy_contiguous_region((unsigned long)page_address(page), order); -#endif __free_pages(page, order); } diff -r 61d1f2810617 -r 6591b4869889 sound/pci/hda/hda_intel.c --- a/sound/pci/hda/hda_intel.c Tue Nov 04 12:43:37 2008 +0900 +++ b/sound/pci/hda/hda_intel.c Wed Nov 26 10:24:15 2008 +0900 @@ -82,6 +82,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}, "{Intel, ICH8}," "{Intel, ICH9}," "{Intel, ICH10}," + "{Intel, PCH}," "{ATI, SB450}," "{ATI, SB600}," "{ATI, RS600}," @@ -1640,6 +1641,7 @@ static struct pci_device_id azx_ids[] = { 0x8086, 0x293f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */ { 0x8086, 0x3a3e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */ { 0x8086, 0x3a6e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH10 */ + { 0x8086, 0x3b56, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* PCH */ { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */ { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:02:36 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:02:36 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5Qap-0004Nm-Ry; Wed, 26 Nov 2008 12:02:35 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYs-0003K2-BU for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:34 -0800 X-ASG-Debug-ID: 1227729633-36a9000c0000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 010D9EB8E0 for ; Wed, 26 Nov 2008 12:00:33 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 7je7vLmp5HrTz50L for ; Wed, 26 Nov 2008 12:00:33 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738331 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738331" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:30 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0TnX016095 for ; Wed, 26 Nov 2008 12:00:29 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0r0J020326 for ; Wed, 26 Nov 2008 12:00:53 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0rsh020325 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:53 -0800 Message-Id: <200811262000.mAQK0rsh020325@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:52 -0800 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-3.2-testing] x86: fix a typo X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729634 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-3.2-testing] x86: fix a typo X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227008370 0 # Node ID c13f04a8b6a1458f8c01f814d08f31080bd38276 # Parent 2d5d030ea5501e797848d5269cb8801a927bcdc4 x86: fix a typo Signed-off-by Kevin Tian xen-unstable changeset: 18755:1e437b5b418a1c47c96f8c65442bc63ab35f671c xen-unstable date: Wed Nov 05 10:26:19 2008 +0000 --- xen/arch/x86/cpu/mcheck/p4.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 2d5d030ea550 -r c13f04a8b6a1 xen/arch/x86/cpu/mcheck/p4.c --- a/xen/arch/x86/cpu/mcheck/p4.c Tue Nov 04 13:15:11 2008 +0000 +++ b/xen/arch/x86/cpu/mcheck/p4.c Tue Nov 18 11:39:30 2008 +0000 @@ -51,7 +51,7 @@ static void intel_thermal_interrupt(stru ack_APIC_irq(); - if (NOW() > next[cpu]) + if (NOW() < next[cpu]) return; next[cpu] = NOW() + MILLISECS(5000); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:02:41 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:02:41 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5Qav-0004RY-GR; Wed, 26 Nov 2008 12:02:41 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYs-0003KH-PD for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:34 -0800 X-ASG-Debug-ID: 1227729633-36a9000c0001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 5EF56EB8F5 for ; Wed, 26 Nov 2008 12:00:34 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id CMZxCiAJyAK0bz4m for ; Wed, 26 Nov 2008 12:00:34 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738332 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738332" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:31 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0U19016098 for ; Wed, 26 Nov 2008 12:00:30 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0sYn020343 for ; Wed, 26 Nov 2008 12:00:54 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0sbT020342 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:54 -0800 Message-Id: <200811262000.mAQK0sbT020342@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:53 -0800 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-3.2-testing] x86, vmx realmode: Stack manipulation on interrupt/exception injection X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729634 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [xen-3.2-testing] x86, vmx realmode: Stack manipulation on interrupt/exception injection X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227008583 0 # Node ID 9cf32a0f8233d5bf6c35f1cdd10758416cd40207 # Parent c13f04a8b6a1458f8c01f814d08f31080bd38276 x86, vmx realmode: Stack manipulation on interrupt/exception injection should respect SS size, not CS size. Signed-off-by: Keir Fraser xen-unstable changeset: 18761:832efb028a1dc72fb52edc11c958fd19f8542e48 xen-unstable date: Fri Nov 07 17:06:21 2008 +0000 vmx: Fix realmode exception delivery to correctly check stack pointer size. Bug tracked down by Tim Deegan Signed-off-by: Keir Fraser xen-unstable changeset: 18766:92d0e13b0ea365f019116450910bb0f3819c109c xen-unstable date: Tue Nov 11 11:10:59 2008 +0000 --- xen/arch/x86/hvm/vmx/realmode.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -r c13f04a8b6a1 -r 9cf32a0f8233 xen/arch/x86/hvm/vmx/realmode.c --- a/xen/arch/x86/hvm/vmx/realmode.c Tue Nov 18 11:39:30 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/realmode.c Tue Nov 18 11:43:03 2008 +0000 @@ -90,7 +90,8 @@ static void realmode_deliver_exception( frame[1] = csr->sel; frame[2] = regs->eflags & ~X86_EFLAGS_RF; - if ( rm_ctxt->ctxt.addr_size == 32 ) + /* We can't test rm_ctxt->ctxt.sp_size: it may not be initialised. */ + if ( rm_ctxt->seg_reg[x86_seg_ss].attr.fields.db ) { regs->esp -= 6; pstk = regs->esp; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed Nov 26 12:02:47 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Wed, 26 Nov 2008 12:02:47 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5Qb1-0004VI-4a; Wed, 26 Nov 2008 12:02:47 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5QYt-0003KS-5E for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:35 -0800 X-ASG-Debug-ID: 1227729633-36a9000c0002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id B9964EB8FA for ; Wed, 26 Nov 2008 12:00:34 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 4g78a5nA1LDDbXK0 for ; Wed, 26 Nov 2008 12:00:34 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2738333 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,670,1220241600"; d="scan'208";a="2738333" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 Nov 2008 15:00:32 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0V43016101 for ; Wed, 26 Nov 2008 12:00:31 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mAQK0tuh020362 for ; Wed, 26 Nov 2008 12:00:55 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mAQK0tpR020361 for xen-changelog@lists.xensource.com; Wed, 26 Nov 2008 12:00:55 -0800 Message-Id: <200811262000.mAQK0tpR020361@xenbits.xensource.com> Date: Wed, 26 Nov 2008 12:00:54 -0800 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-3.2-testing] x86_emulate: Fix backport of movnti emulation. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227729634 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11233 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-3.2-testing] x86_emulate: Fix backport of movnti emulation. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227266900 0 # Node ID b9cf7df7284fae486a323e0cd85edc8e80a984b9 # Parent 9cf32a0f8233d5bf6c35f1cdd10758416cd40207 x86_emulate: Fix backport of movnti emulation. Signed-off-by: Keir Fraser xen-3.3-testing changeset: 18497:9ad637d845a5eb24a2eb868d8f26a9df54109a82 xen-3.3-testing date: Fri Nov 21 11:25:43 2008 +0000 --- xen/arch/x86/x86_emulate.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff -r 9cf32a0f8233 -r b9cf7df7284f xen/arch/x86/x86_emulate.c --- a/xen/arch/x86/x86_emulate.c Tue Nov 18 11:43:03 2008 +0000 +++ b/xen/arch/x86/x86_emulate.c Fri Nov 21 11:28:20 2008 +0000 @@ -3132,6 +3132,12 @@ x86_emulate( case 8: *src.reg = dst.val; break; } goto add; + + case 0xc3: /* movnti */ + /* Ignore the non-temporal hint for now. */ + generate_exception_if(dst.bytes <= 2, EXC_UD); + dst.val = src.val; + break; } goto writeback; @@ -3340,12 +3346,6 @@ x86_emulate( src.val = x86_seg_gs; goto pop_seg; - case 0xc3: /* movnti */ - /* Ignore the non-temporal hint for now. */ - generate_exception_if(dst.bytes <= 2, EXC_UD); - dst.val = src.val; - break; - case 0xc7: /* Grp9 (cmpxchg8b) */ #if defined(__i386__) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu Nov 27 12:10:07 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Thu, 27 Nov 2008 12:10:07 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5nBf-0000sc-J5; Thu, 27 Nov 2008 12:10:07 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5nBd-0000s8-N1 for xen-changelog@lists.xensource.com; Thu, 27 Nov 2008 12:10:05 -0800 X-ASG-Debug-ID: 1227816603-4bb800000000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 9B2F2EC390 for ; Thu, 27 Nov 2008 12:10:03 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id HFIZg8TpxqBhAgev for ; Thu, 27 Nov 2008 12:10:03 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2741860 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,676,1220241600"; d="scan'208";a="2741860" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 Nov 2008 15:10:02 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mARKA1q6017112 for ; Thu, 27 Nov 2008 12:10:01 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mARKAPUC012312 for ; Thu, 27 Nov 2008 12:10:25 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mARKAPsX012311 for xen-changelog@lists.xensource.com; Thu, 27 Nov 2008 12:10:25 -0800 Message-Id: <200811272010.mARKAPsX012311@xenbits.xensource.com> Date: Thu, 27 Nov 2008 12:10:24 -0800 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-3.2-testing] xen: Fix gcc 4.3 build failure. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227816603 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11323 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-3.2-testing] xen: Fix gcc 4.3 build failure. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227791425 0 # Node ID 007fc1ed1014e27f7615c1eeb62baef856ce8357 # Parent b9cf7df7284fae486a323e0cd85edc8e80a984b9 xen: Fix gcc 4.3 build failure. Signed-off-by: Keir Fraser xen-unstable changeset: 18811:4ccee1299bc7feab06a95495e2086d04d1b6e960 xen-unstable date: Wed Nov 26 11:07:44 2008 +0000 --- xen/drivers/char/console.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r b9cf7df7284f -r 007fc1ed1014 xen/drivers/char/console.c --- a/xen/drivers/char/console.c Fri Nov 21 11:28:20 2008 +0000 +++ b/xen/drivers/char/console.c Thu Nov 27 13:10:25 2008 +0000 @@ -925,7 +925,7 @@ void panic(const char *fmt, ...) console_start_sync(); printk("\n****************************************\n"); printk("Panic on CPU %d:\n", smp_processor_id()); - printk(buf); + printk("%s", buf); printk("****************************************\n\n"); if ( opt_noreboot ) printk("Manual reset required ('noreboot' specified)\n"); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu Nov 27 12:10:13 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Thu, 27 Nov 2008 12:10:13 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L5nBk-0000vv-Pz; Thu, 27 Nov 2008 12:10:12 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L5nBe-0000sE-80 for xen-changelog@lists.xensource.com; Thu, 27 Nov 2008 12:10:06 -0800 X-ASG-Debug-ID: 1227816603-4bb800000001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 7F97EEC4E8 for ; Thu, 27 Nov 2008 12:10:04 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id hT8NPDNrnbpB9AdL for ; Thu, 27 Nov 2008 12:10:04 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2741861 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,676,1220241600"; d="scan'208";a="2741861" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 Nov 2008 15:10:03 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mARKA31o017115 for ; Thu, 27 Nov 2008 12:10:03 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mARKARhw012333 for ; Thu, 27 Nov 2008 12:10:27 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mARKAQsM012328 for xen-changelog@lists.xensource.com; Thu, 27 Nov 2008 12:10:26 -0800 Message-Id: <200811272010.mARKAQsM012328@xenbits.xensource.com> Date: Thu, 27 Nov 2008 12:10:25 -0800 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [xen-3.2-testing] Avoid warn_unused_result build failure on fgets(). X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227816604 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11323 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [xen-3.2-testing] Avoid warn_unused_result build failure on fgets(). X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227791452 0 # Node ID 32ebe19ec04e6787035562919b55786c3982de1f # Parent 007fc1ed1014e27f7615c1eeb62baef856ce8357 Avoid warn_unused_result build failure on fgets(). Signed-off-by: Keir Fraser xen-unstable changeset: 18839:8d5474a5c66bff3cea07998cafb30817e5b7970c xen-unstable date: Thu Nov 27 12:43:25 2008 +0000 --- xen/tools/symbols.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -r 007fc1ed1014 -r 32ebe19ec04e xen/tools/symbols.c --- a/xen/tools/symbols.c Thu Nov 27 13:10:25 2008 +0000 +++ b/xen/tools/symbols.c Thu Nov 27 13:10:52 2008 +0000 @@ -81,7 +81,8 @@ static int read_symbol(FILE *in, struct if (rc != 3) { if (rc != EOF) { /* skip line */ - fgets(str, 500, in); + if (fgets(str, 500, in) == NULL) + return -1; /* must check fgets result */ } return -1; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri Nov 28 10:49:51 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Fri, 28 Nov 2008 10:49:51 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L68PX-00006U-Bs; Fri, 28 Nov 2008 10:49:51 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L68PU-00005m-Lm for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:49:48 -0800 X-ASG-Debug-ID: 1227898187-13a0002b0000-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 98BE7E77E9 for ; Fri, 28 Nov 2008 10:49:47 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id 0JJSCYUISseFgWd5 for ; Fri, 28 Nov 2008 10:49:47 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2744488 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,683,1220241600"; d="scan'208";a="2744488" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 Nov 2008 13:49:46 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mASInjQc018301 for ; Fri, 28 Nov 2008 10:49:45 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mASIo9NK028330 for ; Fri, 28 Nov 2008 10:50:09 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mASIo9W9028329 for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:50:09 -0800 Message-Id: <200811281850.mASIo9W9028329@xenbits.xensource.com> Date: Fri, 28 Nov 2008 10:50:08 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] dom0 linux: Fix and cleanup reassigning memory resource code. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227898187 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11412 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] dom0 linux: Fix and cleanup reassigning memory resource code. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227877656 0 # Node ID 2268be46c75ec6eddb7cd387af8a236a565f6140 # Parent 0b859c9516ba7831904d5437c7cdc0da07ecf12a dom0 linux: Fix and cleanup reassigning memory resource code. When we use PCI pass-through, we have to assign page-aligned resources to device. To do this, we round up the alignment to PAGE_SIZE, if device is specified by "reassigndev=" boot parameter. "pdev_sort_resources" function uses the alignment. But it does not round up the alignment to PAGE_SIZE. This patch makes "pdev_sort_resources" function round up the alignment to PAGE_SIZE. "pbus_size_mem" function round up the alignment of bridge's resource window as well as that of normal resource. But we don't need to do this. This patch makes "pbus_size_mem" function exclude bridges's resource window. This patch also cleanups code of reassigning memory resource. Signed-off-by: Yuji Shimada --- drivers/pci/pci.h | 1 - drivers/pci/quirks.c | 3 ++- drivers/pci/setup-bus.c | 2 +- drivers/pci/setup-res.c | 10 ++++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff -r 0b859c9516ba -r 2268be46c75e drivers/pci/pci.h --- a/drivers/pci/pci.h Wed Nov 26 11:13:49 2008 +0000 +++ b/drivers/pci/pci.h Fri Nov 28 13:07:36 2008 +0000 @@ -104,5 +104,4 @@ extern void pci_disable_bridge_window(st extern void pci_disable_bridge_window(struct pci_dev *dev); #else #define is_reassigndev(dev) 0 -static inline void pci_disable_bridge_window(struct pci_dev *dev) {} #endif diff -r 0b859c9516ba -r 2268be46c75e drivers/pci/quirks.c --- a/drivers/pci/quirks.c Wed Nov 26 11:13:49 2008 +0000 +++ b/drivers/pci/quirks.c Fri Nov 28 13:07:36 2008 +0000 @@ -24,6 +24,7 @@ #include "pci.h" +#ifdef CONFIG_PCI_REASSIGN /* * This quirk function disables the device and releases resources * which is specified by kernel's boot parameter 'reassigndev'. @@ -66,10 +67,10 @@ static void __devinit quirk_release_reso (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { pci_disable_bridge_window(dev); } - return; } } DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_release_resources); +#endif /* CONFIG_PCI_REASSIGN */ /* The Mellanox Tavor device gives false positive parity errors * Mark this device with a broken_parity_status, to allow diff -r 0b859c9516ba -r 2268be46c75e drivers/pci/setup-bus.c --- a/drivers/pci/setup-bus.c Wed Nov 26 11:13:49 2008 +0000 +++ b/drivers/pci/setup-bus.c Fri Nov 28 13:07:36 2008 +0000 @@ -355,7 +355,7 @@ pbus_size_mem(struct pci_bus *bus, unsig continue; r_size = r->end - r->start + 1; - if (reassign) + if ((i < PCI_BRIDGE_RESOURCES) && reassign) r_size = ALIGN(r_size, PAGE_SIZE); /* For bridges size != alignment */ diff -r 0b859c9516ba -r 2268be46c75e drivers/pci/setup-res.c --- a/drivers/pci/setup-res.c Wed Nov 26 11:13:49 2008 +0000 +++ b/drivers/pci/setup-res.c Fri Nov 28 13:07:36 2008 +0000 @@ -234,6 +234,7 @@ pdev_sort_resources(struct pci_dev *dev, pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) { int i; + int reassigndev = is_reassigndev(dev); for (i = 0; i < PCI_NUM_RESOURCES; i++) { struct resource *r; @@ -245,6 +246,11 @@ pdev_sort_resources(struct pci_dev *dev, if (!(r->flags) || r->parent) continue; + + if (i < PCI_BRIDGE_RESOURCES && (r->flags & IORESOURCE_MEM) && + reassigndev) + r_align = ALIGN(r_align, PAGE_SIZE); + if (!r_align) { printk(KERN_WARNING "PCI: Ignore bogus resource %d " "[%llx:%llx] of %s\n", @@ -263,6 +269,10 @@ pdev_sort_resources(struct pci_dev *dev, align = (idx < PCI_BRIDGE_RESOURCES) ? ln->res->end - ln->res->start + 1 : ln->res->start; + if ((idx < PCI_BRIDGE_RESOURCES) && + (ln->res->flags & IORESOURCE_MEM) && + is_reassigndev(ln->dev)) + align = ALIGN(align, PAGE_SIZE); } if (r_align > align) { tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri Nov 28 10:49:56 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Fri, 28 Nov 2008 10:49:56 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L68Pc-00009q-OF; Fri, 28 Nov 2008 10:49:56 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L68PV-00005s-06 for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:49:49 -0800 X-ASG-Debug-ID: 1227898187-13a0002b0001-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 1121DE77EB for ; Fri, 28 Nov 2008 10:49:47 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id jEfLljlLH5WVVaJs for ; Fri, 28 Nov 2008 10:49:47 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2744489 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,683,1220241600"; d="scan'208";a="2744489" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 Nov 2008 13:49:47 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mASInkVH018304 for ; Fri, 28 Nov 2008 10:49:46 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mASIoAFK028347 for ; Fri, 28 Nov 2008 10:50:10 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mASIoA00028346 for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:50:10 -0800 Message-Id: <200811281850.mASIoA00028346@xenbits.xensource.com> Date: Fri, 28 Nov 2008 10:50:09 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] linux/x86: use shared page indicating the need for an EOI notification X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227898188 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11412 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] linux/x86: use shared page indicating the need for an EOI notification X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227879027 0 # Node ID d545a95fca739d0b1963b73a9eb64ea64a244e76 # Parent 2268be46c75ec6eddb7cd387af8a236a565f6140 linux/x86: use shared page indicating the need for an EOI notification Signed-off-by: Jan Beulich --- drivers/xen/core/evtchn.c | 64 ++++++++++++++++++++++++++++++++-------- include/xen/interface/physdev.h | 15 +++++++++ 2 files changed, 67 insertions(+), 12 deletions(-) diff -r 2268be46c75e -r d545a95fca73 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Fri Nov 28 13:07:36 2008 +0000 +++ b/drivers/xen/core/evtchn.c Fri Nov 28 13:30:27 2008 +0000 @@ -123,9 +123,6 @@ DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS]) /* Reference counts for bindings to IRQs. */ static int irq_bindcount[NR_IRQS]; -/* Bitmap indicating which PIRQs require Xen to be notified on unmask. */ -static DECLARE_BITMAP(pirq_needs_eoi, NR_PIRQS); - #ifdef CONFIG_SMP static u8 cpu_evtchn[NR_EVENT_CHANNELS]; @@ -756,16 +753,48 @@ static struct hw_interrupt_type dynirq_t .retrigger = resend_irq_on_evtchn, }; -static inline void pirq_unmask_notify(int irq) +/* Bitmap indicating which PIRQs require Xen to be notified on unmask. */ +static bool pirq_eoi_does_unmask; +static DECLARE_BITMAP(pirq_needs_eoi, ALIGN(NR_PIRQS, PAGE_SIZE * 8)) + __attribute__ ((__section__(".bss.page_aligned"), __aligned__(PAGE_SIZE))); + +static void pirq_unmask_and_notify(unsigned int evtchn, unsigned int irq) { struct physdev_eoi eoi = { .irq = evtchn_get_xen_pirq(irq) }; - if (unlikely(test_bit(irq - PIRQ_BASE, pirq_needs_eoi))) - VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); + + if (pirq_eoi_does_unmask) { + if (test_bit(eoi.irq, pirq_needs_eoi)) + VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); + else + unmask_evtchn(evtchn); + } else if (test_bit(irq - PIRQ_BASE, pirq_needs_eoi)) { + if (smp_processor_id() != cpu_from_evtchn(evtchn)) { + struct evtchn_unmask unmask = { .port = evtchn }; + struct multicall_entry mcl[2]; + + mcl[0].op = __HYPERVISOR_event_channel_op; + mcl[0].args[0] = EVTCHNOP_unmask; + mcl[0].args[1] = (unsigned long)&unmask; + mcl[1].op = __HYPERVISOR_physdev_op; + mcl[1].args[0] = PHYSDEVOP_eoi; + mcl[1].args[1] = (unsigned long)&eoi; + + if (HYPERVISOR_multicall(mcl, 2)) + BUG(); + } else { + unmask_evtchn(evtchn); + VOID(HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi)); + } + } else + unmask_evtchn(evtchn); } static inline void pirq_query_unmask(int irq) { struct physdev_irq_status_query irq_status; + + if (pirq_eoi_does_unmask) + return; irq_status.irq = evtchn_get_xen_pirq(irq); if (HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status)) irq_status.flags = 0; @@ -806,8 +835,7 @@ static unsigned int startup_pirq(unsigne irq_info[irq] = mk_irq_info(IRQT_PIRQ, bind_pirq.pirq, evtchn); out: - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); + pirq_unmask_and_notify(evtchn, irq); return 0; } @@ -859,10 +887,8 @@ static void end_pirq(unsigned int irq) if ((irq_desc[irq].status & (IRQ_DISABLED|IRQ_PENDING)) == (IRQ_DISABLED|IRQ_PENDING)) { shutdown_pirq(irq); - } else if (VALID_EVTCHN(evtchn)) { - unmask_evtchn(evtchn); - pirq_unmask_notify(irq); - } + } else if (VALID_EVTCHN(evtchn)) + pirq_unmask_and_notify(evtchn, irq); } static struct hw_interrupt_type pirq_type = { @@ -1011,6 +1037,14 @@ void irq_resume(void) unsigned int cpu, irq, evtchn; init_evtchn_cpu_bindings(); + + if (pirq_eoi_does_unmask) { + struct physdev_pirq_eoi_mfn eoi_mfn; + + eoi_mfn.mfn = virt_to_bus(pirq_needs_eoi) >> PAGE_SHIFT; + if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_mfn, &eoi_mfn)) + BUG(); + } /* New event-channel space is not 'live' yet. */ for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) @@ -1098,8 +1132,14 @@ void __init xen_init_IRQ(void) void __init xen_init_IRQ(void) { unsigned int i; + struct physdev_pirq_eoi_mfn eoi_mfn; init_evtchn_cpu_bindings(); + + BUG_ON(!bitmap_empty(pirq_needs_eoi, PAGE_SIZE * 8)); + eoi_mfn.mfn = virt_to_bus(pirq_needs_eoi) >> PAGE_SHIFT; + if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_mfn, &eoi_mfn) == 0) + pirq_eoi_does_unmask = true; /* No event channels are 'live' right now. */ for (i = 0; i < NR_EVENT_CHANNELS; i++) diff -r 2268be46c75e -r d545a95fca73 include/xen/interface/physdev.h --- a/include/xen/interface/physdev.h Fri Nov 28 13:07:36 2008 +0000 +++ b/include/xen/interface/physdev.h Fri Nov 28 13:30:27 2008 +0000 @@ -41,6 +41,21 @@ DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t); DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t); /* + * Register a shared page for the hypervisor to indicate whether the guest + * must issue PHYSDEVOP_eoi. The semantics of PHYSDEVOP_eoi change slightly + * once the guest used this function in that the associated event channel + * will automatically get unmasked. The page registered is used as a bit + * array indexed by Xen's PIRQ value. + */ +#define PHYSDEVOP_pirq_eoi_mfn 17 +struct physdev_pirq_eoi_mfn { + /* IN */ + xen_pfn_t mfn; +}; +typedef struct physdev_pirq_eoi_mfn physdev_pirq_eoi_mfn_t; +DEFINE_XEN_GUEST_HANDLE(physdev_pirq_eoi_mfn_t); + +/* * Query the status of an IRQ line. * @arg == pointer to physdev_irq_status_query structure. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri Nov 28 10:50:04 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Fri, 28 Nov 2008 10:50:04 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L68Pk-0000ES-BA; Fri, 28 Nov 2008 10:50:04 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L68PV-00005z-Pq for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:49:49 -0800 X-ASG-Debug-ID: 1227898187-13a0002b0002-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id 38367E77EB for ; Fri, 28 Nov 2008 10:49:48 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id BLOEil2SpbnUiFvj for ; Fri, 28 Nov 2008 10:49:48 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2744490 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,683,1220241600"; d="scan'208";a="2744490" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 Nov 2008 13:49:48 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mASInlaC018307 for ; Fri, 28 Nov 2008 10:49:47 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mASIoBX5028364 for ; Fri, 28 Nov 2008 10:50:11 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mASIoBHQ028363 for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:50:11 -0800 Message-Id: <200811281850.mASIoBHQ028363@xenbits.xensource.com> Date: Fri, 28 Nov 2008 10:50:10 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] linux/x86: revert the effect of xen_limit_pages_to_max_mfn() X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227898189 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11412 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M Subject: [Xen-changelog] [linux-2.6.18-xen] linux/x86: revert the effect of xen_limit_pages_to_max_mfn() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227879058 0 # Node ID 39a8680e7a70a28ce639c507fb6a9bc0aa7d8f14 # Parent d545a95fca739d0b1963b73a9eb64ea64a244e76 linux/x86: revert the effect of xen_limit_pages_to_max_mfn() Signed-off-by: Jan Beulich --- arch/i386/mm/hypervisor.c | 43 +++++++++++++++++++++++++++++++++++++----- arch/i386/mm/pgtable-xen.c | 8 ++++++- arch/x86_64/mm/pageattr-xen.c | 8 ++++++- drivers/xen/core/gnttab.c | 5 ++-- drivers/xen/netback/netback.c | 6 ++--- include/linux/page-flags.h | 6 ++--- mm/page_alloc.c | 4 +-- 7 files changed, 63 insertions(+), 17 deletions(-) diff -r d545a95fca73 -r 39a8680e7a70 arch/i386/mm/hypervisor.c --- a/arch/i386/mm/hypervisor.c Fri Nov 28 13:30:27 2008 +0000 +++ b/arch/i386/mm/hypervisor.c Fri Nov 28 13:30:58 2008 +0000 @@ -374,6 +374,15 @@ void xen_destroy_contiguous_region(unsig } EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region); +static void undo_limit_pages(struct page *pages, unsigned int order) +{ + BUG_ON(xen_feature(XENFEAT_auto_translated_physmap)); + BUG_ON(order > MAX_CONTIG_ORDER); + xen_limit_pages_to_max_mfn(pages, order, 0); + ClearPageForeign(pages); + __free_pages(pages, order); +} + int xen_limit_pages_to_max_mfn( struct page *pages, unsigned int order, unsigned int address_bits) { @@ -402,16 +411,28 @@ int xen_limit_pages_to_max_mfn( if (unlikely(order > MAX_CONTIG_ORDER)) return -ENOMEM; - bitmap_zero(limit_map, 1U << order); + if (address_bits) { + if (address_bits < PAGE_SHIFT) + return -EINVAL; + bitmap_zero(limit_map, 1U << order); + } else if (order) { + BUILD_BUG_ON(sizeof(pages->index) != sizeof(*limit_map)); + for (i = 0; i < BITS_TO_LONGS(1U << order); ++i) + limit_map[i] = pages[i + 1].index; + } else + __set_bit(0, limit_map); + set_xen_guest_handle(exchange.in.extent_start, in_frames); set_xen_guest_handle(exchange.out.extent_start, out_frames); /* 0. Scrub the pages. */ for (i = 0, n = 0; i < 1U<> (address_bits - PAGE_SHIFT))) - continue; - __set_bit(i, limit_map); + if (address_bits) { + if (!(pfn_to_mfn(page_to_pfn(page)) >> (address_bits - PAGE_SHIFT))) + continue; + __set_bit(i, limit_map); + } if (!PageHighMem(page)) scrub_pages(page_address(page), 1); @@ -497,7 +518,19 @@ int xen_limit_pages_to_max_mfn( balloon_unlock(flags); - return success ? 0 : -ENOMEM; + if (!success) + return -ENOMEM; + + if (address_bits) { + if (order) { + BUILD_BUG_ON(sizeof(*limit_map) != sizeof(pages->index)); + for (i = 0; i < BITS_TO_LONGS(1U << order); ++i) + pages[i + 1].index = limit_map[i]; + } + SetPageForeign(pages, undo_limit_pages); + } + + return 0; } EXPORT_SYMBOL_GPL(xen_limit_pages_to_max_mfn); diff -r d545a95fca73 -r 39a8680e7a70 arch/i386/mm/pgtable-xen.c --- a/arch/i386/mm/pgtable-xen.c Fri Nov 28 13:30:27 2008 +0000 +++ b/arch/i386/mm/pgtable-xen.c Fri Nov 28 13:30:58 2008 +0000 @@ -152,6 +152,12 @@ pte_t *pte_alloc_one_kernel(struct mm_st return pte; } +static void _pte_free(struct page *page, unsigned int order) +{ + BUG_ON(order); + pte_free(page); +} + struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) { struct page *pte; @@ -162,7 +168,7 @@ struct page *pte_alloc_one(struct mm_str pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); #endif if (pte) { - SetPageForeign(pte, pte_free); + SetPageForeign(pte, _pte_free); init_page_count(pte); } return pte; diff -r d545a95fca73 -r 39a8680e7a70 arch/x86_64/mm/pageattr-xen.c --- a/arch/x86_64/mm/pageattr-xen.c Fri Nov 28 13:30:27 2008 +0000 +++ b/arch/x86_64/mm/pageattr-xen.c Fri Nov 28 13:30:58 2008 +0000 @@ -248,13 +248,19 @@ void _arch_exit_mmap(struct mm_struct *m mm_unpin(mm); } +static void _pte_free(struct page *page, unsigned int order) +{ + BUG_ON(order); + pte_free(page); +} + struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) { struct page *pte; pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); if (pte) { - SetPageForeign(pte, pte_free); + SetPageForeign(pte, _pte_free); init_page_count(pte); } return pte; diff -r d545a95fca73 -r 39a8680e7a70 drivers/xen/core/gnttab.c --- a/drivers/xen/core/gnttab.c Fri Nov 28 13:30:27 2008 +0000 +++ b/drivers/xen/core/gnttab.c Fri Nov 28 13:30:58 2008 +0000 @@ -505,8 +505,9 @@ static int gnttab_map(unsigned int start return 0; } -static void gnttab_page_free(struct page *page) -{ +static void gnttab_page_free(struct page *page, unsigned int order) +{ + BUG_ON(order); ClearPageForeign(page); gnttab_reset_grant_page(page); put_page(page); diff -r d545a95fca73 -r 39a8680e7a70 drivers/xen/netback/netback.c --- a/drivers/xen/netback/netback.c Fri Nov 28 13:30:27 2008 +0000 +++ b/drivers/xen/netback/netback.c Fri Nov 28 13:30:58 2008 +0000 @@ -55,7 +55,6 @@ struct netbk_tx_pending_inuse { }; static void netif_idx_release(u16 pending_idx); -static void netif_page_release(struct page *page); static void make_tx_response(netif_t *netif, netif_tx_request_t *txp, s8 st); @@ -1436,8 +1435,9 @@ static void netif_idx_release(u16 pendin tasklet_schedule(&net_tx_tasklet); } -static void netif_page_release(struct page *page) -{ +static void netif_page_release(struct page *page, unsigned int order) +{ + BUG_ON(order); netif_idx_release(netif_page_index(page)); } diff -r d545a95fca73 -r 39a8680e7a70 include/linux/page-flags.h --- a/include/linux/page-flags.h Fri Nov 28 13:30:27 2008 +0000 +++ b/include/linux/page-flags.h Fri Nov 28 13:30:58 2008 +0000 @@ -252,15 +252,15 @@ #define PageForeign(page) test_bit(PG_foreign, &(page)->flags) #define SetPageForeign(_page, dtor) do { \ set_bit(PG_foreign, &(_page)->flags); \ - BUG_ON((dtor) == (void (*)(struct page *))0); \ + BUG_ON((dtor) == (void (*)(struct page *, unsigned int))0); \ (_page)->index = (long)(dtor); \ } while (0) #define ClearPageForeign(page) do { \ clear_bit(PG_foreign, &(page)->flags); \ (page)->index = 0; \ } while (0) -#define PageForeignDestructor(_page) \ - ((void (*)(struct page *))(_page)->index)(_page) +#define PageForeignDestructor(_page, order) \ + ((void (*)(struct page *, unsigned int))(_page)->index)(_page, order) struct page; /* forward declaration */ diff -r d545a95fca73 -r 39a8680e7a70 mm/page_alloc.c --- a/mm/page_alloc.c Fri Nov 28 13:30:27 2008 +0000 +++ b/mm/page_alloc.c Fri Nov 28 13:30:58 2008 +0000 @@ -453,7 +453,7 @@ static void __free_pages_ok(struct page #ifdef CONFIG_XEN if (PageForeign(page)) { - PageForeignDestructor(page); + PageForeignDestructor(page, order); return; } #endif @@ -737,7 +737,7 @@ static void fastcall free_hot_cold_page( #ifdef CONFIG_XEN if (PageForeign(page)) { - PageForeignDestructor(page); + PageForeignDestructor(page, 0); return; } #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri Nov 28 10:50:12 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Fri, 28 Nov 2008 10:50:12 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L68Ps-0000Iu-5A; Fri, 28 Nov 2008 10:50:12 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L68PW-00006I-Eo for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:49:50 -0800 X-ASG-Debug-ID: 1227898187-13a0002b0003-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id F0095E77EF for ; Fri, 28 Nov 2008 10:49:49 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id VFBIJ5z3xM8cojRk for ; Fri, 28 Nov 2008 10:49:49 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2744491 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,683,1220241600"; d="scan'208";a="2744491" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 Nov 2008 13:49:49 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mASInm5P018310 for ; Fri, 28 Nov 2008 10:49:48 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mASIoCIt028381 for ; Fri, 28 Nov 2008 10:50:12 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mASIoCeD028380 for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:50:12 -0800 Message-Id: <200811281850.mASIoCeD028380@xenbits.xensource.com> Date: Fri, 28 Nov 2008 10:50:12 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] linux/x86: cleanup IO-APIC code X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227898189 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11412 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] linux/x86: cleanup IO-APIC code X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227879081 0 # Node ID 2892ca2b9c17857f6922e803406711881988d850 # Parent 39a8680e7a70a28ce639c507fb6a9bc0aa7d8f14 linux/x86: cleanup IO-APIC code - get 32-bit code in sync with 64-bit wrt ExtINT pin detection being unnecessary - eliminate build warnings resulting from c/s 725 Signed-off-by: Jan Beulich --- arch/i386/kernel/io_apic-xen.c | 14 ++++++++++++-- arch/x86_64/kernel/io_apic-xen.c | 6 ++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff -r 39a8680e7a70 -r 2892ca2b9c17 arch/i386/kernel/io_apic-xen.c --- a/arch/i386/kernel/io_apic-xen.c Fri Nov 28 13:30:58 2008 +0000 +++ b/arch/i386/kernel/io_apic-xen.c Fri Nov 28 13:31:21 2008 +0000 @@ -87,8 +87,10 @@ int (*ioapic_renumber_irq)(int ioapic, i int (*ioapic_renumber_irq)(int ioapic, int irq); atomic_t irq_mis_count; +#ifndef CONFIG_XEN /* Where if anywhere is the i8259 connect in external int mode */ static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; +#endif static DEFINE_SPINLOCK(ioapic_lock); static DEFINE_SPINLOCK(vector_lock); @@ -793,6 +795,7 @@ static int find_irq_entry(int apic, int return -1; } +#ifndef CONFIG_XEN /* * Find the pin to which IRQ[irq] (ISA) is connected */ @@ -842,6 +845,7 @@ static int __init find_isa_irq_apic(int return -1; } +#endif /* * Find a specific PCI IRQ entry. @@ -1687,7 +1691,9 @@ static void __init enable_IO_APIC(void) static void __init enable_IO_APIC(void) { union IO_APIC_reg_01 reg_01; +#ifndef CONFIG_XEN int i8259_apic, i8259_pin; +#endif int i, apic; unsigned long flags; @@ -1708,6 +1714,7 @@ static void __init enable_IO_APIC(void) spin_unlock_irqrestore(&ioapic_lock, flags); nr_ioapic_registers[apic] = reg_01.bits.entries+1; } +#ifndef CONFIG_XEN for(apic = 0; apic < nr_ioapics; apic++) { int pin; /* See if any of the pins is in ExtINT mode */ @@ -1749,6 +1756,7 @@ static void __init enable_IO_APIC(void) { printk(KERN_WARNING "ExtINT in hardware and MP table differ\n"); } +#endif /* * Do not trust the IO-APIC being empty at bootup @@ -2517,6 +2525,8 @@ static int __init io_apic_bug_finalize(v late_initcall(io_apic_bug_finalize); +#ifndef CONFIG_XEN + struct sysfs_ioapic_data { struct sys_device dev; struct IO_APIC_route_entry entry[0]; @@ -2570,10 +2580,8 @@ static int ioapic_resume(struct sys_devi static struct sysdev_class ioapic_sysdev_class = { set_kset_name("ioapic"), -#ifndef CONFIG_XEN .suspend = ioapic_suspend, .resume = ioapic_resume, -#endif }; static int __init ioapic_init_sysfs(void) @@ -2611,6 +2619,8 @@ static int __init ioapic_init_sysfs(void device_initcall(ioapic_init_sysfs); +#endif /* CONFIG_XEN */ + /* -------------------------------------------------------------------------- ACPI-based IOAPIC Configuration -------------------------------------------------------------------------- */ diff -r 39a8680e7a70 -r 2892ca2b9c17 arch/x86_64/kernel/io_apic-xen.c --- a/arch/x86_64/kernel/io_apic-xen.c Fri Nov 28 13:30:58 2008 +0000 +++ b/arch/x86_64/kernel/io_apic-xen.c Fri Nov 28 13:31:21 2008 +0000 @@ -2054,6 +2054,8 @@ void __init setup_IO_APIC(void) print_IO_APIC(); } +#ifndef CONFIG_XEN + struct sysfs_ioapic_data { struct sys_device dev; struct IO_APIC_route_entry entry[0]; @@ -2107,10 +2109,8 @@ static int ioapic_resume(struct sys_devi static struct sysdev_class ioapic_sysdev_class = { set_kset_name("ioapic"), -#ifndef CONFIG_XEN .suspend = ioapic_suspend, .resume = ioapic_resume, -#endif }; static int __init ioapic_init_sysfs(void) @@ -2148,6 +2148,8 @@ static int __init ioapic_init_sysfs(void device_initcall(ioapic_init_sysfs); +#endif /* CONFIG_XEN */ + /* -------------------------------------------------------------------------- ACPI-based IOAPIC Configuration -------------------------------------------------------------------------- */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri Nov 28 10:50:19 2008 Return-path: Envelope-to: www-data@lists.xensource.com Delivery-date: Fri, 28 Nov 2008 10:50:19 -0800 Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1L68Pz-0000N0-H6; Fri, 28 Nov 2008 10:50:19 -0800 Received: from spam.xensource.com ([70.42.241.90]) by lists.xensource.com with esmtp (Exim 4.43) id 1L68PX-00006Z-Ac for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:49:51 -0800 X-ASG-Debug-ID: 1227898187-13a0002b0004-DBsQO9 X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi Received: from SMTP.CITRIX.COM (localhost [127.0.0.1]) by spam.xensource.com (Spam Firewall) with ESMTP id F1EC3E77EF for ; Fri, 28 Nov 2008 10:49:50 -0800 (PST) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by spam.xensource.com with ESMTP id ThrSAneK9x2xIFzs for ; Fri, 28 Nov 2008 10:49:50 -0800 (PST) X-SBRS: 2.9 X-MesageID: 2744492 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.33,683,1220241600"; d="scan'208";a="2744492" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 Nov 2008 13:49:50 -0500 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id mASInnYR018313 for ; Fri, 28 Nov 2008 10:49:49 -0800 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id mASIoDLU028398 for ; Fri, 28 Nov 2008 10:50:13 -0800 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id mASIoD82028397 for xen-changelog@lists.xensource.com; Fri, 28 Nov 2008 10:50:13 -0800 Message-Id: <200811281850.mASIoD82028397@xenbits.xensource.com> Date: Fri, 28 Nov 2008 10:50:13 -0800 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-ASG-Orig-Subj: [linux-2.6.18-xen] evtchn: Fix the build. X-Barracuda-Connect: smtp.citrix.com[66.165.176.89] X-Barracuda-Start-Time: 1227898190 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.11412 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Subject: [Xen-changelog] [linux-2.6.18-xen] evtchn: Fix the build. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1227879698 0 # Node ID cdc6729dc7025594b902ef01795bfafd4c14ea3c # Parent 2892ca2b9c17857f6922e803406711881988d850 evtchn: Fix the build. Signed-off-by: Keir Fraser --- drivers/xen/core/evtchn.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 2892ca2b9c17 -r cdc6729dc702 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Fri Nov 28 13:31:21 2008 +0000 +++ b/drivers/xen/core/evtchn.c Fri Nov 28 13:41:38 2008 +0000 @@ -754,7 +754,7 @@ static struct hw_interrupt_type dynirq_t }; /* Bitmap indicating which PIRQs require Xen to be notified on unmask. */ -static bool pirq_eoi_does_unmask; +static int pirq_eoi_does_unmask; static DECLARE_BITMAP(pirq_needs_eoi, ALIGN(NR_PIRQS, PAGE_SIZE * 8)) __attribute__ ((__section__(".bss.page_aligned"), __aligned__(PAGE_SIZE))); @@ -1139,7 +1139,7 @@ void __init xen_init_IRQ(void) BUG_ON(!bitmap_empty(pirq_needs_eoi, PAGE_SIZE * 8)); eoi_mfn.mfn = virt_to_bus(pirq_needs_eoi) >> PAGE_SHIFT; if (HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_mfn, &eoi_mfn) == 0) - pirq_eoi_does_unmask = true; + pirq_eoi_does_unmask = 1; /* No event channels are 'live' right now. */ for (i = 0; i < NR_EVENT_CHANNELS; i++) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog