From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751641AbdLLFj3 (ORCPT ); Tue, 12 Dec 2017 00:39:29 -0500 Received: from mail-pg0-f49.google.com ([74.125.83.49]:46278 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbdLLFj1 (ORCPT ); Tue, 12 Dec 2017 00:39:27 -0500 X-Google-Smtp-Source: ACJfBou4/jMgvDXaWYaMS6jjoANkURMUgJvyT0FMbO/dgqL/1vKaBjkLzMPaVdoShZmys16y4x/Tlw== Date: Tue, 12 Dec 2017 14:39:21 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Byungchul Park , Steven Rostedt , LKML , akpm@linux-foundation.org, linux-mm@kvack.org, Cong Wang , Dave Hansen , Johannes Weiner , Mel Gorman , Michal Hocko , Sergey Senozhatsky , Vlastimil Babka , Peter Zijlstra , Linus Torvalds , Jan Kara , Mathieu Desnoyers , Tetsuo Handa , rostedt@rostedt.homelinux.com, kernel-team@lge.com Subject: Re: [PATCH v4] printk: Add console owner and waiter logic to load balance console writes Message-ID: <20171212053921.GA1392@jagdpanzerIV> References: <20171108102723.602216b1@gandalf.local.home> <20171124152857.ahnapnwmmsricunz@pathway.suse.cz> <20171124155816.pxp345ch4gevjqjm@pathway.suse.cz> <20171128014229.GA2899@X58A-UD3R> <20171208140022.uln4t5e5drrhnvvt@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171208140022.uln4t5e5drrhnvvt@pathway.suse.cz> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On (12/08/17 15:00), Petr Mladek wrote: [..] > > However, now that cross-release was introduces, lockdep can be applied > > to semaphore operations. Actually, I have a plan to do that. I think it > > would be better to make semaphore tracked with lockdep and remove all > > these manual acquire() and release() here. What do you think about it? > > IMHO, it would be great to add lockdep annotations into semaphore > operations. certain types of locks have no guaranteed lock-unlock ordering. e.g. readers-writer locks, semaphores, etc. for readers-writer lock we can easily have CPU0 CPU1 CPU2 CPU3 CPU4 read_lock write_lock // sleep because // of CPU0 read_lock read_unlock read_lock read_unlock read_lock read_unlock read_unlock // wake up CPU1 so for CPU1 the lock was "locked" by CPU0 and "unlocked" by CPU4. semaphore not necessarily has the mutual-exclusion property, because its ->count is not required to be set to 1. in printk we use semaphore with ->count == 1, but that's just an accident. -ss p.s. frankly, I don't see any "locking issues" in Steven's patch.