From owner-svn-src-head@FreeBSD.ORG Thu Aug 29 18:36:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E8CA8E56; Thu, 29 Aug 2013 18:36:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D59E12F73; Thu, 29 Aug 2013 18:36:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7TIalqW012585; Thu, 29 Aug 2013 18:36:47 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7TIalTv012584; Thu, 29 Aug 2013 18:36:47 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201308291836.r7TIalTv012584@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 29 Aug 2013 18:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255037 - head/sys/dev/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2013 18:36:48 -0000 Author: jkim Date: Thu Aug 29 18:36:47 2013 New Revision: 255037 URL: http://svnweb.freebsd.org/changeset/base/255037 Log: Fix atomic operations on context_flag without altering semantics. Modified: head/sys/dev/drm2/drm_context.c Modified: head/sys/dev/drm2/drm_context.c ============================================================================== --- head/sys/dev/drm2/drm_context.c Thu Aug 29 17:45:13 2013 (r255036) +++ head/sys/dev/drm2/drm_context.c Thu Aug 29 18:36:47 2013 (r255037) @@ -182,7 +182,7 @@ bad: int drm_context_switch(struct drm_device *dev, int old, int new) { - if (test_and_set_bit(0, &dev->context_flag)) { + if (atomic_xchg(&dev->context_flag, 1) != 0) { DRM_ERROR("Reentering -- FIXME\n"); return EBUSY; } @@ -190,7 +190,7 @@ int drm_context_switch(struct drm_device DRM_DEBUG("Context switch from %d to %d\n", old, new); if (new == dev->last_context) { - clear_bit(0, &dev->context_flag); + atomic_xchg(&dev->context_flag, 0); return 0; } @@ -208,7 +208,7 @@ int drm_context_switch_complete(struct d /* If a context switch is ever initiated when the kernel holds the lock, release that lock here. */ - clear_bit(0, &dev->context_flag); + atomic_xchg(&dev->context_flag, 0); return 0; }