From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Rob Herring <robherring2@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>,
Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Olof Johansson <olof@lixom.net>,
Russell King <linux@arm.linux.org.uk>,
Kees Cook <keescook@chromium.org>,
Tony Lindgren <tony@atomide.com>, Tony Luck <tony.luck@intel.com>
Subject: [PATCH 3.14 23/77] pstore-ram: Allow optional mapping with pgprot_noncached
Date: Tue, 13 Jan 2015 23:23:03 -0800 [thread overview]
Message-ID: <20150114072225.442771223@linuxfoundation.org> (raw)
In-Reply-To: <20150114072224.182299947@linuxfoundation.org>
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <tony@atomide.com>
commit 027bc8b08242c59e19356b4b2c189f2d849ab660 upstream.
On some ARMs the memory can be mapped pgprot_noncached() and still
be working for atomic operations. As pointed out by Colin Cross
<ccross@android.com>, in some cases you do want to use
pgprot_noncached() if the SoC supports it to see a debug printk
just before a write hanging the system.
On ARMs, the atomic operations on strongly ordered memory are
implementation defined. So let's provide an optional kernel parameter
for configuring pgprot_noncached(), and use pgprot_writecombine() by
default.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rob Herring <robherring2@gmail.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Olof Johansson <olof@lixom.net>
Cc: Russell King <linux@arm.linux.org.uk>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Documentation/ramoops.txt | 13 +++++++++++--
fs/pstore/ram.c | 13 +++++++++++--
fs/pstore/ram_core.c | 31 ++++++++++++++++++++++---------
include/linux/pstore_ram.h | 4 +++-
4 files changed, 47 insertions(+), 14 deletions(-)
--- a/Documentation/ramoops.txt
+++ b/Documentation/ramoops.txt
@@ -14,11 +14,19 @@ survive after a restart.
1. Ramoops concepts
-Ramoops uses a predefined memory area to store the dump. The start and size of
-the memory area are set using two variables:
+Ramoops uses a predefined memory area to store the dump. The start and size
+and type of the memory area are set using three variables:
* "mem_address" for the start
* "mem_size" for the size. The memory size will be rounded down to a
power of two.
+ * "mem_type" to specifiy if the memory type (default is pgprot_writecombine).
+
+Typically the default value of mem_type=0 should be used as that sets the pstore
+mapping to pgprot_writecombine. Setting mem_type=1 attempts to use
+pgprot_noncached, which only works on some platforms. This is because pstore
+depends on atomic operations. At least on ARM, pgprot_noncached causes the
+memory to be mapped strongly ordered, and atomic operations on strongly ordered
+memory are implementation defined, and won't work on many ARMs such as omaps.
The memory area is divided into "record_size" chunks (also rounded down to
power of two) and each oops/panic writes a "record_size" chunk of
@@ -55,6 +63,7 @@ Setting the ramoops parameters can be do
static struct ramoops_platform_data ramoops_data = {
.mem_size = <...>,
.mem_address = <...>,
+ .mem_type = <...>,
.record_size = <...>,
.dump_oops = <...>,
.ecc = <...>,
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -61,6 +61,11 @@ module_param(mem_size, ulong, 0400);
MODULE_PARM_DESC(mem_size,
"size of reserved RAM used to store oops/panic logs");
+static unsigned int mem_type;
+module_param(mem_type, uint, 0600);
+MODULE_PARM_DESC(mem_type,
+ "set to 1 to try to use unbuffered memory (default 0)");
+
static int dump_oops = 1;
module_param(dump_oops, int, 0600);
MODULE_PARM_DESC(dump_oops,
@@ -79,6 +84,7 @@ struct ramoops_context {
struct persistent_ram_zone *fprz;
phys_addr_t phys_addr;
unsigned long size;
+ unsigned int memtype;
size_t record_size;
size_t console_size;
size_t ftrace_size;
@@ -353,7 +359,8 @@ static int ramoops_init_przs(struct devi
size_t sz = cxt->record_size;
cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
- &cxt->ecc_info);
+ &cxt->ecc_info,
+ cxt->memtype);
if (IS_ERR(cxt->przs[i])) {
err = PTR_ERR(cxt->przs[i]);
dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
@@ -383,7 +390,7 @@ static int ramoops_init_prz(struct devic
return -ENOMEM;
}
- *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info);
+ *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info, cxt->memtype);
if (IS_ERR(*prz)) {
int err = PTR_ERR(*prz);
@@ -431,6 +438,7 @@ static int ramoops_probe(struct platform
cxt->dump_read_cnt = 0;
cxt->size = pdata->mem_size;
cxt->phys_addr = pdata->mem_address;
+ cxt->memtype = pdata->mem_type;
cxt->record_size = pdata->record_size;
cxt->console_size = pdata->console_size;
cxt->ftrace_size = pdata->ftrace_size;
@@ -561,6 +569,7 @@ static void ramoops_register_dummy(void)
dummy_data->mem_size = mem_size;
dummy_data->mem_address = mem_address;
+ dummy_data->mem_type = 0;
dummy_data->record_size = record_size;
dummy_data->console_size = ramoops_console_size;
dummy_data->ftrace_size = ramoops_ftrace_size;
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -380,7 +380,8 @@ void persistent_ram_zap(struct persisten
persistent_ram_update_header_ecc(prz);
}
-static void *persistent_ram_vmap(phys_addr_t start, size_t size)
+static void *persistent_ram_vmap(phys_addr_t start, size_t size,
+ unsigned int memtype)
{
struct page **pages;
phys_addr_t page_start;
@@ -392,7 +393,10 @@ static void *persistent_ram_vmap(phys_ad
page_start = start - offset_in_page(start);
page_count = DIV_ROUND_UP(size + offset_in_page(start), PAGE_SIZE);
- prot = pgprot_writecombine(PAGE_KERNEL);
+ if (memtype)
+ prot = pgprot_noncached(PAGE_KERNEL);
+ else
+ prot = pgprot_writecombine(PAGE_KERNEL);
pages = kmalloc(sizeof(struct page *) * page_count, GFP_KERNEL);
if (!pages) {
@@ -411,8 +415,11 @@ static void *persistent_ram_vmap(phys_ad
return vaddr;
}
-static void *persistent_ram_iomap(phys_addr_t start, size_t size)
+static void *persistent_ram_iomap(phys_addr_t start, size_t size,
+ unsigned int memtype)
{
+ void *va;
+
if (!request_mem_region(start, size, "persistent_ram")) {
pr_err("request mem region (0x%llx@0x%llx) failed\n",
(unsigned long long)size, (unsigned long long)start);
@@ -422,19 +429,24 @@ static void *persistent_ram_iomap(phys_a
buffer_start_add = buffer_start_add_locked;
buffer_size_add = buffer_size_add_locked;
- return ioremap_wc(start, size);
+ if (memtype)
+ va = ioremap(start, size);
+ else
+ va = ioremap_wc(start, size);
+
+ return va;
}
static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
- struct persistent_ram_zone *prz)
+ struct persistent_ram_zone *prz, int memtype)
{
prz->paddr = start;
prz->size = size;
if (pfn_valid(start >> PAGE_SHIFT))
- prz->vaddr = persistent_ram_vmap(start, size);
+ prz->vaddr = persistent_ram_vmap(start, size, memtype);
else
- prz->vaddr = persistent_ram_iomap(start, size);
+ prz->vaddr = persistent_ram_iomap(start, size, memtype);
if (!prz->vaddr) {
pr_err("%s: Failed to map 0x%llx pages at 0x%llx\n", __func__,
@@ -502,7 +514,8 @@ void persistent_ram_free(struct persiste
}
struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
- u32 sig, struct persistent_ram_ecc_info *ecc_info)
+ u32 sig, struct persistent_ram_ecc_info *ecc_info,
+ unsigned int memtype)
{
struct persistent_ram_zone *prz;
int ret = -ENOMEM;
@@ -513,7 +526,7 @@ struct persistent_ram_zone *persistent_r
goto err;
}
- ret = persistent_ram_buffer_map(start, size, prz);
+ ret = persistent_ram_buffer_map(start, size, prz, memtype);
if (ret)
goto err;
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -53,7 +53,8 @@ struct persistent_ram_zone {
};
struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
- u32 sig, struct persistent_ram_ecc_info *ecc_info);
+ u32 sig, struct persistent_ram_ecc_info *ecc_info,
+ unsigned int memtype);
void persistent_ram_free(struct persistent_ram_zone *prz);
void persistent_ram_zap(struct persistent_ram_zone *prz);
@@ -76,6 +77,7 @@ ssize_t persistent_ram_ecc_string(struct
struct ramoops_platform_data {
unsigned long mem_size;
unsigned long mem_address;
+ unsigned int mem_type;
unsigned long record_size;
unsigned long console_size;
unsigned long ftrace_size;
next prev parent reply other threads:[~2015-01-14 7:23 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 7:22 [PATCH 3.14 00/77] 3.14.29-stable review Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 01/77] drivers/rtc/rtc-sirfsoc.c: move hardware initilization earlier in probe Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 03/77] ocfs2: fix journal commit deadlock Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 04/77] ocfs2: fix the wrong directory passed to ocfs2_lookup_ino_from_name() when link file Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 05/77] ath9k_hw: fix hardware queue allocation Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 06/77] ath9k: fix BE/BK queue order Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 07/77] can: peak_usb: fix cleanup sequence order in case of error during init Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 08/77] can: peak_usb: fix memset() usage Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 09/77] swiotlb-xen: pass dev_addr to xen_dma_unmap_page and xen_dma_sync_single_for_cpu Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 10/77] swiotlb-xen: remove BUG_ON in xen_bus_to_phys Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 11/77] swiotlb-xen: call xen_dma_sync_single_for_device when appropriate Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 12/77] swiotlb-xen: pass dev_addr to swiotlb_tbl_unmap_single Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 13/77] iwlwifi: mvm: update values for Smart Fifo Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 14/77] ath5k: fix hardware queue index assignment Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 15/77] ASoC: sigmadsp: Refuse to load firmware files with a non-supported version Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 16/77] ASoC: max98090: Fix ill-defined sidetone route Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 17/77] ASoC: dwc: Ensure FIFOs are flushed to prevent channel swap Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 18/77] powerpc: Fix bad NULL pointer check in udbg_uart_getc_poll() Greg Kroah-Hartman
2015-01-14 7:22 ` [PATCH 3.14 19/77] powerpc/book3s: Fix partial invalidation of TLBs in MCE code Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 20/77] powerpc/powernv: Switch off MMU before entering nap/sleep/rvwinkle mode Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 21/77] PCI: Restore detection of read-only BARs Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 22/77] pstore-ram: Fix hangs by using write-combine mappings Greg Kroah-Hartman
2015-01-14 7:23 ` Greg Kroah-Hartman [this message]
2015-01-14 7:23 ` [PATCH 3.14 24/77] UBI: Fix invalid vfree() Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 25/77] UBI: Fix double free after do_sync_erase() Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 26/77] iommu/vt-d: Fix an off-by-one bug in __domain_mapping() Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 27/77] blk-mq: use nr_cpu_ids as highest CPU ID count for hwq <-> cpu map Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 28/77] HID: i2c-hid: fix race condition reading reports Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 29/77] HID: i2c-hid: prevent buffer overflow in early IRQ Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 30/77] HID: roccat: potential out of bounds in pyra_sysfs_write_settings() Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 31/77] HID: add battery quirk for USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO keyboard Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 33/77] kvm: x86: drop severity of "generation wraparound" message Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 34/77] x86_64, vdso: Fix the vdso address randomization algorithm Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 35/77] x86, vdso: Use asm volatile in __getcpu Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 36/77] driver core: Fix unbalanced device reference in drivers_probe Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 37/77] misc: genwqe: check for error from get_user_pages_fast() Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 38/77] ALSA: usb-audio: extend KEF X300A FU 10 tweak to Arcam rPAC Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 39/77] ALSA: hda - using uninitialized data Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 40/77] ALSA: hda - Fix wrong gpio_dir & gpio_mask hint setups for IDT/STAC codecs Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 41/77] USB: cdc-acm: check for valid interfaces Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 42/77] Add USB_EHCI_EXYNOS to multi_v7_defconfig Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 43/77] genhd: check for int overflow in disk_expand_part_tbl() Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 44/77] cdc-acm: memory leak in error case Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 45/77] writeback: fix a subtle race condition in I_DIRTY clearing Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 46/77] tracing/sched: Check preempt_count() for current when reading task->state Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 47/77] serial: samsung: wait for transfer completion before clock disable Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 48/77] n_tty: Fix read_buf race condition, increment read_head after pushing data Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 49/77] Drivers: hv: vmbus: Fix a race condition when unregistering a device Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 50/77] fs: nfsd: Fix signedness bug in compare_blob Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 51/77] nfsd4: fix xdr4 inclusion of escaped char Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 52/77] ceph: do_sync is never initialized Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 53/77] ceph: fix null pointer dereference in discard_cap_releases() Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 54/77] mtd: tests: abort torturetest on erase errors Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 55/77] nilfs2: fix the nilfs_iget() vs. nilfs_new_inode() races Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 56/77] scripts/kernel-doc: dont eat struct members with __aligned Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 57/77] sched/deadline: Fix migration of SCHED_DEADLINE tasks Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 58/77] sched/deadline: Avoid double-accounting in case of missed deadlines Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 59/77] ARM: dts: DRA7: wdt: Fix compatible property for watchdog node Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 60/77] ARM: dts: Enable PWM node by default for s3c64xx Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 61/77] ARM: OMAP4: PM: Only do static dependency configuration in omap4_init_static_deps Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 62/77] Revert "ARM: 7830/1: delay: dont bother reporting bogomips in /proc/cpuinfo" Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 63/77] ARM: mvebu: disable I/O coherency on non-SMP situations on Armada 370/375/38x/XP Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 64/77] ACPI / PM: Fix PM initialization for devices that are not present Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 65/77] arm64: kernel: add missing __init section marker to cpu_suspend_init Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 66/77] arm64: kernel: refactor the CPU suspend API for retention states Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 67/77] arm64: Move cpu_resume into the text section Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 68/77] arm64: kernel: fix __cpu_suspend mm switch on warm-boot Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 69/77] Btrfs: dont delay inode ref updates during log replay Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 70/77] perf/x86/intel/uncore: Make sure only uncore events are collected Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 71/77] perf: Fix events installation during moving group Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 72/77] perf session: Do not fail on processing out of order event Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 73/77] spi: fsl: Fix problem with multi message transfers Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 74/77] mmc: sdhci: Fix sleep in atomic after inserting SD card Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 75/77] mm, vmscan: prevent kswapd livelock due to pfmemalloc-throttled process being killed Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 76/77] mm: propagate error from stack expansion even for guard page Greg Kroah-Hartman
2015-01-14 7:23 ` [PATCH 3.14 77/77] mm: Dont count the stack guard page towards RLIMIT_STACK Greg Kroah-Hartman
2015-01-14 16:37 ` [PATCH 3.14 00/77] 3.14.29-stable review Guenter Roeck
2015-01-14 16:48 ` Jiri Slaby
2015-01-14 18:05 ` Guenter Roeck
2015-01-15 0:33 ` Greg Kroah-Hartman
2015-01-14 22:48 ` Shuah Khan
2015-01-15 4:51 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150114072225.442771223@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=anton@enomsg.org \
--cc=arnd@arndb.de \
--cc=ccross@android.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=olof@lixom.net \
--cc=rdunlap@infradead.org \
--cc=robherring2@gmail.com \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).