Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp330312ybv; Thu, 13 Feb 2020 01:08:19 -0800 (PST) X-Google-Smtp-Source: APXvYqx34cz+v5AfndEM3hnSDwYVFENAbpCvF0pk3J857dOOCigUhixbOUkX8BVLgy5OP28p6i+o X-Received: by 2002:a05:6808:b1c:: with SMTP id s28mr2273315oij.2.1581584899583; Thu, 13 Feb 2020 01:08:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581584899; cv=none; d=google.com; s=arc-20160816; b=ptFo1oVrBsfXX/RTOm6FoyAtAqbmiBZwnGS2BTQXGluUTozSVAhT9yOJwp+ZdcR7na 5+YpUBljIN6RhsVJbmSc2QpjTrOUNssZZSiiS8WTUJBQ/lRKZc9qiGB7O8+LwGd6LV98 v7HjNQdRpOf9KO7h/BGt3R6BB4/O3p2tyzBJEuhxPjOWTW8aunxGOQLeG5k+yPxNr7SA nMqcmWCTKTJnnoKXj7sjIh049qRk/S6EVP9MqbIyyDBOaD4/Lv5yfo99QlZ28AECjosU Rdu8LuS1xaV63hhxg5t6L4C66b9EVBmD1xXqGZb+gRqCLKshWDcLwu8Uo84EaD+iS4zW VFAQ== 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=iZ4ALMIQ3+TkLwExvTpCpZXbkNrLF9yBShKjZ2USbmI=; b=L1RHCHMu9bWgy0TkPXr2fEM67C7UbBOVB6s3hiR7PZlhv4J/JjTsStGzRhwbwhxO1r f+AdXBm9VEx1JIJ+v3PdztrZsz4HJWgoDbiDaBxqCvVBgjWZZNLrWkC1tcBsUEiyyzPq Zm39gn6A17fAeD9WI6iRHH18L3DYaIhZHxmHvxvSejQB1zeHOTr4XiQ9trP/iZjnGhNT EVcTr6zz69Lttg9IThCjO/F8+kQhzdRqZVcBSOlLElagSZPBjYNtPWkfxkOsZimKZKnM 98J97hULzqsSl1dpC5MMiUuT+GnhgM9zMMdQKVmifmQHRVZxlJhIywi0H+Z1SMQgOZ5W zuZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VjrhEKjg; 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 c5si798257otp.108.2020.02.13.01.08.06; Thu, 13 Feb 2020 01:08:19 -0800 (PST) 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=VjrhEKjg; 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 S1729602AbgBMJIB (ORCPT + 99 others); Thu, 13 Feb 2020 04:08:01 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35568 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgBMJIA (ORCPT ); Thu, 13 Feb 2020 04:08:00 -0500 Received: by mail-pf1-f194.google.com with SMTP id y73so2765774pfg.2 for ; Thu, 13 Feb 2020 01:08:00 -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=iZ4ALMIQ3+TkLwExvTpCpZXbkNrLF9yBShKjZ2USbmI=; b=VjrhEKjg/eQQL39kqbYW4sTUO7Dkc4Lwr+Txc2E6nE9o78H+RPowJ5/THyptvadMzN hLmpo02dDGTpF6sjQQJCR2DbqfEUaBtJFqewYeZ3bOzekqvoa8svO7s4rAaeyosodBNM oA9Mdq6PTJdrAlcBdB1RVTAyyN84Z/zRhOv8UAQcIIYYQxhdAAz7/fyYYd+KCF6/erkP aGxry2onFhnMIN50g04l8s9InEvOyUGkLkBjg5nlXl/9eSq4LnmogJC9hkwR33KFDyB3 8tuhDKc4Ar5YYgl/hvbYN+sgB1JNdWqsitexCsumRFuDSPkNs2LHsSTNqGhrtEvalu4v SlSg== 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=iZ4ALMIQ3+TkLwExvTpCpZXbkNrLF9yBShKjZ2USbmI=; b=jcbvGZyWRT6aV9o3xofKDjJJ/3OIiD4GcjVYyqGdW8Jco7MnHBze9pqU9xuiisVL3z 7SAzaOShpUtrb7zfa6e5UzPM1OJgINzyCTybBe5aSIdzijP/pQt1xuHFzVXk0Aypidfs 6LazzYiyqasgK5VSk/W/QQsUcxHb8/cBBbUax9SXF+KANBGj+RlCYtoTAmqmTm1mdZlK mQp1Rs+2y4RVnIGthqDyaoz6hfF6ENXxPUe8V0f13pFRMVsUKtCHXV6wJFce5bpmFx3p LnPrBb96gCNfthwb5m3AhJaXDvac1EPlv+xR1PQ9P+9hQ0TgOLDplrKtF4aaw3LSzn1r RplQ== X-Gm-Message-State: APjAAAUMXcbT84fdegAYHnr0IVNSXAvkjFpf5JqBD+i+AZVccc/Wsbz3 I1h5zR+k70JVVMS4AISgXOc= X-Received: by 2002:a62:1a97:: with SMTP id a145mr16870284pfa.244.1581584880034; Thu, 13 Feb 2020 01:08:00 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:5bbb:c872:f2b1:f53b]) by smtp.gmail.com with ESMTPSA id k1sm2259597pfg.66.2020.02.13.01.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 01:07:58 -0800 (PST) Date: Thu, 13 Feb 2020 18:07:57 +0900 From: Sergey Senozhatsky To: John Ogness Cc: Petr Mladek , Peter Zijlstra , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Andrea Parri , Thomas Gleixner , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] printk: use the lockless ringbuffer Message-ID: <20200213090757.GA36551@google.com> References: <20200128161948.8524-1-john.ogness@linutronix.de> <20200128161948.8524-3-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200128161948.8524-3-john.ogness@linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (20/01/28 17:25), John Ogness wrote: [..] > - while (user->seq == log_next_seq) { > + if (!prb_read_valid(prb, user->seq, r)) { > if (file->f_flags & O_NONBLOCK) { > ret = -EAGAIN; > logbuf_unlock_irq(); > @@ -890,30 +758,26 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, > > logbuf_unlock_irq(); > ret = wait_event_interruptible(log_wait, > - user->seq != log_next_seq); > + prb_read_valid(prb, user->seq, r)); > if (ret) > goto out; > logbuf_lock_irq(); > } > > - if (user->seq < log_first_seq) { > - /* our last seen message is gone, return error and reset */ > - user->idx = log_first_idx; > - user->seq = log_first_seq; > + if (user->seq < r->info->seq) { > + /* the expected message is gone, return error and reset */ > + user->seq = r->info->seq; > ret = -EPIPE; > logbuf_unlock_irq(); > goto out; > } Sorry, why doesn't this do something like if (user->seq < prb_first_seq(prb)) { /* the expected message is gone, return error and reset */ user->seq = prb_first_seq(prb); ret = -EPIPE; ... } ? -ss