From owner-freebsd-current@freebsd.org Wed Feb 22 17:12:01 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 752F4CE9C7B for ; Wed, 22 Feb 2017 17:12:01 +0000 (UTC) (envelope-from jiashiun@gmail.com) Received: from mail-qt0-x236.google.com (mail-qt0-x236.google.com [IPv6:2607:f8b0:400d:c0d::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2BF251DE8; Wed, 22 Feb 2017 17:12:01 +0000 (UTC) (envelope-from jiashiun@gmail.com) Received: by mail-qt0-x236.google.com with SMTP id n21so8042917qta.1; Wed, 22 Feb 2017 09:12:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=zR2DBtV+hN62cOl07Z8581m/zEqmKzBF/d3PXEswxUQ=; b=Ak2Vi0FcMrvEFvpZYiiHpHIzkBKUdTvCsGhZYGdh5XGeLoXyTRCt6QKQ2C1d+f93E/ zWrdMv83CMwiEWB83fjWuKNgL3kP9wZi8TQ9aytMWxzWn2ucGHStkpo9VaKYygCHor9c 13Bse3w8yQgTt+IUBwfUIa/nOnmlSfQs/E97J/ubRezNqgpbgKdHCm609vmvn6ZCPxwY sHhh3ViUXRNvc3KStfGqW6myoLxpl/KGWVhjWsry08rim7y/uxfy/nidE81JKKz/3z5N cLvZzlo9WeI2ttVymtaxz3AWcNOpD8A7whiVEMJnJJwvrjKEDoqF/1xMpa4Hxln94+hL SDKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=zR2DBtV+hN62cOl07Z8581m/zEqmKzBF/d3PXEswxUQ=; b=sFcXVV8XYGauXM2rqzVprZyoUuDJ15a3O0itQkh/ALG7icc2uD+WieYBJps/heCbOi yjfeHqWNgJmcm4CVc7dcu4pw3S7QtYN77GGm22V6DY5jWvzVyk1Z3u5M37PXxVO+J8K0 PmuJr18sphehT4TnAj7p/SgQiSrzWrq5mk7FO3u/1YEmoOGgQqRVus8l7a9qNx5LYHDJ Zekl9k4oGrOEAJpIywpyD+JdJImF+g9FE74w7W4m9GXbp/evoMMQMrZvtDIcR7UiRbDN eTF0oLcMAvzgyvzMKFyuF697HE2gJbjgYxhqFZFq/NRCH/76pDbCJBYf8tGir2c7Pb4L 00kA== X-Gm-Message-State: AMke39nniQPYmNsqblycZUSaY73h0KthuCT8PZKwEvbbfs8HbYJK/4Mibarx3U/tOJbJ5bEXnRhff5pGGq9bJg== X-Received: by 10.237.60.3 with SMTP id t3mr515453qte.86.1487783520026; Wed, 22 Feb 2017 09:12:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.104.8 with HTTP; Wed, 22 Feb 2017 09:11:29 -0800 (PST) In-Reply-To: References: <20170113120534.GC2349@kib.kiev.ua> <20170115202008.GL2349@kib.kiev.ua> <20170116120021.GQ2349@kib.kiev.ua> <5f814a7a-5e46-057e-62ad-dde0a61bc1c8@selasky.org> From: Jia-Shiun Li Date: Thu, 23 Feb 2017 01:11:29 +0800 Message-ID: Subject: Re: TSC as timecounter makes system lag To: freebsd-current , John Baldwin , Konstantin Belousov Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2017 17:12:01 -0000 I got the impression that TSC was not preferred timecounter if it is not C-state invariant. But this apparenly is not the case now. Dig a bit and found r277900 chose to prefer TSC over saving power by disabling C2 state when TSC is selected as timecounter. But with EARLY_AP_STARTUP, and TSC as timecounter, CPU still enters C2 state. (Observed by sysctl dev.cpu.0.cx_usage_counters) With nooptions EARLY_AP_STARTUP, CPU correctly stays 100% in C1 and no lower. I added a printf in tc_windup() to check. With EARLY_AP_STARTUP, cpu_disable_c2_sleep is never increased, so it can not prevent CPU from entering C2. Guess there's some kind of race or init order issue, but it is beyond my understanding for now. -Jia-Shiun.