From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BD23C433FE for ; Mon, 7 Dec 2020 09:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C94E02311B for ; Mon, 7 Dec 2020 09:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726863AbgLGJ44 (ORCPT ); Mon, 7 Dec 2020 04:56:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:48434 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbgLGJ44 (ORCPT ); Mon, 7 Dec 2020 04:56:56 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1607334970; h=from:from:reply-to: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=lQyzA5+NXpFmy9fbV5Tah+/VeSmBxhEmKcAcR9AvhBA=; b=PGuun+nN4TTe702tCxdhe/LZ2pBb6EyIBjspS71guWj53BmRDDiKqz7MQu+Q+g2HYu/rbh UppGzUQSl7KSn5hZn+3mYCO44J/CXjJ2Y/EDFVPp30xGCbWf3lor4fB2C9cNFDopaKLZWs DsCO+aSb0+eiq36TVyTDr3VuRYQ8UaQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 59D3EAD41; Mon, 7 Dec 2020 09:56:10 +0000 (UTC) Date: Mon, 7 Dec 2020 10:56:09 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: devkmsg: was [PATCH next v2 3/3] printk: remove logbuf_lock, add syslog_lock Message-ID: References: <20201201205341.3871-1-john.ogness@linutronix.de> <20201201205341.3871-4-john.ogness@linutronix.de> <87y2iamzdp.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y2iamzdp.fsf@jogness.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun 2020-12-06 21:57:46, John Ogness wrote: > On 2020-12-04, Petr Mladek wrote: > >> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > >> index e9018c4e1b66..7385101210be 100644 > >> --- a/kernel/printk/printk.c > >> +++ b/kernel/printk/printk.c > >> @@ -785,7 +749,6 @@ static loff_t devkmsg_llseek(struct file *file, loff_t offset, int whence) > >> if (offset) > >> return -ESPIPE; > >> > >> - logbuf_lock_irq(); > > > > user->seq manipulation is not longer safe from the atomicity point of > > view. > > > > One solution would be to use atomic variable in struct devkmsg_user(). > > Another solution would be to synchronize it with user->lock like we do > > in devkmsg_read(). > > > > user->lock looks like an overhead. But it actually would make sense to > > prevent seek in the middle of a read. > > I would prefer using atomic64_t. Using user->lock could introduce some > wacky regression. OK, fair enough. User space might do crazy stuff. Best Regards, Petr