From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx1.redhat.com ([66.187.233.31]) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1KTL8s-0002bo-KP for kexec@lists.infradead.org; Wed, 13 Aug 2008 18:32:18 +0000 Date: Wed, 13 Aug 2008 14:31:56 -0400 From: Vivek Goyal Subject: Re: [PATCH] kexec jump: fix compiling warning on xchg(&kexec_lock, 0) in kernel_kexec() Message-ID: <20080813183156.GA20974@redhat.com> References: <1218618760.24951.137.camel@caritas-dev.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: kexec-bounces@lists.infradead.org Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: "Eric W. Biederman" Cc: nigel@nigel.suspend2.net, Kexec Mailing List , linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Pavel Machek , Huang Ying , Andrew Morton , Linus Torvalds , mingo@elte.hu On Wed, Aug 13, 2008 at 11:12:48AM -0700, Eric W. Biederman wrote: > Linus Torvalds writes: > > > On Wed, 13 Aug 2008, Huang Ying wrote: > >> > >> - xchg(&kexec_lock, 0); > >> + locked = xchg(&kexec_lock, 0); > >> + BUG_ON(!locked); > > > > Why do you want to do this at all? > > > > And why do you implement your locks with xchg() in the first place? That's > > total and utter crap. > > > > Hint: we have _real_ locking primitives in the kernel. > > This part certainly. > > The way the code should work, and the way it has in the past is: > image = xchg(&kexec_image, NULL) > if (!image) > return -EINVAL; > > Very simple and very obvious and very easy to get right, and it has > been that way for years. > Hi Eric, Are there any issues with usage of test_and_set_bit() or usage of spinlock primitives? Thanks Vivek _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756817AbYHMScm (ORCPT ); Wed, 13 Aug 2008 14:32:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751763AbYHMScd (ORCPT ); Wed, 13 Aug 2008 14:32:33 -0400 Received: from mx1.redhat.com ([66.187.233.31]:34153 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751703AbYHMScd (ORCPT ); Wed, 13 Aug 2008 14:32:33 -0400 Date: Wed, 13 Aug 2008 14:31:56 -0400 From: Vivek Goyal To: "Eric W. Biederman" Cc: Linus Torvalds , Huang Ying , Pavel Machek , nigel@nigel.suspend2.net, "Rafael J. Wysocki" , Andrew Morton , mingo@elte.hu, linux-kernel@vger.kernel.org, Kexec Mailing List Subject: Re: [PATCH] kexec jump: fix compiling warning on xchg(&kexec_lock, 0) in kernel_kexec() Message-ID: <20080813183156.GA20974@redhat.com> References: <1218618760.24951.137.camel@caritas-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 13, 2008 at 11:12:48AM -0700, Eric W. Biederman wrote: > Linus Torvalds writes: > > > On Wed, 13 Aug 2008, Huang Ying wrote: > >> > >> - xchg(&kexec_lock, 0); > >> + locked = xchg(&kexec_lock, 0); > >> + BUG_ON(!locked); > > > > Why do you want to do this at all? > > > > And why do you implement your locks with xchg() in the first place? That's > > total and utter crap. > > > > Hint: we have _real_ locking primitives in the kernel. > > This part certainly. > > The way the code should work, and the way it has in the past is: > image = xchg(&kexec_image, NULL) > if (!image) > return -EINVAL; > > Very simple and very obvious and very easy to get right, and it has > been that way for years. > Hi Eric, Are there any issues with usage of test_and_set_bit() or usage of spinlock primitives? Thanks Vivek