Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1596230 > unrolled thread

[PATCH 03/19] alpha: marvel: make use of raw_spinlock variants

Started byJulia Cartwright <julia@ni.com>
First post2017-03-09 18:30 +0100
Last post2017-03-12 04:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 03/19] alpha: marvel: make use of raw_spinlock variants Julia Cartwright <julia@ni.com> - 2017-03-09 18:30 +0100
    Re: [PATCH 03/19] alpha: marvel: make use of raw_spinlock variants kbuild test robot <lkp@intel.com> - 2017-03-12 04:00 +0100

#1596230 — [PATCH 03/19] alpha: marvel: make use of raw_spinlock variants

FromJulia Cartwright <julia@ni.com>
Date2017-03-09 18:30 +0100
Subject[PATCH 03/19] alpha: marvel: make use of raw_spinlock variants
Message-ID<tja30-8iG-9@gated-at.bofh.it>
The alpha/marvel code currently implements an irq_chip for handling
interrupts; due to how irq_chip handling is done, it's necessary for the
irq_chip methods to be invoked from hardirq context, even on a a
real-time kernel.  Because the spinlock_t type becomes a "sleeping"
spinlock w/ RT kernels, it is not suitable to be used with irq_chips.

A quick audit of the operations under the lock reveal that they do only
minimal, bounded work, and are therefore safe to do under a raw spinlock.

Signed-off-by: Julia Cartwright <julia@ni.com>
---
 arch/alpha/include/asm/core_marvel.h |  2 +-
 arch/alpha/kernel/sys_marvel.c       | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/alpha/include/asm/core_marvel.h b/arch/alpha/include/asm/core_marvel.h
index dad300fa14ce..8dcf9dbda618 100644
--- a/arch/alpha/include/asm/core_marvel.h
+++ b/arch/alpha/include/asm/core_marvel.h
@@ -312,7 +312,7 @@ struct io7 {
 	io7_port7_csrs *csrs;
 	struct io7_port ports[IO7_NUM_PORTS];
 
-	spinlock_t irq_lock;
+	raw_spinlock_t irq_lock;
 };
 
 #ifndef __EXTERN_INLINE
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 24e41bd7d3c9..3e533920371f 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -115,11 +115,11 @@ io7_enable_irq(struct irq_data *d)
 		return;
 	}
 
-	spin_lock(&io7->irq_lock);
+	raw_spin_lock(&io7->irq_lock);
 	*ctl |= 1UL << 24;
 	mb();
 	*ctl;
-	spin_unlock(&io7->irq_lock);
+	raw_spin_unlock(&io7->irq_lock);
 }
 
 static void
@@ -136,11 +136,11 @@ io7_disable_irq(struct irq_data *d)
 		return;
 	}
 
-	spin_lock(&io7->irq_lock);
+	raw_spin_lock(&io7->irq_lock);
 	*ctl &= ~(1UL << 24);
 	mb();
 	*ctl;
-	spin_unlock(&io7->irq_lock);
+	raw_spin_unlock(&io7->irq_lock);
 }
 
 static void
