From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752673AbbE0KCp (ORCPT ); Wed, 27 May 2015 06:02:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:33386 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbbE0KCn (ORCPT ); Wed, 27 May 2015 06:02:43 -0400 Date: Wed, 27 May 2015 03:02:02 -0700 From: tip-bot for Alexander Shishkin Message-ID: Cc: hpa@zytor.com, torvalds@linux-foundation.org, alexander.shishkin@linux.intel.com, mingo@kernel.org, peterz@infradead.org, paulus@samba.org, linux-kernel@vger.kernel.org, tglx@linutronix.de Reply-To: paulus@samba.org, linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, alexander.shishkin@linux.intel.com, tglx@linutronix.de, torvalds@linux-foundation.org, hpa@zytor.com In-Reply-To: <1432308626-18845-2-git-send-email-alexander.shishkin@linux.intel.com> References: <1432308626-18845-2-git-send-email-alexander.shishkin@linux.intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf: Disallow sparse AUX allocations for non-SG PMUs in overwrite mode Git-Commit-ID: aa319bcd366349c6f72fcd331da89d3d06090651 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: aa319bcd366349c6f72fcd331da89d3d06090651 Gitweb: http://git.kernel.org/tip/aa319bcd366349c6f72fcd331da89d3d06090651 Author: Alexander Shishkin AuthorDate: Fri, 22 May 2015 18:30:20 +0300 Committer: Ingo Molnar CommitDate: Wed, 27 May 2015 09:16:20 +0200 perf: Disallow sparse AUX allocations for non-SG PMUs in overwrite mode PMUs that don't support hardware scatter tables require big contiguous chunks of memory and a PMI to switch between them. However, in overwrite using a PMI for this purpose adds extra overhead that the users would like to avoid. Thus, in overwrite mode for such PMUs we can only allow one contiguous chunk for the entire requested buffer. This patch changes the behavior accordingly, so that if the buddy allocator fails to come up with a single high-order chunk for the entire requested buffer, the allocation will fail. Signed-off-by: Alexander Shishkin Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: acme@infradead.org Cc: adrian.hunter@intel.com Cc: hpa@zytor.com Link: http://lkml.kernel.org/r/1432308626-18845-2-git-send-email-alexander.shishkin@linux.intel.com Signed-off-by: Ingo Molnar --- kernel/events/ring_buffer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 232f00f..725c416 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -493,6 +493,20 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, rb->aux_pages[rb->aux_nr_pages] = page_address(page++); } + /* + * In overwrite mode, PMUs that don't support SG may not handle more + * than one contiguous allocation, since they rely on PMI to do double + * buffering. In this case, the entire buffer has to be one contiguous + * chunk. + */ + if ((event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) && + overwrite) { + struct page *page = virt_to_page(rb->aux_pages[0]); + + if (page_private(page) != max_order) + goto out; + } + rb->aux_priv = event->pmu->setup_aux(event->cpu, rb->aux_pages, nr_pages, overwrite); if (!rb->aux_priv)