Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4445695pxa; Mon, 10 Aug 2020 09:13:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxfu2ZuonCQJKvglJYxzkCyO3GNKrNUxPSu4L4/ZGd2UDJvet/6GKwOyyN7mBCSzeUWP6q X-Received: by 2002:a17:906:f9d7:: with SMTP id lj23mr23668739ejb.500.1597076010553; Mon, 10 Aug 2020 09:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597076010; cv=none; d=google.com; s=arc-20160816; b=woQHIP4vSRHVr0K8YpuQFgcDTK4AJe6nThDBqo8ZtnnfPflIyR6f8m0poLDQNyO7lr Bo7I6yGl5uUZC/K5w+rrDsUVUg7h/V3buMWQwmDUsSRZaJVNoNgaD+oOYEktL5YAJ9rT uyVbKfDJFV7xMDSegYBIGh/+jS06VqxkhBfJ6+q5H7D5lP0zOx1lFcdpXtOtKP9p6rGG ZBUpAwcZFMpGtVYg9VAwYSmwmY01HCmdAhRz85Z3+Q6ZBYaOXgNPeHOyalIaAlu6wBO7 gZ2INu3xlMtX/CnpYA7QurvxEZNwW/ciD0Ysr97KjnsiUAgPZIQxUwBb3D6cJwf31bvW sQIw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YfL6NoXy0mnjBkSyXfiV+/XnphlGr8USHYs17EKPpvc=; b=Qdg55cZ00/iw92SQeCBFjG1v3yoY6/Febzoup+dQ6wib3lMJxjt1EZyKRJIHhPVvMp 7Tc8Lw9ArnwrTXwRmQyfr9D+bvc3hSP0wIgQYYNTHuZ6hdqqkaDv93S5WRc7Pm7weBgI RmB7WVnGLgh7bbI2Sr29Ow/06y1ePepRHLzCDgw8tjS3mEdTrCUuMeJ8TryBCvIG3AR3 NooowxcXJ+48Hx90qGlpANpmlM5Gq7X/r6gbtMfHR9BDEeNKH7UyT19FzzFOE9uG6HFR a+FDAnp+D6BUhLX3S9oZm8Gcqh7BisWU28mBHwQwcYNgNsXYBdql0CwPnjL3I3ixSdNO U39w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=IGbycisR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si4290751edd.284.2020.08.10.09.13.07; Mon, 10 Aug 2020 09:13:30 -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=@rere.qmqm.pl header.s=1 header.b=IGbycisR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726910AbgHJQMU (ORCPT + 99 others); Mon, 10 Aug 2020 12:12:20 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:36957 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726486AbgHJQMT (ORCPT ); Mon, 10 Aug 2020 12:12:19 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4BQLZp0gclz2d; Mon, 10 Aug 2020 18:12:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1597075938; bh=GTkOzh/b40VK8cnJiaBx/bKeY6XCllkdkCv/kZijaTk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IGbycisRi00k4XbjQq/9Qbuee4G2tBPYlKe2WVuq29MG/lpTWYYPQDsxb/edAF8rJ 1LvALCOX2dnYdewz/5YLEortK16n19WQgixwqoFhRJR/PlYSS8k3AzyphVGn454wX7 saoKmCL1saXFihjdUS0Kq11bO0/6ZZQdwtAq00FB5vDmYIRR1EE4LpRbXwohzhvsYh sGLYySCXD9g4/9bWXn5qlotNSbDXNY7+23p0XNV2oplvkqXw9P0q2UuvwhUCttjND1 Euq9wHlejZMMxAv9tSTyBlFwgCc7KI7c4nPxisLuOFcD+FUoiSkjBykTFefYbS50Hm 0k8ueBTkxdfxA== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Mon, 10 Aug 2020 18:12:16 +0200 From: =?iso-8859-2?Q?Micha=B3_Miros=B3aw?= To: Dmitry Osipenko Cc: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org Subject: Re: [PATCH] regulator: simplify locking Message-ID: <20200810161216.GB1100@qmqm.qmqm.pl> References: <40871bc7-2d6c-10d4-53b3-0aded21edf3b@gmail.com> <20200809223030.GB5522@qmqm.qmqm.pl> <8850c09f-4b24-7ab2-a0f7-e0d752f5a404@gmail.com> <20200810005927.GA13107@qmqm.qmqm.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Mon, Aug 10, 2020 at 08:14:20AM +0300, Dmitry Osipenko wrote: > 10.08.2020 03:59, Michał Mirosław пишет: > > On Mon, Aug 10, 2020 at 03:21:47AM +0300, Dmitry Osipenko wrote: > >> 10.08.2020 01:30, Michał Mirosław пишет: > >>> On Mon, Aug 10, 2020 at 12:40:04AM +0300, Dmitry Osipenko wrote: > >>>> 10.08.2020 00:16, Michał Mirosław пишет: [...] > >>>>> - mutex_lock(®ulator_nesting_mutex); > >>>>> + if (ww_ctx || !mutex_trylock_recursive(&rdev->mutex.base)) [...] > >>> I think that reimplementing the function just to not use it is not the > >>> right solution. The whole locking protocol is problematic and this patch > >>> just uncovers one side of it. > >> > >> It's not clear to me what is uncovered, the ref_cnt was always accessed > >> under lock. Could you please explain in a more details? [...] > The nested locking usage is discouraged in general because it is a > source of bugs. I guess it should be possible to get rid of all nested > lockings in the regulator core and use a pure ww_mutex, but somebody > should dedicate time to work on it. So using a deprecated function for deprecated functionality sounds just appropriate, doesn't it? :-) Best Regards, Michał Mirosław