@@ -263,7 +263,7 @@ init_io7_irqs(struct io7 *io7,
 	 */
 	printk("  Interrupts reported to CPU at PE %u\n", boot_cpuid);
 
-	spin_lock(&io7->irq_lock);
+	raw_spin_lock(&io7->irq_lock);
 
 	/* set up the error irqs */
 	io7_redirect_irq(io7, &io7->csrs->HLT_CTL.csr, boot_cpuid);
@@ -295,7 +295,7 @@ init_io7_irqs(struct io7 *io7,
 	for (i = 0; i < 16; ++i)
 		init_one_io7_msi(io7, i, boot_cpuid);
 
-	spin_unlock(&io7->irq_lock);
+	raw_spin_unlock(&io7->irq_lock);
 }
 
 static void __init
-- 
2.11.1

[toc] | [next] | [standalone]


#1598536

Fromkbuild test robot <lkp@intel.com>
Date2017-03-12 04:00 +0100
Message-ID<tk1TH-3up-3@gated-at.bofh.it>
In reply to#1596230

[Multipart message — attachments visible in raw view] — view raw

Hi Julia,

[auto build test ERROR on gpio/for-next]
[also build test ERROR on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Julia-Cartwright/fixup-usage-of-non-raw-spinlocks-in-irqchips/20170312-015922
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: alpha-alldefconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=alpha 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/mmzone.h:7:0,
                    from include/linux/gfp.h:5,
                    from include/linux/mm.h:9,
                    from arch/alpha/include/asm/io.h:7,
                    from arch/alpha/kernel/core_marvel.c:8:
   arch/alpha/kernel/core_marvel.c: In function 'alloc_io7':
>> arch/alpha/kernel/core_marvel.c:121:17: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
     spin_lock_init(&io7->irq_lock);
                    ^
   include/linux/spinlock.h:293:17: note: in definition of macro 'spin_lock_init'
     spinlock_check(_lock);    \
                    ^~~~~
   include/linux/spinlock.h:286:40: note: expected 'spinlock_t * {aka struct spinlock *}' but argument is of type 'raw_spinlock_t * {aka struct raw_spinlock *}'
    static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
                                           ^~~~~~~~~~~~~~
   In file included from include/linux/mmzone.h:7:0,
                    from include/linux/gfp.h:5,
                    from include/linux/mm.h:9,
                    from arch/alpha/include/asm/io.h:7,
                    from arch/alpha/kernel/core_marvel.c:8:
>> include/linux/spinlock.h:294:29: error: 'raw_spinlock_t {aka struct raw_spinlock}' has no member named 'rlock'; did you mean 'raw_lock'?
     raw_spin_lock_init(&(_lock)->rlock);  \
                                ^
   include/linux/spinlock.h:104:9: note: in definition of macro 'raw_spin_lock_init'
     do { *(lock) = __RAW_SPIN_LOCK_UNLOCKED(lock); } while (0)
            ^~~~
>> arch/alpha/kernel/core_marvel.c:121:2: note: in expansion of macro 'spin_lock_init'
     spin_lock_init(&io7->irq_lock);
     ^~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +294 include/linux/spinlock.h

c2f21ce2 Thomas Gleixner 2009-12-02  280  #endif
c2f21ce2 Thomas Gleixner 2009-12-02  281  
c2f21ce2 Thomas Gleixner 2009-12-02  282  /*
c2f21ce2 Thomas Gleixner 2009-12-02  283   * Map the spin_lock functions to the raw variants for PREEMPT_RT=n
c2f21ce2 Thomas Gleixner 2009-12-02  284   */
c2f21ce2 Thomas Gleixner 2009-12-02  285  
3490565b Denys Vlasenko  2015-07-13 @286  static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
c2f21ce2 Thomas Gleixner 2009-12-02  287  {
c2f21ce2 Thomas Gleixner 2009-12-02  288  	return &lock->rlock;
c2f21ce2 Thomas Gleixner 2009-12-02  289  }
c2f21ce2 Thomas Gleixner 2009-12-02  290  
c2f21ce2 Thomas Gleixner 2009-12-02  291  #define spin_lock_init(_lock)				\
c2f21ce2 Thomas Gleixner 2009-12-02  292  do {							\
c2f21ce2 Thomas Gleixner 2009-12-02  293  	spinlock_check(_lock);				\
c2f21ce2 Thomas Gleixner 2009-12-02 @294  	raw_spin_lock_init(&(_lock)->rlock);		\
c2f21ce2 Thomas Gleixner 2009-12-02  295  } while (0)
c2f21ce2 Thomas Gleixner 2009-12-02  296  
3490565b Denys Vlasenko  2015-07-13  297  static __always_inline void spin_lock(spinlock_t *lock)

:::::: The code at line 294 was first introduced by commit
:::::: c2f21ce2e31286a0a32f8da0a7856e9ca1122ef3 locking: Implement new raw_spinlock

:::::: TO: Thomas Gleixner <tglx@linutronix.de>
:::::: CC: Thomas Gleixner <tglx@linutronix.de>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web