From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C5342C856; Mon, 19 Feb 2024 11:51:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708343474; cv=none; b=Ks0SuLQZhRiCDqphm/1T+4lGYzLmnXoZB7p4AzR5S2UhQIkkUSr+KSKnX9EmQDouvInPQtTHLwoHW3xJFcaFq0+LGsGD68A0AAZ3MhamwuxMGT+GVlqEsPxebAoDFJn889i8Q9ZZko4GKoxSHk+lnMlsK6AmhhDDaSx7k208UxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708343474; c=relaxed/simple; bh=u8TUJFmzFu3voi1EVgnpbMlRsT1vKI0cpUQEGm899u0=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TeowzFz0hAih1qtF7fngG3hPAJ/ctaZVS8k6nHU93RtZ6k+1SUvLqQ+J1Kd7CXxCxVvYGsWfkIydzArLmCrFix1plnRNiWI+1sMpk/6zVs5Yv3a42MHutihtOtiPIXxP6Gqhgob9pvEK88gKhZJ+X3FzabFp8ezVx+j7MtZx7zg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Tdgkw3YNlz6K8p6; Mon, 19 Feb 2024 19:47:36 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 997B5140DDF; Mon, 19 Feb 2024 19:51:09 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 19 Feb 2024 11:51:09 +0000 Date: Mon, 19 Feb 2024 11:51:08 +0000 From: Jonathan Cameron To: "Fabio M. De Francesco" CC: Peter Zijlstra , Dan Williams , , , Ingo Molnar , Dave Jiang , Ira Weiny Subject: Re: [PATCH 1/3 v5] cleanup: Add cond_guard() to conditional guards Message-ID: <20240219115108.00002be2@Huawei.com> In-Reply-To: <20240217105904.1912368-2-fabio.maria.de.francesco@linux.intel.com> References: <20240217105904.1912368-1-fabio.maria.de.francesco@linux.intel.com> <20240217105904.1912368-2-fabio.maria.de.francesco@linux.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) On Sat, 17 Feb 2024 11:59:02 +0100 "Fabio M. De Francesco" wrote: > Add cond_guard() macro to conditional guards. > > cond_guard() is a guard to be used with the conditional variants of locks, > like down_read_trylock() or mutex_lock_interruptible(). > > It takes a statement (or statement-expression) that is passed as its > second argument. That statement (or statement-expression) is executed if > waiting for a lock is interrupted or if a _trylock() fails in case of > contention. > > Usage example: > > cond_guard(mutex_intr, return -EINTR, &mutex); > > Consistent with other usage of _guard(), locks are unlocked at the exit of > the scope where cond_guard() is called. This macro can be called multiple > times in the same scope. > > Cc: Dave Jiang > Cc: Peter Zijlstra > Suggested-by: Dan Williams > Suggested-by: Ira Weiny > Suggested-by: Jonathan Cameron > Signed-off-by: Fabio M. De Francesco Looks good. Reviewed-by: Jonathan Cameron