Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4698257yba; Wed, 8 May 2019 00:55:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+FPkn7eppk3diM1MO2GqVBFcGgTuQNzpsl+f6DvUV215Xo2QgK6PAG7opixU99DbQjNVp X-Received: by 2002:a62:d286:: with SMTP id c128mr47723613pfg.159.1557302152519; Wed, 08 May 2019 00:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557302152; cv=none; d=google.com; s=arc-20160816; b=VHs/xqiIggIbRxXEidEGTXmjbOlhANV/v7MCAThfG/AhSfKlRT7rDHl/vD7F6xPl6T n3tAV84HSn0CqbHbBH0Kds9tV6g1hDSFM4V9hjW0VeI2I+yTZXsecvDqBVgPuvxLxtSe ySPylkIbcgZs0lG0JgQ346gFKbWbtH2TbodA94VK+bjl9kO/BIgowuM7TPnHUcoxLDR+ eVEJj1fvFP6hqlmnbRt1hfwqcg1m0/GyiUdW27g+L1Gp3Dh6B2seBi40fveh81Bxw40o k3Qe7p1FLGKvj9pyNPe2YfA+S+rDUY1XlmivsqsUSOAus9QFwnLn66BU/oAQ4H6sB/U8 f3wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VWVIY3U4u87uBqpX8q3XHH6irKlOA03Q7B0W5k01mmw=; b=oPq32Gpg0f2OoOBZmVkzpEbo4SYJ/yPJY2ZUMAAUqp+sxbvsj5V6hkM8OziA1qAY2S z8ouT0EuhRexGzLClsVGai7Ysc1rUsshrS9W0u5ojtbv4Cvdn+wfwFuN2ICsb/mFQ8Hk u2Ty9pAWVDA4lT/hvXwd17mYqMVmALJrZzgdKNatMnrZ0iadSuobzyEdXzhehdP+znZB TB5ax407yE937MrQcHpq2Ro5d7k3ePeczFwieVVgQ6PSp4RNAd7Ng/zms1ArQdRR+YtW ahFfCa0AhdkKpIAaPHvbUPhDdCbIuzkupKSDYf3Lb+hR3k+lqNolQDIfLlSid5/1AIBx TmPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="F/Wvgz5O"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24si7225989pgj.15.2019.05.08.00.55.37; Wed, 08 May 2019 00:55:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="F/Wvgz5O"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbfEHHxI (ORCPT + 99 others); Wed, 8 May 2019 03:53:08 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:43855 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726611AbfEHHxH (ORCPT ); Wed, 8 May 2019 03:53:07 -0400 Received: by mail-pf1-f195.google.com with SMTP id c6so4860649pfa.10 for ; Wed, 08 May 2019 00:53:07 -0700 (PDT) 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=VWVIY3U4u87uBqpX8q3XHH6irKlOA03Q7B0W5k01mmw=; b=F/Wvgz5Ok8Ade93VsE4p7w+Bw3YwJPVymRMeMtr3idBsR65KEMoDUPgkAxJDjODqh2 NCU2ljU1CibfGKtC6+4e0CuxOZEUHfyF0QCsjJoRLAVvTgxPIGsR84KCo3hX8eqQpYnZ 9XlBrrxLETEgiqxySINsWxhFCngcwGiiEr17Qb90AVUcg4uZOzVemsQY8Y8Y3LJQFHum 73AJ/xAs7BGEHD27PyQiGLER/jiVrofcPNCU0Ts3cUNmxXwn89O08WroF/GC0uSM1ki0 Ped6qCHD2anWdTmTxwfRlSfe1grxvKzXlV4Ae1MM2a9zOyvpMc+E0qxb65ZyFwPa7iHa KvIA== 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=VWVIY3U4u87uBqpX8q3XHH6irKlOA03Q7B0W5k01mmw=; b=PCp6q7UN4i7wUBudD0BuukEBjsIObYX+egAu5cdz6Jm2Hvcp70NxClh+hR2LgotsqH 3mC0LOlbFfgIVW+vVCmMqTgA4pvh5JFJWVZCV0kRW82OgiD7eMUcNYUBsE5Tg8w23PoX uV9EW1SzxT0vnEoiiPsxOB+LJ1KyrH2xqhirY4ab+fj35ri1CUI1f6QSxQkX8gBqOKJv Xi9xqcQ75kUkSofpijrCdIYE7YFCOgVyWGq69G5Tl+ms4Rh0VUZOE3J5NnLTShoM1k/9 E7zxbjOneMSrMfpL1KDNLaFPjLSadStTbWdqPwSWOnDSxcjXN9jSnoAA6WyN2bdkeD9u kldA== X-Gm-Message-State: APjAAAXAlr4nU7wjSMeJSB0U1qAcNJ4lJIfpudJIPPbl/yjJMQJbFVP2 MNnUqLBM85I1IMh0ASx70ZU= X-Received: by 2002:a63:4a66:: with SMTP id j38mr15898170pgl.199.1557301987341; Wed, 08 May 2019 00:53:07 -0700 (PDT) Received: from localhost ([175.223.21.172]) by smtp.gmail.com with ESMTPSA id x30sm3026318pgl.76.2019.05.08.00.53.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 May 2019 00:53:06 -0700 (PDT) Date: Wed, 8 May 2019 16:53:02 +0900 From: Sergey Senozhatsky To: Daniel Vetter Cc: Intel Graphics Development , Daniel Vetter , Peter Zijlstra , Ingo Molnar , Will Deacon , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , John Ogness , linux-kernel@vger.kernel.org, Nicolai Stange , Thomas Gleixner , Sergey Senozhatsky Subject: Re: [PATCH] RFC: x86/smp: use printk_deferred in native_smp_send_reschedule Message-ID: <20190508075302.GC15704@jagdpanzerIV> References: <20190507173329.17031-1-daniel.vetter@ffwll.ch> <20190508074420.GB15704@jagdpanzerIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190508074420.GB15704@jagdpanzerIV> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (05/08/19 16:44), Sergey Senozhatsky wrote: > [..] > > static void native_smp_send_reschedule(int cpu) > > { > > if (unlikely(cpu_is_offline(cpu))) { > > - WARN(1, "sched: Unexpected reschedule of offline CPU#%d!\n", cpu); > > + printk_deferred(KERN_WARNING > > + "sched: Unexpected reschedule of offline CPU#%d!\n", cpu); > > return; > > } > > apic->send_IPI(cpu, RESCHEDULE_VECTOR); > > Hmm, > One thing to notice here is that the CPU in question is offline-ed, > and printk_deferred() is a per-CPU type of deferred printk(). So the > following thing > > __this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT); > irq_work_queue(this_cpu_ptr(&wake_up_klogd_work)); > > might not print anything at all. In this particular case we always > need another CPU to do console_unlock(), since this_cpu() is not > really expected to do wake_up_klogd_work_func()->console_unlock(). D'oh... It's remote CPU which is offline, not this_cpu(). Sorry, my bad! Any printk-related patch in this area will make PeterZ really-really angry :) printk_deferred(), just like prinkt_safe(), depends on IRQ work; printk_safe(), however, can redirect multiple lines, unlike printk_deferred(). So if you want to keep the backtrace, you may do something like if (unlikely(cpu_is_offline(cpu))) { printk_safe_enter(...); WARN(1, "sched: Unexpected reschedule of offline CPU#%d!\n", cpu); printk_safe_exit(...); return; } I think, in this case John's reworked-printk can do better than printk_safe/printk_deferred. -ss