Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4709794yba; Wed, 8 May 2019 01:09:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhPG02qSUcNhrcrYUb1XffMFrXO0e9vvbQxugrOcrLEd56kekPALQoxlV8TY3tMd9nITm7 X-Received: by 2002:a65:6656:: with SMTP id z22mr45121405pgv.333.1557302962355; Wed, 08 May 2019 01:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557302962; cv=none; d=google.com; s=arc-20160816; b=1EfeVu/b/Km3YfXuuichOObfUpUd8dav8H8k078rmH6AWT6vbiq7to61DoBeuhC++l CchA3WRuVT8iTpHHdUCEX9fl9EOXkZfwJATz8atqWE1awLJ27/Qv2RUHqUYfID8581Yy R6dnAlE8KogPBy7r3wvPpck0BUCJ+sN99bFCza82apaOvgV03Jr9tvHEbSxngzAq5etT 0CO2IzWpi6NT3ql/gnpK0HwwrxeXq/wIHeOJHZoRYuI4wJvv4XOVFMU4BEu5vnqnjcmz 8M7X4Ta0fRuJyc5yhVUYD5tYagIUIDNWv7xt+uhrmKMMDLpsK2MduPQwjcPaYQioEApl 0K+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ki8hQ48k4lITqZ/TVIYvLD49Gs7QEyF45lWbuLR1Sl0=; b=T2iCNLN/7yK41l/oGme5IhJjCktkW8SB1YscZ0lLi2lQjVR1ktuYp+2pT2H1chZuDN qBogw0yqSw9JeFCT3u10XhvLaS/a9OJmI/5mI2HbpUHMztCvZy7ojp1qEbvN4b125/xg gbdCEH6/knovayQSfEgtPwFeNujlA5Ta6FgDhY2CD6Xmm0rHEyDrqGHvQYlCqnFhUpV1 CCNNrRYExA5qpqE/zyVhOnqA9psrtMT7HudLJB0XXIIZ8iQt+CY1s0z4pGSgO4LghpfK LgxzMD62hzXTM6MtPY8GQwxrfAlCDCzOCDcu39hAnsVzWc26yC4FY3NJosgzMwolFt/k /SVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=CvUyCgoi; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 76si14087651pgf.582.2019.05.08.01.09.05; Wed, 08 May 2019 01:09:22 -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=@ffwll.ch header.s=google header.b=CvUyCgoi; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726631AbfEHIGe (ORCPT + 99 others); Wed, 8 May 2019 04:06:34 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:33697 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbfEHIGe (ORCPT ); Wed, 8 May 2019 04:06:34 -0400 Received: by mail-it1-f194.google.com with SMTP id u16so1689605itc.0 for ; Wed, 08 May 2019 01:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ki8hQ48k4lITqZ/TVIYvLD49Gs7QEyF45lWbuLR1Sl0=; b=CvUyCgoivRAhF/4ErqyHzJu2eu3YdNKSU7bPgEtxWicHsKTLP+tGbafiiQw2io/GQb PsmMQMPtsa2T8025pi5SsvE5ri1xNbzvZLpapw15edM7IGu2w97/kbA/7yKXYYdu1WMI IReG5o25f4R84RgSKj515yoqgHSx3qI4bKkMU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ki8hQ48k4lITqZ/TVIYvLD49Gs7QEyF45lWbuLR1Sl0=; b=a2h+SrMjrFohkx3z7ydu20QOPrpa3uDZzxCeREda5A/qX0A/Yx+KSEw8+2or8QLM2z q2cwWlNYgrfIgZdw4eLfqhyIZ4EczQX1Tk2KCraCb4i+YehBmrJ78799HuFur26ZPi6F qZWHZTjRgR+js3Wj19gaYvYTd3lEq5m7Fp2VoznHUQ+F/jUVsaBRya8TUiLm+1kRiyvs ugp1/hDHdGV1gYq3/C4fKSCyfeFkmUxvBcUTT3k2vVylzSrQpU/pDW7JoQ1LFbZoSjkv o1Pcf3vx5Vt9IXCKqr3c650GY44o06lt9XAPqH70G1gnwmBCkkS1QqHLfHeSKARfS+BH xPTg== X-Gm-Message-State: APjAAAX3ApLS37dcaqNQM3z55aUkyv2YzizwQk5CgRf6C4xQFzaLgnlv m9xj9enn5F8JJ2Fv/lhmRL4BLOh+6x6Nb8BME5ZUDA== X-Received: by 2002:a02:ca4a:: with SMTP id i10mr27164568jal.70.1557302793766; Wed, 08 May 2019 01:06:33 -0700 (PDT) MIME-Version: 1.0 References: <20190507173329.17031-1-daniel.vetter@ffwll.ch> <20190508074420.GB15704@jagdpanzerIV> <20190508075302.GC15704@jagdpanzerIV> In-Reply-To: <20190508075302.GC15704@jagdpanzerIV> From: Daniel Vetter Date: Wed, 8 May 2019 10:06:20 +0200 Message-ID: Subject: Re: [PATCH] RFC: x86/smp: use printk_deferred in native_smp_send_reschedule To: Sergey Senozhatsky Cc: Intel Graphics Development , Daniel Vetter , Peter Zijlstra , Ingo Molnar , Will Deacon , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , John Ogness , Linux Kernel Mailing List , Nicolai Stange , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 8, 2019 at 9:53 AM Sergey Senozhatsky wrote: > > 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! Well I started reading, then freaked out about the WARN_ON in irq_work_queue_on until I realized that's not the one we're calling either :-) > Any printk-related patch in this area will make PeterZ really-really > angry :) Hm any more context for someone with no clue about this? Just that the dependencies are already terribly complex and it's not going to get better, or something more specific? > 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. Hm I think this is what Petr was suggesting, but somehow I didn't find the printk_safe_* functions and didn't connect the dots. Needs the _irqsave variants I guess, I'll respin a v2 of this. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch