• S
    powerpc/pseries: Fix regression while building external modules · a4486444
    Srikar Dronamraju 提交于
    stable inclusion
    from linux-4.19.201
    commit 91bbeacf5a4c78176042aca62708b6bb5ab68a37
    
    --------------------------------
    
    commit 333cf507 upstream.
    
    With commit c9f34013 ("powerpc: Always enable queued spinlocks for
    64s, disable for others") CONFIG_PPC_QUEUED_SPINLOCKS is always
    enabled on ppc64le, external modules that use spinlock APIs are
    failing.
    
      ERROR: modpost: GPL-incompatible module XXX.ko uses GPL-only symbol 'shared_processor'
    
    Before the above commit, modules were able to build without any
    issues. Also this problem is not seen on other architectures. This
    problem can be workaround if CONFIG_UNINLINE_SPIN_UNLOCK is enabled in
    the config. However CONFIG_UNINLINE_SPIN_UNLOCK is not enabled by
    default and only enabled in certain conditions like
    CONFIG_DEBUG_SPINLOCKS is set in the kernel config.
    
      #include <linux/module.h>
      spinlock_t spLock;
    
      static int __init spinlock_test_init(void)
      {
              spin_lock_init(&spLock);
              spin_lock(&spLock);
              spin_unlock(&spLock);
              return 0;
      }
    
      static void __exit spinlock_test_exit(void)
      {
      	printk("spinlock_test unloaded\n");
      }
      module_init(spinlock_test_init);
      module_exit(spinlock_test_exit);
    
      MODULE_DESCRIPTION ("spinlock_test");
      MODULE_LICENSE ("non-GPL");
      MODULE_AUTHOR ("Srikar Dronamraju");
    
    Given that spin locks are one of the basic facilities for module code,
    this effectively makes it impossible to build/load almost any non GPL
    modules on ppc64le.
    
    This was first reported at https://github.com/openzfs/zfs/issues/11172
    
    Currently shared_processor is exported as GPL only symbol.
    Fix this for parity with other architectures by exposing
    shared_processor to non-GPL modules too.
    
    Fixes: 14c73bd3 ("powerpc/vcpu: Assume dedicated processors as non-preempt")
    Cc: stable@vger.kernel.org # v5.5+
    Reported-by: marc.c.dionne@gmail.com
    Signed-off-by: NSrikar Dronamraju <srikar@linux.vnet.ibm.com>
    Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20210729060449.292780-1-srikar@linux.vnet.ibm.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    a4486444
setup.c 27.4 KB