Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4690425yba; Wed, 8 May 2019 00:45:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzM7Q1bi05GKU3wKaXwefPKD9dW3+Nx1jMAXS+xUC3Zj3trviIT7V+JT4AgFYRjc59xj8eW X-Received: by 2002:a63:8149:: with SMTP id t70mr45695676pgd.134.1557301539899; Wed, 08 May 2019 00:45:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557301539; cv=none; d=google.com; s=arc-20160816; b=FG0NSOPJkXAAbIZ/ePc7+Lsd11Y6nwUoII9MfCxuArXu3+cyh+2IeVj9ONLnbS/Zz+ v7JWvBrUNpUnVBe1WBbvyG/gMtwxptyTr5ETcD2P2hTHnuTAUKlHb2BKUk93mFZr5a3j ZyUG6W7PFgX5HPyGCOQDUBfk+Oy7SM/fwZFFLp6cPAzxZ/9W2wFRHl5p4bY8Cpu5rr4G DnfKtypYJ95bTLDO9q4qIfBa4zVEWApWLx3eGaKGVNblmKRyacUrMqfsbJTM7MQnb5u8 zn9Mn+WgOkfnYd5AK8DE87Ty5kr5Mj9vEEJymgkDHA8Xd2Z+1unWnJSfoLfk5CHfHuvV ml3g== 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=t80PqPxL5SXwBZR4z2Cp1FO/rGd8hfnknFlQn+mAx7Q=; b=P+Z0Ac1s65v4oCvPk+c0u01/Vo8Hz7IirEEqXgq/l72Fw05c9+8RR3O+jfMczDWWG0 DL9Nxky544fwz13Xp5HMMUpUSGkWkJVEDLUnUPGf/zD6HkfaicX1U4vusbsvT4Atup2q jsHlk5lBSu7Burz1aT2uwtbcT7NsIWn5PptmovX5C0VFozfqJ4HTUwC1KA/XEoTPEgQJ 0EIvCYL3e4k8a4JVIv7mErXWn8Ypae4oXizB0tdhzHRxZtWcWsAWmTqdALbId+nfjZCr o2zsU7ejHNXp4FOp41XHASHy2wZw4GiX77YCnwP8OzDNyDEft0WXQiiMJc2SEy+7tXy/ nMdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dLwXX0id; 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 c13si22783192plo.175.2019.05.08.00.45.23; Wed, 08 May 2019 00:45:39 -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=dLwXX0id; 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 S1727156AbfEHHoZ (ORCPT + 99 others); Wed, 8 May 2019 03:44:25 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44077 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726628AbfEHHoZ (ORCPT ); Wed, 8 May 2019 03:44:25 -0400 Received: by mail-pl1-f196.google.com with SMTP id d3so5484169plj.11 for ; Wed, 08 May 2019 00:44:24 -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=t80PqPxL5SXwBZR4z2Cp1FO/rGd8hfnknFlQn+mAx7Q=; b=dLwXX0idD9lCs/qVE7sjTvQveBUcNyKoLV+y4Z8HPpDrcAqjSqUYhPhdTpWxo6R+IY uYUIyNHoYDCTmlcDdaC6VM2oZqMsISaw4MmL4+O1toG1ZUipTASZpt8SxHLCnMwhhnfR H7s9rqzEgDz4Y1yPplptZeINxTVu1YzizY21Skdkfi5JpNUfIeCPkUhGbKsoYwqh3D2z ps1LcOKPZCSxbh7qiT83ZoeBkODuPVuZlIPwH5ufp9aW9vnW4u71BhVkNccANBCZO+3x W2+lsR2oZkumAfM4p+9qhN2uHJtqjpUpuLpcjdPYHXfHRP+GmNnV3IvrRAcJXcZfraaw ccng== 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=t80PqPxL5SXwBZR4z2Cp1FO/rGd8hfnknFlQn+mAx7Q=; b=cWL6wo9fvBVl/OIJCNw7OXOZNx61Z9ReiAeQu7AMPlh3/n3/zbGgA8EqXVGGaA3a+U C7Sh6VoiQ7+MdbSpuySbwXtBs666mqJKGM/IL17SAWITrthSeL3ZqABtRqx/uDXmaW0g Wl/tWLfN0jm8hQLL6okWF5Z0nVx/Mi3bzWWIYQSvSb2rfw0z6p7fWlhtDTf6ZV3euCvc IbtVii28OqS03KkblbODJKoAADwTOXcw4uWurecIg1B/L63/6ZSiUhhCxyh3yL2MRnpc PGKjWIivBzlHCQEdlLkXtXBVKmYkEXVrvQu2ixm+AcmEzbuK4AzpzyVKINv07UZOoN+I S5zQ== X-Gm-Message-State: APjAAAWargPOtPfkSl6lOhPdnmMgwGk391ParQ6yCTkJ+ruN4AXn9wVJ 2OmMMjpPAZjr69oMZTornS0= X-Received: by 2002:a17:902:5c5:: with SMTP id f63mr44261175plf.327.1557301464646; Wed, 08 May 2019 00:44:24 -0700 (PDT) Received: from localhost ([175.223.21.172]) by smtp.gmail.com with ESMTPSA id m11sm21390465pgd.12.2019.05.08.00.44.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 May 2019 00:44:23 -0700 (PDT) Date: Wed, 8 May 2019 16:44:20 +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 Subject: Re: [PATCH] RFC: x86/smp: use printk_deferred in native_smp_send_reschedule Message-ID: <20190508074420.GB15704@jagdpanzerIV> References: <20190507173329.17031-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190507173329.17031-1-daniel.vetter@ffwll.ch> 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/07/19 19:33), Daniel Vetter wrote: [..] > - make the console_trylock trylock also the spinlock. This works in > the limited case of the console_lock use-case, but doesn't fix the > same semaphore.lock acquisition in the up() path in console_unlock, > which we can't avoid with a trylock. > > - move the wake_up_process in up() out from under the semaphore.lock > spinlock critical section. Again this works for the limited case of > the console_lock, and does fully break the cycle for this lock. > Unfortunately there's still plenty of scheduler related locks that > wake_up_process needs, so the loop is still there, just with a few > less locks involved. > > Hence now third attempt, trying to fix this by using printk_deferred() > instead of the normal printk that WARN() uses. > native_smp_send_reschedule is only called from scheduler related code, > which has to use printk_deferred due to this locking recursion, so > this seems consistent. > > It has the unfortunate downside that we're losing the backtrace though > (I didn't find a printk_deferred version of WARN, and I'm not sure > it's a bright idea to dump that much using printk_deferred.) I'm catching up with the emails now (was offline for almost 2 weeks), so I haven't seen [yet] all of the previous patches/discussions. [..] > 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(). -ss