Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp497397ybn; Wed, 25 Sep 2019 03:15:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqw19Z8RILJVPjV/XCaMYDnlfu76zkXjRM5PnmBM7wXJqxYkzhBMP/TKSTr2tKZ6+nWqww8G X-Received: by 2002:a2e:5d17:: with SMTP id r23mr5616536ljb.229.1569406500177; Wed, 25 Sep 2019 03:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569406500; cv=none; d=google.com; s=arc-20160816; b=A2CtSXKfkR/2Zpv+Am79vl1mX2PmvRA2upUzSzxXyrC29iib+vkHmGfjaHJCXwV7/a 8kBg3JQseFDk6U20wRJsbI+HTt715/p14YP29+f6//UjY53naveTbNxcBXo9eFTulugD 5poghtdRVd7Is+B/BpIP8ElPRpvqwBLMa/4ECrtgmml+fUCJ8nWEi7QLD7ATItqkPEHk mRQuiCSfFMmCPh2sOMPWOrDv8CxDb9QM0cwy5XwVxM0SpBxT0tvczRe81Yd0SOgo4Osx sq5Ha9r5/xceiNRbrwb+WA2PdgCsCwEk43DnLbM7xORv6gHymHig9jOTNYWEjynagKga NbDg== 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=GN9uWlPH+mRUOKL6lisCqKrCCm1x4VV54XbjaAcOsJ0=; b=ZHLvrtwTVuD11eyKrokmJN0SxQl14FhCSkLLaTIM9EUhez45oiUPB/6yjs5o9DDzRn s0whX46v8/cPUpYSTHnRrGxaTtW2nfDXHjHJreFVTwL6vOMy5MpZJB+zIomHirsFZa3T kIbpFe5iBHW/lZiM61laj1Uftz6QTim+3UsiB/IqJFp418GX2x5sPeP6aEuYw/TkVpM4 bKP51nXzN0MxhJhy0vjaQJQgnLHo4TtPKoDFs9mWy7isx9b8fDWi5yOvKfI1dh8CSZfb l7YMwSgbSYuwJbjzZ1ciIg+58LZOFgOP3+9WzrSzsuHEyqgFE0FXaC11bpM4WcqK/avl D9Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AdFpKtal; 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 c30si2450082ejj.214.2019.09.25.03.14.36; Wed, 25 Sep 2019 03:15:00 -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=AdFpKtal; 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 S2436733AbfIWKFS (ORCPT + 99 others); Mon, 23 Sep 2019 06:05:18 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:40309 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406837AbfIWKFS (ORCPT ); Mon, 23 Sep 2019 06:05:18 -0400 Received: by mail-pg1-f193.google.com with SMTP id w10so7745197pgj.7 for ; Mon, 23 Sep 2019 03:05:18 -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=GN9uWlPH+mRUOKL6lisCqKrCCm1x4VV54XbjaAcOsJ0=; b=AdFpKtale+UdPAqRVVH0fkEU9i6SHcwJqBcZYBseNzuhLNt/NGzkC55oi6FdJOLoxV G8gYDbiJ/ypG3KYfe05iuGw4zN20zFWoKRZnpto7CEvt/noqO370oRIwYRXwKURk/CKv aPxVdXi2O/j6jwwc5X4Ew8Gfk5+NLYhkyuDnKWYDyhTfcWvaB9k12IzYX8tShQLmD4sx L83adHOpCCNixrrUI4IWEbL7G7ZZjS+VaFaWfTydnm5enr2oD7BD9y+G9uC1pbaVYsXz a0NfzT0rvg6uVMn0JLO69l0lTCNBkBwR4VeMNnneXHNUlLUeOLdmRB3a8URubE4GBMdR TByQ== 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=GN9uWlPH+mRUOKL6lisCqKrCCm1x4VV54XbjaAcOsJ0=; b=ZsylborIandRlIRWL42AgUvDaLZNXElDOvNlddTLOsB1KeNXeNZXUz1hHFnPgJhv/+ CvhGi+IF2twcJxJzKTXheqJby7ai/K9h3STqXKywUZWl131HGLsfAT8/CAdz8g5xIDnz rF8MbBbS7IrzB96h50KV7HUpVbyYCbM91zhlU6xqgxrZV6+uFhaChtYPfeCmaBb3MULD KOujZrILN8iBA2r11dm05pOIhyZW1FAtqJUYnfc+YiKtvrxwiDLNOT87Mn5Hq6DSVkgY Hku7t2pjVGh217PgOYZaXWPFavt1ituGNQvjZkslC2GTD6KR5LbtKd08kMBhn/bTSWsC Ckzw== X-Gm-Message-State: APjAAAUoxhbac7YXTUDzJLGLku+x7t8ssJXABwea89QcLh35ZerInbF+ sBAloCr6WukxCjXT+Zm61kBpV/Wx X-Received: by 2002:a63:c851:: with SMTP id l17mr4954033pgi.6.1569233117617; Mon, 23 Sep 2019 03:05:17 -0700 (PDT) Received: from localhost ([110.70.15.104]) by smtp.gmail.com with ESMTPSA id a13sm12231312pfg.10.2019.09.23.03.05.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 03:05:16 -0700 (PDT) Date: Mon, 23 Sep 2019 19:05:13 +0900 From: Sergey Senozhatsky To: zhe.he@windriver.com Cc: pmladek@suse.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] printk: Fix unnecessary returning broken pipe error from devkmsg_read Message-ID: <20190923100513.GA51932@jagdpanzerIV> References: <1568813503-420025-1-git-send-email-zhe.he@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1568813503-420025-1-git-send-email-zhe.he@windriver.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (09/18/19 21:31), zhe.he@windriver.com wrote: > > When users read the buffer from start, there is no need to return -EPIPE > since the possible overflows will not affect the output. > [..] > - if (user->seq < log_first_seq) { > + if (user->seq == 0) { > + user->seq = log_first_seq; > + } else 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; A tough call. User-space wants to read messages which are gone: log_first_seq > user->seq. I think returning EPIPE is sort of appropriate; user-space, possibly, can printf(stderr, "Some /dev/kmsg messages are gone\n"); or something like that. -ss