From owner-freebsd-acpi@FreeBSD.ORG Fri Oct 29 20:44:19 2010 Return-Path: Delivered-To: acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A37D9106564A; Fri, 29 Oct 2010 20:44:19 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id F2E6B8FC14; Fri, 29 Oct 2010 20:44:18 +0000 (UTC) Received: by bwz3 with SMTP id 3so2918484bwz.13 for ; Fri, 29 Oct 2010 13:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=Nw5iBWwZFXy0fO6iEsf7kIyMCDeRp1h4ya8A4WczQu0=; b=nO+jm9eSrLtdRSzlA7pjxzyAWLvPlHqIdZFXoP0zH3W6oV76nf1JtuHYq/1EXQWjwB nBfzAQmMOIHChq5Saw4JE9grwAMWu9FzA3oZv7aAoNMkv0fCvgmdd8c1fDwzBIUPAW8B hU2p2CxJmXNMCc9K8sThh1Oc6Jf+Zhz60NKWE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=jofGNBbw1byjJu39mK9pFM0GaXjQr7kRDiN1QnDr6IcmAk2I8RRMetRYE6Ufi4XnwJ BxXzPp7m04EKhahpW7jnZZKF+suviYtcu5NpV1s20obETdHUVR8pIv23J0x1Gfbu/JEx ZaKr+U8q1PU/ucpzOXDu5cTeKRlMWR+tLBGiY= Received: by 10.204.76.14 with SMTP id a14mr543436bkk.14.1288385057679; Fri, 29 Oct 2010 13:44:17 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id g8sm1161066bkg.11.2010.10.29.13.44.15 (version=SSLv3 cipher=RC4-MD5); Fri, 29 Oct 2010 13:44:16 -0700 (PDT) Sender: Alexander Motin Message-ID: <4CCB321D.1020502@FreeBSD.org> Date: Fri, 29 Oct 2010 23:44:13 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.24 (X11/20100402) MIME-Version: 1.0 To: Takanori Watanabe References: <201010261904.o9QJ4iwq089834@sana.init-main.com> <4CC732C7.50409@FreeBSD.org> In-Reply-To: <4CC732C7.50409@FreeBSD.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: acpi@freebsd.org, current@freebsd.org Subject: Re: Event based scheduling and USB. X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 20:44:19 -0000 Alexander Motin wrote: > Takanori Watanabe wrote: >> I updated my FreeBSD tree on laptop, to the current >> as of 18 Oct.2010, it works fine with CPU C3 state enabled, >> >> I think this is your achievement of event time scheduler, >> thanks! >> >> But when USB driver is enabled, the load average is considerablly >> high (0.6 to 1.0) if sysctl oid kern.eventtimer.periodic is set to 0. >> Then kern.eventtimer.periodic is set to 1, the load average goes >> to 0 quickly as before, but almost never transit to C3. >> >> Is this behavior expected, or something wrong? >> I noticed one of usb host controller device shares HPET irq. >> When I implement interrupt filter in uhci driver, the load average >> goes to 0 as before. >> >> ==== >> % vmstat -i >> interrupt total rate >> irq1: atkbd0 398 2 >> irq9: acpi0 408 2 >> irq12: psm0 3 0 >> irq19: ehci1 37 0 >> irq20: hpet0 uhci0 35970 230 >> irq22: ehci0 2 0 >> irq256: em0 4 0 >> irq257: ahci0 1692 10 >> Total 38514 246 >> === > > I haven't noticed that issue and it is surely not expected for me. I > will try to reproduce it. I've easily reproduced the problem. Scheduler tracing shows that problem is the result of aliasing between "swi4: clock" thread on one CPU (measuring load average) and "irq21: hpet0 uhci1" thread on another. Those two events are aliased by definition due to shared interrupt source. Not sure what to do with it. Either we should change algorithm of load average calculation or exclude timer's interrupt threads from load average accounting. Adding interrupt filter for USB also reasonably helps, but it is only a partial solution for this specific sharing case. -- Alexander Motin