Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp164463pxk; Thu, 24 Sep 2020 02:23:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG/QLHMuWDloaFYFeE9oZou5upwqDQxdUqCp/u+tN6+Zsb32bilbNkXTPjHyYolx/eXeTn X-Received: by 2002:a17:906:6b95:: with SMTP id l21mr1917ejr.317.1600939403768; Thu, 24 Sep 2020 02:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600939403; cv=none; d=google.com; s=arc-20160816; b=vDp9SONOQxRM9SiyWDKyL4HazKLqXSrDReNANcz4i926zJbJcKJSN9ayeB9pp2/VSk oolwdX1m7UwnuqOW8M4YBRTitHtWqbMe47TbvPDc105pTs2oU0gyXH6eBFQAtu2gaUq8 9yqk+16QqA5TkCqD8cXdz1r3Z9gzzlVBFdCG1aTU33YlsVqZzMWLp6J28HjmzDU8o+sV cisrkDkLdHpptHI0qeEtV2hOH6hJqojMwizicZAFmPP8p1q9JsvAQlj0HiI29x9zmYDz bt9e8twCEilTH4a8gid4BePswbOMDy5LpfyaK+sid4lePdPJhHD1f/TpHovxJAli97fI /tIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=fMAvwwFV30HK4hEY4FeabCBTMHVTzPS6tY9DUMcJlTM=; b=FP+6HbmPTi+ca+PiytxeluA/ovVf4RdJqrELS9I48zJ3XYESRgQD+fMJnXKbnW27y2 vytlkm2PqiMxC0JNqcy8SfEnXXQMnBvcFdGrBK/k5OrOBmIZOEN7iVnMy1rtQA0H+kjb 6YuvaGzlFGXACS3vFFvRDVUUBuFr5d23gPBilW+RbOXwFW/GtGO15JOs5YWQf1+V1nsG HZ10CHrO4NPqIhlF3PEdCzGvz9x/TQ6WLZ5dshFN9rIAG6YbHnZkZZ4/Uw0xgR/+KiBi hHmnIYwFcPh44ihbhb/vcO9EhXvMymO+GGGcRppzz667fScpjnMOYp4Ijd9P5HI3FD0f HaiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qlx733Zr; dkim=neutral (no key) header.i=@linutronix.de header.b=Hw8BadpY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si1888885edc.428.2020.09.24.02.22.57; Thu, 24 Sep 2020 02:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qlx733Zr; dkim=neutral (no key) header.i=@linutronix.de header.b=Hw8BadpY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727323AbgIXJVy (ORCPT + 99 others); Thu, 24 Sep 2020 05:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726710AbgIXJVx (ORCPT ); Thu, 24 Sep 2020 05:21:53 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDE96C0613CE for ; Thu, 24 Sep 2020 02:21:53 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600939312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fMAvwwFV30HK4hEY4FeabCBTMHVTzPS6tY9DUMcJlTM=; b=qlx733Zr8+YqmCkWvzeX3ZdiQudovl7ZSFdTEMjGtEr4OXU7CvxQmmZ+cRNoO9Q8o30YmQ IfJ35w6W4xBqS2Fyhq0XtU2drHWkRdrC85eOl5OuwIShY/33mmt4eKZNvmUhsuJs/cVrX+ jsbRPyeQsEdpR0AQRnvCvrflwVUKvIYf9HfySilYnD0rXY9rVZKCXb4TzaB6nWv5gxhxvm PRxWL67G/B8/qYzGFxnbemX+ViJnXIgv8hdH/n4APBcOiBzk5xgJZQuK4Va9sUr0tzKZGL yxKrwHkvYDqb66QcyfG3YpLXhKxhVneeuizu9i0Ssu7hFOvBuNgge7ITNJa6Pw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600939312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fMAvwwFV30HK4hEY4FeabCBTMHVTzPS6tY9DUMcJlTM=; b=Hw8BadpY62hy9A5xiGbX1YcvD/LmaDrFsBshXnmEh83j4JbSIcZAH4/5/+N+6DJYALAkQ5 g3bym75Y5gX4FeDQ== To: Sergey Senozhatsky Cc: Petr Mladek , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk 4/5] printk: remove logbuf_lock, add syslog_lock In-Reply-To: <20200924084541.GA541@jagdpanzerIV.localdomain> References: <20200922153816.5883-1-john.ogness@linutronix.de> <20200922153816.5883-5-john.ogness@linutronix.de> <20200924084541.GA541@jagdpanzerIV.localdomain> Date: Thu, 24 Sep 2020 11:27:51 +0206 Message-ID: <87d02b7cnk.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-09-24, Sergey Senozhatsky wrote: > [..] >> void printk_safe_flush_on_panic(void) >> { >> - /* >> - * Make sure that we could access the main ring buffer. >> - * Do not risk a double release when more CPUs are up. >> - */ >> - if (raw_spin_is_locked(&logbuf_lock)) { >> - if (num_online_cpus() > 1) >> - return; >> - >> - debug_locks_off(); >> - raw_spin_lock_init(&logbuf_lock); > > If we panic() with syslog_lock locked then we need to zap syslog_lock > and disable debug_locks for kmsg_dump() to succeed. Otherwise panic() > may deadlock: > > syslog_lock_irq() > -> NMI > panic() > ... > printk_safe_flush_on_panic(); > kmsg_dump(KMSG_DUMP_PANIC); // syslog_lock_irqsave(flags) > ... > > Did I miss the point where we make sure that kmsg_dump() will not > deadlock? You are correct. Thanks. @clear_seq should either become atomic64 or kmsg_dump() should start from the oldest available message (seq=0). John Ogness