From patchwork Thu Jan 19 12:07:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 9525609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5AD10601AE for ; Thu, 19 Jan 2017 12:09:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A23428480 for ; Thu, 19 Jan 2017 12:09:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E8DE28503; Thu, 19 Jan 2017 12:09:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RDNS_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (unknown [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD12428480 for ; Thu, 19 Jan 2017 12:09:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cUBXC-0003QO-On; Thu, 19 Jan 2017 12:09:42 +0000 Received: from mail-pg0-f67.google.com ([74.125.83.67]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cUBX9-0003GN-68 for linux-arm-kernel@lists.infradead.org; Thu, 19 Jan 2017 12:09:40 +0000 Received: by mail-pg0-f67.google.com with SMTP id 204so4075298pge.2 for ; Thu, 19 Jan 2017 04:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZIT/QJq3hLjX4DvQbuzRKrUQhakKjuNuNvudn0E3eR0=; b=r0GaGyq8FaZ8aiV/C3ESY5574CU4VIOp2eFKFIvQwScI0MxFFk+sPPixFr5I1IJCk6 r7ZwmBL548qy6ZCzgnJNRnZpro2lOhFKMoJGGo2XQPNkVY7X5CUR6+1zC70iogLfTyHC 5WbDlSndAScS9LRApNOCv/4/h/UyR36UUVtiEqvLNBkZM9sthIBjE8GIA3iXIO6jDy9P RpKKclFwEfGw7z0mpvao2iJ2UslxfWFEs2+QeH0esG5FNdz9P0L5H8hVOQOV6WTdbFO7 g8b1xh0mD0EhdZxX853MZCOWvXkxw+zMdUIJkkgngz3V5mBmb0u6yGCZQv0BsXFfB56A eF3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZIT/QJq3hLjX4DvQbuzRKrUQhakKjuNuNvudn0E3eR0=; b=t+vxkxnUPhN3+dxuggWEAmpVBUtTq3l2oWmE2OFmjFmNrm+2zORJ0GZFU+HYPycFjg hYUwgg/3hUnaB7m3+dj3vXYKoAYDtv880D1ohNGffveUWMK2fxIo0j0tjDVMjwCtants mqQBZLUFDvrR/8oCWILfdfGvJ8++CWSt+1WdT/a/iVw+wjSPhRKX5NlLKRWg6Ni1xv/8 ZMp6jDFdIrzAcSd5v8S+Bqu2ILHekHa5vzDuu6SKpja/RoQNLVbaTuRTo7zuUa89/dbv JejCR7qhQuc0/JMec8TOgs51gvQ2hpMqRJdXpoYeqiiVITaTHIFhKzJFwppzkGalFgyE h4Kg== X-Gm-Message-State: AIkVDXK+eRUuO8vQg3NuKi3D/eOPqNkrYXrPUHHlotabyG8vU/BONBBx6MjDb4MsZufzng== X-Received: by 10.98.192.72 with SMTP id x69mr9680930pff.129.1484827697607; Thu, 19 Jan 2017 04:08:17 -0800 (PST) Received: from localhost ([121.137.63.184]) by smtp.gmail.com with ESMTPSA id h4sm8313626pfk.96.2017.01.19.04.08.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2017 04:08:16 -0800 (PST) Date: Thu, 19 Jan 2017 21:07:44 +0900 From: Sergey Senozhatsky To: Florian Fainelli Subject: Re: [PATCH] ARM: smp: Remove CPU: shutdown notice Message-ID: <20170119120744.GB435@tigerII.localdomain> References: <20170117230714.6799-1-f.fainelli@gmail.com> <20170117232314.GI27312@n2100.armlinux.org.uk> <20170118095523.GK20462@pathway.suse.cz> <1041c46f-13e7-4446-33e0-75eee9ffb91f@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1041c46f-13e7-4446-33e0-75eee9ffb91f@gmail.com> User-Agent: Mutt/1.7.2 (2016-11-26) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170119_040939_269916_0172C149 X-CRM114-Status: GOOD ( 19.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Petr Mladek , Chris Metcalf , Sergey Senozhatsky , open list , Russell King - ARM Linux , Sergey Senozhatsky , Aaron Tomlin , Andrew Morton , "Paul E. McKenney" , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Kees Cook Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On (01/18/17 11:56), Florian Fainelli wrote: [..] > >>> CPU hotplug isn't a fast operation anyway - it's also fairly disruptive > >>> in that it uses stop_machine() to halt activity everywhere while taking > >>> the CPU offline. > >> > >> We have a test that consists in shutting down all CPUs as frequently as > >> we can and do this for about 2 million iterations which takes roughly > >> 24h, and this printk slows thing down by a reasonable amount. Here are > >> some numbers on 500 hotplug operations: > >> > >> w/ printk: > >> real 0m9.997s > >> user 0m0.725s > >> sys 0m3.030s > >> # > >> > >> w/o printk: > >> real 0m8.547s > >> user 0m0.436s > >> sys 0m1.838s > > > > I am curious that a single printk() might make such a big difference. > > It does, because of how printk() is implemented (there is nothing wrong > with it, just slow by nature and how the UART gets written to as well). > > > > > One reason might be that the messages are pushed to a "slow" console. > > 115200 UART, yes that's slow, but not unusual. > > > > > Another reason might be that there are many other messages printed > > on the system and there is a contention on logbuf_lock or other > > console related locks. > > The other messages being printed are those from the hotplug script that > I run which just checkpoints its running every 50 instances, so it does > not occur that often, the console really is not busy, which really > extracts the overhead of printing "CPU: shutdown". there is also console_cpu_notify(), which basically serializes all CPU hotplug events. and that's a sleepable console_lock(), followed by a potentially long console_unlock(). for hotplug each notification. static int console_cpu_notify(unsigned int cpu) { if (!cpuhp_tasks_frozen) { console_lock(); console_unlock(); } return 0; } out of curiosity, does the change below improve anything in your test? diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 7180088cbb23..72e86e06c4e4 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2035,8 +2035,9 @@ void resume_console(void) static int console_cpu_notify(unsigned int cpu) { if (!cpuhp_tasks_frozen) { - console_lock(); - console_unlock(); + /* If trylock fails, someone else is doing the printing */ + if (console_trylock()) + console_unlock(); } return 0; }