From patchwork Thu May 9 18:42:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 163754 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp1364087ilr; Thu, 9 May 2019 11:54:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbDqNJATdqAoXt39zgQQ+0qhNu+OoYK6I62NKBRJreAfjCk+WMiCCJhi0Z0JBhn3UsyYMd X-Received: by 2002:a17:902:521:: with SMTP id 30mr7213909plf.248.1557428072120; Thu, 09 May 2019 11:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557428072; cv=none; d=google.com; s=arc-20160816; b=GnktWPs6a7e582Tf/EudmuAQXATxE1/rrOFh+k9tySOGeH5EguGsifTvqKGfcbv8+o xFhxJjIlZSXoVPv2M0IycwlFLHRLW+juARsJJvUC/S3OM4arNnJVxbwf3HzClrcA8jS+ gSlOXi9kDh+6VJIlo0++hU1D3OlLm4xnPdyB24lBtmRVBL6jMxg9uc6BYtcZuF+XX8mH slW+ZzjpLl2wN+3Hkeq113hNXkDM5cIL+cpFeZ986rw74Vxm0hZFeNbNQCGKB3rc0oVY CB0f5WpyrPLzNtTaCaaQVc0GeWd8vkWrbu52u5fYzKApL/LJ9EK/HF2kjqA3uPET3+Zi Ak/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SiUkxKEZQnNmXpyG/Om7niFE0sB4CuhmO99C9uKlgPY=; b=WWOXJ63XErqVuVkL15NcisCrttOr3E2kOA2+ZwDNJy7G6Z8G3UGp27hPkEe295s7jW bP0c6t+sentUR/12trvubkhaT7n24xVBr3VtX/NLdjAlygv1tSj3ZGWIO2rBzspqoV9D mFUOG64uMBIUnfo1xPVka50eKHx+lGy98B5MlwtQFJbM1dhTmaGXrBcCCaEaHy1nZAfW D6nFFmGjqL1hY/yu9dcM28i8jQtzo369sd/NraSXV6h3h38+wmXS1EGHV8736Jmj8aE1 27mar7jOwvkFTOCQpxbcdzmvdA27UvxET+dVo7XluzVk9i6SBID3lbCT0W+0OP3Tk1q6 vKOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ziemxIfj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a62si4201252pla.107.2019.05.09.11.54.31; Thu, 09 May 2019 11:54:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ziemxIfj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729084AbfEISyb (ORCPT + 30 others); Thu, 9 May 2019 14:54:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:49246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728301AbfEISy1 (ORCPT ); Thu, 9 May 2019 14:54:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C39B52183F; Thu, 9 May 2019 18:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557428067; bh=zxR1iS372/HBPbflDvjoOuYk9gDbDXGjCZR08oSYC7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ziemxIfj6EvYLnBW1Hv3G6GM5ACl1dZ3FwPGB0LL5Lvy63nYGaPCSRNQxPedHllwD A/uf9AN5olWpQKp/CKcTP3Yf1m+j6wGSvEhVbHdC7lRUG79AiUf3XkcA9G3T3Ds10z Q4Oq6Lc9ZRWN9Wn378pWSNKQRfHjyv0FLvjAhRYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Jonathan Cameron Subject: [PATCH 5.1 14/30] iio: adc: qcom-spmi-adc5: Fix of-based module autoloading Date: Thu, 9 May 2019 20:42:46 +0200 Message-Id: <20190509181253.883706841@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190509181250.417203112@linuxfoundation.org> References: <20190509181250.417203112@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson commit 447ccb4e0834a9f9f0dd5643e421c7f1a1649e6a upstream. The of_device_id table needs to be registered as module alias in order for automatic module loading to pick the kernel module based on the DeviceTree compatible. So add MODULE_DEVICE_TABLE() to make this happen. Fixes: e13d757279bb ("iio: adc: Add QCOM SPMI PMIC5 ADC driver") Cc: stable@vger.kernel.org Signed-off-by: Bjorn Andersson Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/qcom-spmi-adc5.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/iio/adc/qcom-spmi-adc5.c +++ b/drivers/iio/adc/qcom-spmi-adc5.c @@ -664,6 +664,7 @@ static const struct of_device_id adc5_ma }, { } }; +MODULE_DEVICE_TABLE(of, adc5_match_table); static int adc5_get_dt_data(struct adc5_chip *adc, struct device_node *node) { From patchwork Thu May 9 18:43:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 163755 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp1365237ilr; Thu, 9 May 2019 11:55:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEdFWRIEQ1QiEAX2TjfEEAdFm5Xgb3OPxxGHsDlBr3EMS1sTrnQhlCWO9QloZkljyyfdGn X-Received: by 2002:a63:ca0b:: with SMTP id n11mr7882751pgi.442.1557428138326; Thu, 09 May 2019 11:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557428138; cv=none; d=google.com; s=arc-20160816; b=bK6Jt6JAIgp4vQoT1E6kVvTR9EhX2hHgAMe3aOjX6s/6d4Ufq37hnDAAe9CVZMKOvL npGmgKKO7KkniKG+6gXSuPPxOj6N1S0GlSeGJ+DW2DsYMzTGWRpwyx45VHROqQdIiUds kORlYlig5mHfVgomCb0ug8PijLgTdnw+06BEMTDorCitcI0mYP8exfJ+COln6oJMxL6C PhA4CogQFgXOihum3Y05/ocz/fiabFvDb2lbp3k0rlBSz74STda4OAbzw04F7XY8yguQ 0F7KaHyN+uM1msw7OBirhnJOxzC0FD/6m9ycozhnIDA7sgGAkvfVKkUhTzk1n8YPNazU aZ6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zxp6oyGnJtBFNAsvsvyqiJiWKlsOz/o8wAvGHDmgefA=; b=iaqQxfcZhTqi++1Wal1zAQ0zumuULoIlEyKq9sDa4r0PbR4INam1PlSOAC/HgtIRtK vLdyAh/g+8kRNQ/qYBeltDmIv2uP4nzlxMAJnSj49PPDiGLkZ157iJMdJFUQGt7F0jNZ Kz5a5kL/3poxW66nY0utaXHsxr1byX0wHIxpJIt+35cECtkC8fctumja9owxG5qobKLx QUYeHjowhL6mAU6P7atlI3s8Vacoqu+fNfl6jJ2JMCxz8hXp6V1W9hFkTp+fY9rvGw4y QPAdxD1iEu3LJmz5erHmJLph+b+YuojW+Y3Mn7/c7Nz8VpARtSrL7gOlhwayD5Tfqmw7 oHmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MqX2ECYG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si3772603plo.203.2019.05.09.11.55.38; Thu, 09 May 2019 11:55:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MqX2ECYG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729262AbfEISzh (ORCPT + 30 others); Thu, 9 May 2019 14:55:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:50660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729252AbfEISze (ORCPT ); Thu, 9 May 2019 14:55:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 56B582183F; Thu, 9 May 2019 18:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557428133; bh=M/WflKJ18bUUTjs4bfqR6PSZ0fvoLlGIFcH8OVmjCno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqX2ECYGyHWVHUInosHyqNpSsFxx8NTH5r/KTvpei+KGQpQsI60aRfNmVt9XYWgDM 3sYmoaW4CSPzrnWjf9Yug/8/fC2Ifp0JwdNQ7T8G7Ux7gjF+3D9416LUYRvI2vVUfW WU6cUydGeAGaDRv/+UQhmup+Dl+nfDCmqtL3J+DQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Will Deacon Subject: [PATCH 5.1 30/30] arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP Date: Thu, 9 May 2019 20:43:02 +0200 Message-Id: <20190509181257.397658621@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190509181250.417203112@linuxfoundation.org> References: <20190509181250.417203112@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Will Deacon commit 03110a5cb2161690ae5ac04994d47ed0cd6cef75 upstream. Our futex implementation makes use of LDXR/STXR loops to perform atomic updates to user memory from atomic context. This can lead to latency problems if we end up spinning around the LL/SC sequence at the expense of doing something useful. Rework our futex atomic operations so that we return -EAGAIN if we fail to update the futex word after 128 attempts. The core futex code will reschedule if necessary and we'll try again later. Cc: Fixes: 6170a97460db ("arm64: Atomic operations") Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/futex.h | 55 +++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 21 deletions(-) --- a/arch/arm64/include/asm/futex.h +++ b/arch/arm64/include/asm/futex.h @@ -23,26 +23,34 @@ #include +#define FUTEX_MAX_LOOPS 128 /* What's the largest number you can think of? */ + #define __futex_atomic_op(insn, ret, oldval, uaddr, tmp, oparg) \ do { \ + unsigned int loops = FUTEX_MAX_LOOPS; \ + \ uaccess_enable(); \ asm volatile( \ " prfm pstl1strm, %2\n" \ "1: ldxr %w1, %2\n" \ insn "\n" \ "2: stlxr %w0, %w3, %2\n" \ -" cbnz %w0, 1b\n" \ -" dmb ish\n" \ +" cbz %w0, 3f\n" \ +" sub %w4, %w4, %w0\n" \ +" cbnz %w4, 1b\n" \ +" mov %w0, %w7\n" \ "3:\n" \ +" dmb ish\n" \ " .pushsection .fixup,\"ax\"\n" \ " .align 2\n" \ -"4: mov %w0, %w5\n" \ +"4: mov %w0, %w6\n" \ " b 3b\n" \ " .popsection\n" \ _ASM_EXTABLE(1b, 4b) \ _ASM_EXTABLE(2b, 4b) \ - : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp) \ - : "r" (oparg), "Ir" (-EFAULT) \ + : "=&r" (ret), "=&r" (oldval), "+Q" (*uaddr), "=&r" (tmp), \ + "+r" (loops) \ + : "r" (oparg), "Ir" (-EFAULT), "Ir" (-EAGAIN) \ : "memory"); \ uaccess_disable(); \ } while (0) @@ -57,23 +65,23 @@ arch_futex_atomic_op_inuser(int op, int switch (op) { case FUTEX_OP_SET: - __futex_atomic_op("mov %w3, %w4", + __futex_atomic_op("mov %w3, %w5", ret, oldval, uaddr, tmp, oparg); break; case FUTEX_OP_ADD: - __futex_atomic_op("add %w3, %w1, %w4", + __futex_atomic_op("add %w3, %w1, %w5", ret, oldval, uaddr, tmp, oparg); break; case FUTEX_OP_OR: - __futex_atomic_op("orr %w3, %w1, %w4", + __futex_atomic_op("orr %w3, %w1, %w5", ret, oldval, uaddr, tmp, oparg); break; case FUTEX_OP_ANDN: - __futex_atomic_op("and %w3, %w1, %w4", + __futex_atomic_op("and %w3, %w1, %w5", ret, oldval, uaddr, tmp, ~oparg); break; case FUTEX_OP_XOR: - __futex_atomic_op("eor %w3, %w1, %w4", + __futex_atomic_op("eor %w3, %w1, %w5", ret, oldval, uaddr, tmp, oparg); break; default: @@ -93,6 +101,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 oldval, u32 newval) { int ret = 0; + unsigned int loops = FUTEX_MAX_LOOPS; u32 val, tmp; u32 __user *uaddr; @@ -104,20 +113,24 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, asm volatile("// futex_atomic_cmpxchg_inatomic\n" " prfm pstl1strm, %2\n" "1: ldxr %w1, %2\n" -" sub %w3, %w1, %w4\n" -" cbnz %w3, 3f\n" -"2: stlxr %w3, %w5, %2\n" -" cbnz %w3, 1b\n" -" dmb ish\n" +" sub %w3, %w1, %w5\n" +" cbnz %w3, 4f\n" +"2: stlxr %w3, %w6, %2\n" +" cbz %w3, 3f\n" +" sub %w4, %w4, %w3\n" +" cbnz %w4, 1b\n" +" mov %w0, %w8\n" "3:\n" +" dmb ish\n" +"4:\n" " .pushsection .fixup,\"ax\"\n" -"4: mov %w0, %w6\n" -" b 3b\n" +"5: mov %w0, %w7\n" +" b 4b\n" " .popsection\n" - _ASM_EXTABLE(1b, 4b) - _ASM_EXTABLE(2b, 4b) - : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp) - : "r" (oldval), "r" (newval), "Ir" (-EFAULT) + _ASM_EXTABLE(1b, 5b) + _ASM_EXTABLE(2b, 5b) + : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp), "+r" (loops) + : "r" (oldval), "r" (newval), "Ir" (-EFAULT), "Ir" (-EAGAIN) : "memory"); uaccess_disable();